Repository navigation
91 lines (84 loc) · 3.23 KB
/
Copy pathpython.yml
File metadata and controls
91 lines (84 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Python checks
on:
pull_request:
push:
branches: [master]
jobs:
lint:
name: Lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install ruff
run: pip install ruff
- name: Run ruff
run: ruff check . || echo "::warning::ruff found issues — please fix before merging"
continue-on-error: true
generated-table:
name: The generated table is what the catalog declares
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
# The MEOS-API catalog, derived here from MobilityDB master by the action
# every binding in the ecosystem uses. It is never committed: it is a
# derived artifact of one MobilityDB commit, and a tracked copy is drift
# waiting to happen.
- name: Derive the MEOS-API catalog
id: provision
uses: MobilityDB/MEOS-API/.github/actions/provision-meos@master
with:
mobilitydb-ref: master
# catalog_gen.py is the catalog's exposable functions projected into
# Python, so it is generated rather than kept by hand, and this is what
# makes the copy in the tree the current one. A function MEOS gains,
# loses or changes arrives here as a difference to regenerate, which is
# the whole reason the table is generated: a hand-kept copy goes stale
# in silence instead.
- name: The generated table is what the catalog declares
run: |
python3 tools/codegen.py -catalog "${{ steps.provision.outputs.catalog-path }}" \
-o mobilityapi/catalog_gen.py
if ! git diff --quiet -- mobilityapi/catalog_gen.py; then
echo "::error::the generated table is not what the catalog declares. Regenerate it: python3 tools/codegen.py -catalog <meos-idl.json>"
git diff --stat -- mobilityapi/catalog_gen.py
git diff -- mobilityapi/catalog_gen.py | head -n 100
exit 1
fi
echo "the committed table is what the catalog of MobilityDB master declares"
python-import:
name: Import smoke test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
- name: Verify modules import
run: |
python -c "import server" || true
python -c "import utils"
python -c "from resource.collections import Create, Retrieve"
python -c "from resource.moving_features import Create, Retrieve"
python -c "from resource.temporal_geom_query import distance, velocity, acceleration"
unit-tests:
name: Unit tests (PyMEOS-free)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install test dependencies
run: pip install pytest pyarrow
- name: Run unit tests
run: python -m pytest tests/test_bulk.py -v