211 lines (189 loc) · 7.46 KB
/
tests.yml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Tests
on: [push, pull_request]
jobs:
test:
name: ${{ matrix.os }}-${{ matrix.architecture }} Py${{ matrix.python }} GEOS ${{ matrix.geos }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, windows-2019]
architecture: [x64]
geos: [3.8.4, 3.9.5, 3.10.6, 3.11.3, 3.12.1, main]
include:
# 2019
- python: 3.8
geos: 3.8.4
numpy: 1.17.3
# 2020
- python: 3.9
geos: 3.9.5
numpy: 1.19.5
# 2021
- python: "3.10"
geos: 3.10.6
numpy: 1.21.3
# 2022
- python: "3.11"
geos: 3.11.3
numpy: 1.23.4
# 2023
- python: "3.12"
geos: 3.12.1
numpy: 1.26.2
matplotlib: true
doctest: true
# extra ignore for dateutil Python 3.12 warning fixed upstream (waiting on release 2.8.3+)
extra_pytest_args: "-W error -W ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning" # error on warnings
# dev
- python: "3.12"
geos: main
# extra ignore for dateutil Python 3.12 warning fixed upstream (waiting on release 2.8.3+)
extra_pytest_args: "-W error -W ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning" # error on warnings
# enable two 32-bit windows builds:
- os: windows-2019
architecture: x86
python: 3.8
geos: 3.8.4
numpy: 1.16.2
- os: windows-2019
architecture: x86
python: "3.11"
geos: 3.12.1
numpy: 1.24.4
# pypy (use explicit ubuntu version to not overwrite existing ubuntu-latest + geos 3.11.0 build)
- os: ubuntu-22.04
python: "pypy3.8"
geos: 3.12.1
numpy: 1.24.4
env:
GEOS_VERSION: ${{ matrix.geos }}
GEOS_VERSION_SPEC: ${{ matrix.geos }}
GEOS_INSTALL: ${{ github.workspace }}/geosinstall/geos-${{ matrix.geos }}
GEOS_BUILD: ${{ github.workspace }}/geosbuild
steps:
- name: Correct slashes in GEOS_INSTALL (Windows)
run: |
echo 'GEOS_INSTALL=${{ github.workspace }}\geosinstall\geos-${{ matrix.geos }}' >> $GITHUB_ENV
echo 'GEOS_BUILD=${{ github.workspace }}\geosbuild' >> $GITHUB_ENV
if: ${{ matrix.os == 'windows-2019' }}
- name: Checkout Shapely
uses: actions/checkout@v4
- name: Checkout GEOS (main)
uses: actions/checkout@v4
with:
repository: libgeos/geos
ref: main
path: ${{ env.GEOS_BUILD }}
if: ${{ matrix.geos == 'main' }}
- name: Put the latest commit hash in the cache token for GEOS main
run: |
echo "GEOS_VERSION_SPEC=$(git rev-parse HEAD)" >> $GITHUB_ENV
working-directory: ${{ env.GEOS_BUILD }}
if: ${{ matrix.geos == 'main' }}
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.architecture }}
allow-prereleases: true
- name: Cache GEOS and pip packages
uses: actions/cache@v4
with:
key: ${{ matrix.os }}-${{ matrix.architecture }}-geos-${{ env.GEOS_VERSION_SPEC }}-${{ hashFiles('ci/install_geos.sh') }}
path: |
~/.cache/pip
${{ github.workspace }}/geosinstall
- name: Activate MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.architecture }}
if: ${{ matrix.os == 'windows-2019' }}
- name: Install GEOS
run: |
bash ci/install_geos.sh
- name: Install python dependencies
run: |
python -m pip install --disable-pip-version-check --upgrade pip
pip install --upgrade wheel setuptools
if [ -z "${{ matrix.numpy }}" ]; then
pip install --upgrade --pre Cython pytest pytest-cov coveralls;
pip install --upgrade --pre --only-binary :all: -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
else
pip install --upgrade Cython numpy==${{ matrix.numpy }} pytest pytest-cov coveralls;
fi
if [ -n "${{ matrix.matplotlib }}" ]; then
pip install matplotlib
fi
if [ -n "${{ matrix.doctest }}" ]; then
pip install pyproj
fi
pip list
- name: Set environment variables (Linux)
run: |
echo "${{ env.GEOS_INSTALL }}/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${{ env.GEOS_INSTALL }}/lib" >> $GITHUB_ENV
if: ${{ startsWith(matrix.os, 'ubuntu') }}
- name: Set environment variables (OSX)
run: |
echo "${{ env.GEOS_INSTALL }}/bin" >> $GITHUB_PATH
echo "LDFLAGS=-Wl,-rpath,${{ env.GEOS_INSTALL }}/lib" >> $GITHUB_ENV
if: ${{ matrix.os == 'macos-13' }}
# Windows requires special treatment:
# - geos-config does not exist, so we specify include and library paths
# - Python >=3.8 ignores the PATH for finding DLLs, so we copy them into the package
- name: Set environment variables + copy DLLs (Windows)
run: |
cp geosinstall/geos-${{ matrix.geos }}/bin/*.dll shapely
echo 'GEOS_LIBRARY_PATH=${{ env.GEOS_INSTALL }}\lib' >> $GITHUB_ENV
echo 'GEOS_INCLUDE_PATH=${{ env.GEOS_INSTALL }}\include' >> $GITHUB_ENV
if: ${{ matrix.os == 'windows-2019' }}
- name: Build and install Shapely
# for the numpy nightly build, we temporarily need to build without
# the standard build isolation based on build-system.requires, to
# ensure we build against numpy nightly (numpy 2.0 compat)
run: |
if [ -z "${{ matrix.numpy }}" ]; then
pip install -e . --no-build-isolation
else
pip install -e .
fi
- name: Overview of the Python environment (pip list)
run: pip list
- name: Run tests
# Enable this if we have failures on GEOS main
# continue-on-error: ${{ matrix.geos == 'main' }}
run: |
python -c "import shapely; print(f'GEOS version: {shapely.geos_version_string}')"
pytest shapely/tests -r a --cov --cov-report term-missing ${{ matrix.extra_pytest_args }}
# Only run doctests on 1 runner (because of typographic differences in doctest results)
- name: Run doctests
if: ${{ matrix.os == 'ubuntu-latest' && matrix.doctest }}
run: |
python -m pytest --doctest-modules docs/manual.rst
- name: Run doctests (part 2)
if: ${{ matrix.os == 'ubuntu-latest' && matrix.doctest }}
run: |
pytest --doctest-modules shapely --ignore=shapely/tests
- name: Upload coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
shell: bash
run: |
coveralls --service=github || echo "!! intermittent coveralls failure"
coveralls:
name: Indicate completion to coveralls.io
needs: test
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --finish || echo "!! intermittent coveralls failure"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}