forked from mesonbuild/meson-python
-
Notifications
You must be signed in to change notification settings - Fork 0
358 lines (304 loc) · 9.85 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
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
# SPDX-FileCopyrightText: 2021 The meson-python developers
#
# SPDX-License-Identifier: MIT
name: tests
on:
push:
pull_request:
branches:
- main
- release-*
paths:
# This is spelt like this to do not ignore the docs/examples/ folder.
- '**'
- '!docs/**'
- 'docs/examples/**'
- '!CHANGELOG.rst'
- '!LICENSE'
- '!LICENSES/**'
- '!README.rst'
workflow_dispatch:
# Allow to run manually
env:
FORCE_COLOR: 1
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- macos
- windows
python:
- '3.7'
- '3.11'
meson:
-
include:
- os: ubuntu
python: 'pypy-3.9'
- os: ubuntu
python: '3.8'
- os: ubuntu
python: '3.9'
- os: ubuntu
python: '3.10'
- os: ubuntu
python: '3.12-dev'
# Test with older supported Meson version.
- os: ubuntu
python: '3.11'
meson: '~=0.63.3'
- os: ubuntu
python: '3.11'
meson: '~=0.64.0'
- os: ubuntu
python: '3.11'
meson: '~=1.0.0'
- os: ubuntu
python: '3.11'
meson: '~=1.1.0'
# Test with Meson master branch.
- os: ubuntu
python: '3.11'
meson: '@git+https://github.com/mesonbuild/meson.git'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up target Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install Ninja
run: sudo apt-get install ninja-build
if: ${{ matrix.os == 'ubuntu' }}
- name: Install Ninja
run: brew install ninja
if: ${{ matrix.os == 'macos' }}
- name: Install Ninja
run: python -m pip --disable-pip-version-check install ninja
if: ${{ matrix.os == 'windows' }}
- name: Install Meson
run: python -m pip --disable-pip-version-check install "meson ${{ matrix.meson }}"
if: ${{ matrix.meson }}
- name: Install
run: python -m pip --disable-pip-version-check install .[test]
- name: Run tests
run: >-
python -m pytest --showlocals -vv --cov
--cov-report=xml:coverage-${{ matrix.python }}.xml
- name: Send coverage report
uses: codecov/codecov-action@v1
if: ${{ always() }}
env:
PYTHON: ${{ matrix.python }}
with:
flags: tests
env_vars: PYTHON
name: ${{ matrix.python }}
msvc:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python:
- '3.11'
meson:
-
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up target Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install Ninja
run: python -m pip --disable-pip-version-check install ninja
- name: Setup MSVC
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
with:
architecture: x64
- name: Install Meson
run: python -m pip --disable-pip-version-check install "meson==${{ matrix.meson }}"
if: ${{ matrix.meson }}
- name: Install
run: python -m pip --disable-pip-version-check install .[test]
- name: Run tests
run: >-
python -m pytest --showlocals -vv
cygwin:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python:
- '3.9'
meson:
-
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Cygwin
uses: cygwin/cygwin-install-action@v2
with:
packages: >-
python39
python39-devel
python39-pip
python39-setuptools
cmake
gcc-core
gcc-g++
git
make
ninja
- name: Fix git dubious ownership
# This addresses the "fatal: detected dubious ownership in
# repository" and "fatal: not in a git directory" errors
# encountered when trying to run Cygwin git in a directory not
# owned by the current user. This happens when the tests run
# Cygwin git in a directory outside the Cygwin filesystem.
run: git config --global --add safe.directory '*'
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
- name: Get pip cache path
id: pip-cache-path
run: echo "path=$(cygpath -w $(python -m pip cache dir))" >> $GITHUB_OUTPUT
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
- name: Restore cache
# Cygwin Python cannot use binary wheels from PyPI. Building
# some dependencies takes considerable time. Caching the built
# wheels speeds up the CI job quite a bit.
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache-path.outputs.path }}
key: cygwin-pip-${{ github.sha }}
restore-keys: cygwin-pip-
- name: Install Meson
run: python -m pip --disable-pip-version-check install "meson ${{ matrix.meson }}"
if: ${{ matrix.meson }}
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
- name: Install
# Cygwin patches Python's ensurepip module to look for the
# wheels needed to initialize a new virtual environment in
# /usr/share/python-wheels/ but nothing in Cygwin actually
# puts the setuptools and pip wheels there. Fix this.
run: |
mkdir /usr/share/python-wheels/
pushd /usr/share/python-wheels/
python -m pip --disable-pip-version-check download setuptools pip
popd
python -m pip --disable-pip-version-check install .[test]
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
- name: Run tests
run: >-
python -m pytest --showlocals -vv --cov
--cov-report=xml:coverage-${{ matrix.python }}.xml
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
- name: Send coverage report
uses: codecov/codecov-action@v1
if: ${{ always() }}
env:
PYTHON: cygwin-${{ matrix.python }}
with:
flags: tests
env_vars: PYTHON
name: cygwin-${{ matrix.python }}
pyston:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python:
- '3.8'
meson:
-
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install pyston
run: |
wget https://github.com/pyston/pyston/releases/download/pyston_2.3.5/pyston_2.3.5_20.04_amd64.deb
sudo apt install $(pwd)/pyston_2.3.5_20.04_amd64.deb
- name: Install Ninja
run: sudo apt-get install ninja-build
- name: Install Meson
run: python -m pip --disable-pip-version-check install "meson ${{ matrix.meson }}"
if: ${{ matrix.meson }}
- name: Install
run: pyston -m pip --disable-pip-version-check install .[test]
- name: Run tests
run: >-
pyston -m pytest --showlocals -vv --cov
--cov-report=xml:coverage-pyston.xml
- name: Send coverage report
uses: codecov/codecov-action@v1
if: ${{ always() }}
env:
PYTHON: pyston
with:
flags: tests
env_vars: PYTHON
name: pyston
homebrew:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python:
- '3.8'
- '3.11'
meson:
-
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Homebrew Python
run: |
brew install --overwrite python@${{ matrix.python }}
echo /usr/local/opt/python@${{ matrix.python }}/libexec/bin/ >> $GITHUB_PATH
- name: Install Ninja
run: brew install ninja
- name: Update pip
# pip >= 23.0 fixes https://github.com/pypa/pip/issues/11539
run: python -m pip --disable-pip-version-check install --upgrade "pip >= 23.0"
- name: Install Meson
run: python -m pip --disable-pip-version-check install "meson ${{ matrix.meson }}"
if: ${{ matrix.meson }}
- name: Install
run: python -m pip --disable-pip-version-check install .[test]
- name: Run tests
run: >-
python -m pytest --showlocals -vv --cov
--cov-report=xml:coverage-homebrew-${{ matrix.python }}.xml
- name: Send coverage report
uses: codecov/codecov-action@v1
if: ${{ always() }}
env:
PYTHON: homebrew-${{ matrix.python }}
with:
flags: tests
env_vars: PYTHON
name: homebrew-${{ matrix.python }}
mypy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install mypy
run: python -m pip --disable-pip-version-check install mypy==0.991
- name: Run mypy
run: mypy -p mesonpy
# tests-pass:
# needs: [test, cygwin, pyston, homebrew, mypy]
# runs-on: ubuntu-latest
# steps:
# - run: echo "All jobs passed"