-
Notifications
You must be signed in to change notification settings - Fork 392
449 lines (436 loc) · 13.4 KB
/
basemap-for-manylinux.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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
name: basemap-for-manylinux
env:
PKGDIR: "packages/basemap"
PIP_DEFAULT_TIMEOUT: 10
PIP_DISABLE_PIP_VERSION_CHECK: 1
PIP_PREFER_BINARY: 1
PIP_RETRIES: 0
PYTHONUNBUFFERED: "1"
PYTHONWARNINGS: "ignore:DEPRECATION"
on:
push:
paths:
- ".github/workflows/basemap-for-manylinux.yml"
- "packages/basemap/**"
pull_request:
paths:
- ".github/workflows/basemap-for-manylinux.yml"
- "packages/basemap/**"
workflow_dispatch:
jobs:
checkout:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v1
-
name: Upload checkout
uses: actions/upload-artifact@v1
with:
name: checkout
path: .
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
max-parallel: 3
fail-fast: false
needs: checkout
container: "pylegacy/python:${{ matrix.python-version }}-debian-10"
steps:
-
name: Download checkout
uses: actions/download-artifact@v1
with:
name: checkout
path: .
-
name: Install lint requirements
run: |
cd ${{ env.PKGDIR }}
pip install -r requirements-lint.txt
-
name: Install library requirements
run: |
cd ${{ env.PKGDIR }}
pip install -r requirements.txt
-
name: Run Flake8
run: |
cd ${{ env.PKGDIR }}
if [ -x "$(command -v flake8)" ]; then
flake8 src/mpl_toolkits/basemap/cm.py src/mpl_toolkits/basemap/diagnostic.py src/mpl_toolkits/basemap/proj.py src/mpl_toolkits/basemap/solar.py test;
fi
-
name: Run PyLint
run: |
cd ${{ env.PKGDIR }}
if [ -x "$(command -v pylint)" ]; then
pylint src/mpl_toolkits/basemap/cm.py src/mpl_toolkits/basemap/diagnostic.py src/mpl_toolkits/basemap/proj.py src/mpl_toolkits/basemap/solar.py test;
fi
build-geos:
strategy:
matrix:
arch:
["x64", "x86"]
max-parallel: 2
fail-fast: false
needs: lint
runs-on: ubuntu-latest
container: "pylegacy/${{ matrix.arch }}-python:3.8-debian-4"
steps:
-
name: Download checkout
uses: actions/download-artifact@v1
with:
name: checkout
path: .
-
name: Install CMake 3.6.2
run: |
apt-get update
apt-get install -y libidn11
pkgvers=3.6.2
pkgname=cmake
pkgcode=cmake-${pkgvers}
case "${{ matrix.arch }}" in
x86) pkgfile=${pkgcode}-Linux-i386.tar.gz;;
*) pkgfile=${pkgcode}-Linux-x86_64.tar.gz;;
esac
wget https://github.com/Kitware/CMake/releases/download/v${pkgvers}/${pkgfile} -P /tmp
tar -xf /tmp/${pkgfile} --strip-components=1 -C /usr
rm -rf /tmp/${pkgfile}
-
name: Install GCC toolchain
run: |
apt-get update
apt-get install -y gcc g++ make
-
name: Build GEOS from source
run: |
cd ${{ env.PKGDIR }}
python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)"
-
name: Upload GEOS artifacts
uses: actions/upload-artifact@v1
with:
name: artifacts-geos-${{ matrix.arch }}
path: ${{ env.PKGDIR }}/extern
build:
strategy:
matrix:
arch:
["x64", "x86"]
python-version:
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
max-parallel: 3
fail-fast: false
needs: build-geos
runs-on: ubuntu-latest
container: "pylegacy/${{ matrix.arch }}-python:${{ matrix.python-version }}-debian-4"
steps:
-
name: Download checkout
uses: actions/download-artifact@v1
with:
name: checkout
path: .
-
name: Download GEOS artifacts
uses: actions/download-artifact@v1
with:
name: artifacts-geos-${{ matrix.arch }}
path: ${{ env.PKGDIR }}/extern
-
name: Install GCC toolchain
run: |
apt-get update
apt-get install -y gcc g++ make
-
name: Build old numpy from source
run: |
case "${{ matrix.arch }}" in
x64) arch="x86_64" ;;
x86) arch="i686" ;;
esac
case "${{ matrix.python-version }}" in
2.6|3.[23]) pkgvers=1.11.3; tag=manylinux1 ;;
2.7|3.[456789]) pkgvers=1.16.6; tag=manylinux1 ;;
3.10) pkgvers=1.21.4; tag=manylinux1 ;;
3.11) pkgvers=1.23.3; tag=manylinux_2_17 ;;
*) pkgvers=1.26.1; tag=manylinux_2_28 ;;
esac
case "${{ matrix.python-version }}" in
3.11|3.12)
# Dirty solution to get NumPy headers for Python 3.11 and 3.12.
kwds="--plat=${tag}_${arch}"
pip download --no-deps ${kwds} "numpy==${pkgvers}"
oldpkgfile=$(ls *.whl | head -n1)
newpkgfile=$(echo "${oldpkgfile}" | sed "s/${tag}/linux/")
mv "${oldpkgfile}" "${newpkgfile}"
pip install "${newpkgfile}"
rm "${newpkgfile}"
;;
*)
pip install "numpy == ${pkgvers}"
;;
esac
-
name: Build wheel
run: |
sitepkgdir=$(pip show numpy 2>/dev/null | grep Location: | cut -d' ' -f2)
export GEOS_DIR="${GITHUB_WORKSPACE}/${{ env.PKGDIR }}/extern"
export NUMPY_INCLUDE_PATH=${sitepkgdir}/numpy/core/include
case "${{ matrix.python-version }}" in
3.11|3.12)
kwds="--no-build-isolation"
pip install setuptools wheel "cython >= 0.29, < 3.1"
;;
esac
cd ${{ env.PKGDIR }}
python setup.py sdist
pip wheel -w dist --no-deps ${kwds} dist/*.zip
-
name: Upload build artifacts
uses: actions/upload-artifact@v1
with:
name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }}
path: ${{ env.PKGDIR }}/dist
repair:
strategy:
matrix:
arch:
["x64", "x86"]
python-version:
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
max-parallel: 3
fail-fast: false
needs: build
runs-on: ubuntu-latest
container: "pylegacy/${{ matrix.arch }}-python:3.8-debian-10"
steps:
-
name: Download GEOS artifacts
uses: actions/download-artifact@v1
with:
name: artifacts-geos-${{ matrix.arch }}
path: ${{ env.PKGDIR }}/extern
-
name: Download build artifacts
uses: actions/download-artifact@v1
with:
name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }}
path: ${{ env.PKGDIR }}/dist
-
name: Install auditwheel
run: |
apt-get update
apt-get install -y unzip
pip install patchelf
pip install "auditwheel < 4.0"
-
name: Repair wheel
run: |
cd ${{ env.PKGDIR }}
export LD_LIBRARY_PATH="$(readlink -f extern/lib)"
auditwheel repair -w dist dist/*.whl
-
name: Upload build artifacts
uses: actions/upload-artifact@v1
with:
name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }}
path: ${{ env.PKGDIR }}/dist
test:
strategy:
matrix:
arch:
["x64", "x86"]
python-version:
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
# Missing precompiled binaries for `numpy`, `matplotlib`,
# `pyproj`, `pillow` and `lxml`.
- arch: "x86"
python-version: "3.12"
max-parallel: 3
fail-fast: false
needs: repair
runs-on: ubuntu-latest
container: "pylegacy/${{ matrix.arch }}-python:${{ matrix.python-version }}-debian-10"
steps:
-
name: Download checkout
uses: actions/download-artifact@v1
with:
name: checkout
path: .
-
name: Download build artifacts
uses: actions/download-artifact@v1
with:
name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }}
path: ${{ env.PKGDIR }}/dist
-
name: Install numpy from source
run: |
apt-get update
apt-get install -y gcc g++ make
pip install "numpy < 1.24"
if: matrix.arch == 'x86' && (matrix.python-version >= '3.8' || matrix.python-version >= '3.10')
-
name: Install test requirements
run: |
cd ${{ env.PKGDIR }}
pip install -r requirements-test.txt
-
name: Install package (full)
run: |
whlpath=$(ls ${{ env.PKGDIR }}/dist/*-manylinux1*.whl | head -n1)
pip install "${whlpath}[owslib,pillow]"
-
name: Test package
run: |
cd ${{ env.PKGDIR }}
export COVERAGE_FILE=.coverage.${{ matrix.python-version }}
python -m pytest \
--cov="mpl_toolkits.basemap" --cov-report=term \
--ignore=dist --ignore=build
-
name: Upload test artifacts
uses: actions/upload-artifact@v1
with:
name: artifacts-test
path: ${{ env.PKGDIR }}/.coverage.${{ matrix.python-version }}
coverage:
needs: test
runs-on: ubuntu-latest
container: "pylegacy/python:3.8-debian-10"
steps:
-
name: Checkout
uses: actions/checkout@v1
-
name: Download test artifacts
uses: actions/download-artifact@v1
with:
name: artifacts-test
path: ${{ env.PKGDIR }}
-
name: Install test requirements
run: |
cd ${{ env.PKGDIR }}
pip install -r requirements-test.txt
-
name: Compute combined coverage
run: |
cd ${{ env.PKGDIR }}
coverage combine
coverage html
coverage report
-
name: Upload coverage artifacts
uses: actions/upload-artifact@v1
with:
name: artifacts-coverage
path: ${{ env.PKGDIR }}/htmlcov
docs:
needs: test
runs-on: ubuntu-latest
container: "pylegacy/python:3.8-debian-10"
steps:
-
name: Download checkout
uses: actions/download-artifact@v1
with:
name: checkout
path: .
-
name: Install doc requirements
run: |
cd ${{ env.PKGDIR }}
pip install -r requirements-doc.txt
-
name: Download build artifacts
uses: actions/download-artifact@v1
with:
name: artifacts-build-x64-3.8
path: ${{ env.PKGDIR }}/dist
-
name: Install package
run: |
cd ${{ env.PKGDIR }}
pip install dist/*-manylinux1*.whl
-
name: Run sphinx
run: |
cd ${{ env.PKGDIR }}
python -m sphinx doc/source public
-
name: Upload docs artifacts
uses: actions/upload-artifact@v1
with:
name: artifacts-docs
path: ${{ env.PKGDIR }}/public
-
name: Upload github-pages artifact
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: ${{ env.PKGDIR }}/public
pages:
if: startsWith(github.event.ref, 'refs/tags/v')
needs: docs
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- name: Deploy github-pages
uses: actions/deploy-pages@v3
id: deployment
upload:
strategy:
matrix:
arch:
["x64", "x86"]
python-version:
["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
max-parallel: 1
if: startsWith(github.event.ref, 'refs/tags/v')
needs: test
runs-on: ubuntu-latest
container: "pylegacy/${{ matrix.arch }}-python:${{ matrix.python-version }}-debian-10"
environment: PyPI
steps:
-
name: Download build artifacts
uses: actions/download-artifact@v1
with:
name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }}
path: ${{ env.PKGDIR }}/dist
-
name: Install upload requirements
run: |
pip install twine
-
name: Check distributables
run: |
python -m twine check \
${{ env.PKGDIR }}/dist/*.zip \
${{ env.PKGDIR }}/dist/*-manylinux1*.whl
-
name: Upload distributables
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: "${{ secrets.PYPI_TOKEN }}"
TWINE_REPOSITORY_URL: "${{ secrets.PYPI_REPOSITORY_URL }}"
run: |
python -m twine upload --skip-existing \
${{ env.PKGDIR }}/dist/*.zip \
${{ env.PKGDIR }}/dist/*-manylinux1*.whl