-
Notifications
You must be signed in to change notification settings - Fork 11
129 lines (114 loc) · 4.61 KB
/
Copy pathtest.yml
File metadata and controls
129 lines (114 loc) · 4.61 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Test PyMEOS
on:
push:
branches: [ "master", "stable-[0-9]+.[0-9]+" ]
paths-ignore:
- "docs/**"
- ".readthedocs.yml"
- "README.md"
- ".github/ISSUE_TEMPLATE/**"
pull_request:
branches: [ "master", "stable-[0-9]+.[0-9]+" ]
paths-ignore:
- "docs/**"
- ".readthedocs.yml"
- "README.md"
- ".github/ISSUE_TEMPLATE/**"
jobs:
test:
name: Test PyMEOS - Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
os: [ ubuntu-latest, macos-13, macos-14 ]
include:
- ld_prefix: "/usr/local"
- os: macos-14
ld_prefix: "/opt/homebrew"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get dependencies from apt (cache)
uses: awalsh128/cache-apt-pkgs-action@latest
if: runner.os == 'Linux'
with:
packages: build-essential cmake postgresql-server-dev-16 libproj-dev libjson-c-dev libgsl-dev libgeos-dev
version: 1.0
- name: Get dependencies from homebrew (cache)
uses: tecolicom/actions-use-homebrew-tools@v1
if: runner.os == 'macOS'
with:
tools: cmake libpq proj json-c gsl geos
- name: Update brew
if: matrix.os == 'macos-13'
# Necessary to avoid issue with macOS runners. See
# https://github.com/actions/runner-images/issues/4020
run: |
brew reinstall python@3.12 || brew link --overwrite python@3.12
brew reinstall python@3.11 || brew link --overwrite python@3.11
brew update
- name: Derive MEOS branch from package version
id: meos_branch
shell: bash
run: |
pymeos_version=$(sed -nE 's/^__version__ = "([^"]+)".*/\1/p' pymeos/__init__.py)
major_minor=$(echo "$pymeos_version" | sed -nE 's/^([0-9]+\.[0-9]+).*/\1/p')
candidate="stable-${major_minor}"
if git ls-remote --exit-code https://github.com/MobilityDB/MobilityDB "$candidate" >/dev/null 2>&1; then
meos_branch=$candidate
else
meos_branch="master"
fi
echo "Package version $pymeos_version => MEOS branch $meos_branch"
echo "meos_branch=$meos_branch" >> "$GITHUB_OUTPUT"
- name: Fetch MEOS sources
run: |
git clone --branch ${{ steps.meos_branch.outputs.meos_branch }} --depth 1 https://github.com/MobilityDB/MobilityDB
- name: Install MEOS
run: |
mkdir MobilityDB/build
cd MobilityDB/build
cmake .. -DMEOS=ON -DCBUFFER=ON -DPOSE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ matrix.ld_prefix }}
make -j
sudo make install
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Fetch PyMEOS CFFI sources
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: |
git clone --branch ${{ env.BRANCH_NAME }} --depth 1 https://github.com/MobilityDB/PyMEOS-CFFI \
|| git clone --branch ${{ github.base_ref || 'master' }} --depth 1 https://github.com/MobilityDB/PyMEOS-CFFI
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r PyMEOS-CFFI/dev-requirements.txt
pip install -r dev-requirements.txt
- name: Install pymeos_cffi
run: |
cd PyMEOS-CFFI
python ./builder/build_header.py
python ./builder/build_pymeos_functions.py
pip install .
- name: Portable bare-name parity gate
# Regenerate pymeos/portable.py from the MEOS just built+installed so
# the shipped module matches the binding under test, and hard-gate
# the canonical contract: 29/29 bare names backed, 0 unbacked, all
# six families, and the live pymeos_cffi backs every one (--cffi).
run: |
export MEOS_INCLUDE=${{ matrix.ld_prefix }}/include
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib
python tools/portable_aliases/generate.py --cffi --check
- name: Test PyMEOS with pytest
run: |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ matrix.ld_prefix }}/lib
pytest