-
Notifications
You must be signed in to change notification settings - Fork 392
318 lines (309 loc) · 9.43 KB
/
basemap-for-windows.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
name: basemap-for-windows
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-windows.yml"
- "!packages/basemap/doc/**"
- "packages/basemap/**"
pull_request:
paths:
- ".github/workflows/basemap-for-windows.yml"
- "!packages/basemap/doc/**"
- "packages/basemap/**"
workflow_dispatch:
jobs:
checkout:
runs-on: windows-2019
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Upload checkout
uses: actions/upload-artifact@v4
with:
name: checkout
path: .
lint:
runs-on: windows-2019
strategy:
matrix:
python-version:
["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
max-parallel: 3
fail-fast: false
needs: checkout
steps:
-
name: Download checkout
uses: actions/download-artifact@v4
with:
name: checkout
path: .
-
name: Set Python
uses: pylegacy/actions/setup-pyenv-win@v2
with:
architecture: ${{ matrix.arch }}
python-version: ${{ matrix.python-version }}
-
name: Set Python base packages
run: |
python -m pip install --upgrade pip setuptools wheel
-
name: Install lint requirements
run: |
cd ${{ env.PKGDIR }}
python -m pip install -r requirements-lint.txt
-
name: Install library requirements
run: |
cd ${{ env.PKGDIR }}
python -m pip install -r requirements.txt
-
name: Run Flake8
run: |
cd ${{ env.PKGDIR }}
if (Get-Command flake8 -errorAction SilentlyContinue)
{
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;
}
-
name: Run PyLint
run: |
cd ${{ env.PKGDIR }}
if (Get-Command pylint -errorAction SilentlyContinue)
{
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;
}
build-geos:
strategy:
matrix:
arch:
["x64", "x86"]
msvc-toolset:
["14.0"]
include:
- msvc-toolset: "14.0"
python-version: "3.5"
max-parallel: 4
fail-fast: false
needs: lint
runs-on: windows-2019
steps:
-
name: Download checkout
uses: actions/download-artifact@v4
with:
name: checkout
path: .
-
name: Set MSVC toolset
uses: pylegacy/actions/setup-msvc@v2
with:
arch: ${{ matrix.arch }}
toolset: ${{ matrix.msvc-toolset }}
-
name: Set CMake
uses: jwlawson/[email protected]
with:
cmake-version: "3.24.2"
-
name: Set Python
uses: pylegacy/actions/setup-pyenv-win@v2
with:
architecture: ${{ matrix.arch }}
python-version: ${{ matrix.python-version }}
-
name: Build GEOS from source
run: |
cd ${{ env.PKGDIR }}
python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', toolset='${{ matrix.msvc-toolset }}', njobs=16)"
-
name: Upload GEOS artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-geos-${{ matrix.arch }}-msvc${{ matrix.msvc-toolset }}
path: ${{ env.PKGDIR }}/extern
build:
strategy:
matrix:
arch:
["x64", "x86"]
python-version:
["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: windows-2019
steps:
-
name: Download checkout
uses: actions/download-artifact@v4
with:
name: checkout
path: .
-
name: Set Python
uses: pylegacy/actions/setup-pyenv-win@v2
with:
architecture: ${{ matrix.arch }}
python-version: ${{ matrix.python-version }}
-
name: Set Python base packages
run: |
python -m pip install --upgrade pip setuptools wheel
-
name: Build old numpy from source
run: |
Switch -regex ("${{ matrix.python-version }}") {
"^3\.10$" { Set-Variable -Name "pkgvers" -Value "1.21.4" }
"^3\.11$" { Set-Variable -Name "pkgvers" -Value "1.23.3" }
default { Set-Variable -Name "pkgvers" -Value "1.26.1" }
}
$env:SETUPTOOLS_USE_DISTUTILS = "stdlib"
python -m pip install "numpy == ${pkgvers}"
-
name: Set MSVC toolset version
run: |
echo "msvc-toolset=14.0" >> $env:GITHUB_ENV
-
name: Set MSVC toolset
uses: pylegacy/actions/setup-msvc@v2
with:
arch: ${{ matrix.arch }}
toolset: ${{ env.msvc-toolset }}
-
name: Download GEOS artifacts
uses: actions/download-artifact@v4
with:
name: artifacts-geos-${{ matrix.arch }}-msvc${{ env.msvc-toolset }}
path: ${{ env.PKGDIR }}/extern
-
name: Build sdist and wheel
run: |
cd ${{ env.PKGDIR }}
$env:GEOS_DIR = "$env:GITHUB_WORKSPACE/${{ env.PKGDIR }}/extern"
python -m pip install -r requirements-setup.txt
python setup.py sdist
python -m pip wheel -w dist --no-deps (Get-Item dist/*.zip)
-
name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }}
path: ${{ env.PKGDIR }}/dist
test:
strategy:
matrix:
arch:
["x64", "x86"]
python-version:
["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
# Missing precompiled binaries for `numpy` and `matplotlib`.
- arch: "x86"
python-version: "3.12"
max-parallel: 3
fail-fast: false
needs: build
runs-on: windows-2019
steps:
-
name: Download checkout
uses: actions/download-artifact@v4
with:
name: checkout
path: .
-
name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }}
path: ${{ env.PKGDIR }}/dist
-
name: Set Python
uses: pylegacy/actions/setup-pyenv-win@v2
with:
architecture: ${{ matrix.arch }}
python-version: ${{ matrix.python-version }}
-
name: Set Python base packages
run: |
python -m pip install --upgrade pip setuptools wheel
-
name: Install test requirements
run: |
cd ${{ env.PKGDIR }}
pip install -r requirements-test.txt
-
name: Install package (full)
run: |
$whlpath = "$(Get-Item ${{ env.PKGDIR }}/dist/*-win*.whl)"
python -m pip install "${whlpath}[owslib,pillow]"
-
name: Test package
run: |
cd ${{ env.PKGDIR }}
$env:COVERAGE_FILE = ".coverage.${{ matrix.arch }}.${{ 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@v4
with:
name: artifacts-test-${{ matrix.arch }}-${{ matrix.python-version }}
path: ${{ env.PKGDIR }}/.coverage.${{ matrix.arch }}.${{ matrix.python-version }}
upload:
strategy:
matrix:
arch:
["x64", "x86"]
python-version:
["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: windows-2019
environment: PyPI
steps:
-
name: Set Python
uses: pylegacy/actions/setup-pyenv-win@v2
with:
architecture: ${{ matrix.arch }}
python-version: ${{ matrix.python-version }}
-
name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: artifacts-build-${{ matrix.arch }}-${{ matrix.python-version }}
path: ${{ env.PKGDIR }}/dist
-
name: Install upload requirements
run: |
python -m pip install twine
-
name: Check distributables
run: |
python -m twine check `
${{ env.PKGDIR }}/dist/*.zip `
${{ env.PKGDIR }}/dist/*.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/*.whl