Repository navigation
120 lines (106 loc) · 4.72 KB
/
Copy pathtest.yml
File metadata and controls
120 lines (106 loc) · 4.72 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
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/**"
# A new push to a pull request cancels the run of its previous head; a push to a branch runs on
# its own commit, so every commit of master and of a stable branch keeps its run.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
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-15-intel, macos-14 ]
include:
- ld_prefix: "/usr/local"
- os: macos-14
ld_prefix: "/opt/homebrew"
# A pull request tests each macOS runner on one Python version, the oldest on the Intel
# runner and the newest on the arm64 one, while Ubuntu tests every version; a push to
# master or to a stable branch tests the whole matrix.
exclude: ${{ github.event_name == 'pull_request' && fromJSON('[{"os":"macos-15-intel","python-version":"3.11"},{"os":"macos-15-intel","python-version":"3.12"},{"os":"macos-15-intel","python-version":"3.13"},{"os":"macos-14","python-version":"3.10"},{"os":"macos-14","python-version":"3.11"},{"os":"macos-14","python-version":"3.12"}]') || fromJSON('[]') }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get dependencies from apt (cache)
uses: awalsh128/cache-apt-pkgs-action@v1.4.3
if: runner.os == 'Linux'
with:
packages: build-essential cmake postgresql-server-dev-16 libproj-dev libjson-c-dev libgsl-dev libgeos-dev
version: 1.1
- 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: 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 -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"
# A PyMEOS-CFFI branch named as this one carries a matching CFFI change; otherwise the
# CFFI of the MEOS line the package version maps to: stable-X.Y on a released line,
# master on the next one.
- 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 ${{ steps.meos_branch.outputs.meos_branch }} --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: 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