forked from cython/cython
-
Notifications
You must be signed in to change notification settings - Fork 0
297 lines (266 loc) · 9.09 KB
/
ci.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
name: CI
on:
push:
paths:
- '**'
- '!.github/**'
- '.github/workflows/ci.yml'
pull_request:
paths:
- '**'
- '!.github/**'
- '.github/workflows/ci.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
ci:
strategy:
# Allows for matrix sub-jobs to fail without canceling the rest
fail-fast: false
# MATRIX:
# =======
# Required parameters:
# os the os to run on
# python-version the python version to use
# backend the backend to use
# env any additional env variables. Set to '{}' for none
# Optional parameters:
# allowed_failure whether the job is allowed to fail
# extra_hash extra hash str to differentiate from other caches with similar name (must always start with '-')
matrix:
# Tests [amd64]
#
# FIXME: 'cpp' tests seems to fail due to compilation errors (numpy_pythran_unit)
# in all python versions and test failures (builtin_float) in 3.5<
os: [ubuntu-20.04, windows-2019, macos-12]
backend: [c, cpp]
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13-dev"
env: [{}]
include:
- python-version: "3.13-dev"
allowed_failure: true
# Ubuntu sub-jobs:
# ================
# GCC 11 (with broad language standards)
- os: ubuntu-20.04
python-version: "3.9"
backend: c
env: { GCC_VERSION: 11, EXTRA_CFLAGS: "-std=c99" }
extra_hash: "-c99"
- os: ubuntu-20.04
python-version: "3.11"
backend: c
env: { GCC_VERSION: 11, EXTRA_CFLAGS: "-std=c17" }
extra_hash: "-gcc11"
- os: ubuntu-20.04
python-version: "3.11"
backend: cpp
env: { GCC_VERSION: 11, EXTRA_CFLAGS: "-std=c++20" }
extra_hash: "-gcc11"
# compile all modules
- os: ubuntu-20.04
python-version: "3.7"
backend: c
env: { CYTHON_COMPILE_ALL: 1 }
extra_hash: "-all"
- os: ubuntu-20.04
python-version: "3.7"
backend: cpp
env: { CYTHON_COMPILE_ALL: 1 }
extra_hash: "-all"
- os: ubuntu-20.04
python-version: "3.11"
backend: c
env: { CYTHON_COMPILE_ALL: 1 }
extra_hash: "-all"
- os: ubuntu-20.04
python-version: "3.11"
backend: cpp
env: { CYTHON_COMPILE_ALL: 1 }
extra_hash: "-all"
# Linting
- os: ubuntu-20.04
python-version: "3.9"
backend: "c,cpp"
env: { TEST_CODE_STYLE: 1, NO_CYTHON_COMPILE: 1 }
extra_hash: "-codestyle"
# Limited API
- os: ubuntu-20.04
python-version: "3.7"
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", NO_LIMITED_COMPILE: 1, EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
- os: ubuntu-20.04
python-version: "3.8"
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", NO_LIMITED_COMPILE: 1, EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
- os: ubuntu-20.04
python-version: "3.11"
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
- os: ubuntu-20.04
python-version: "3.12"
allowed_failure: true
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
- os: ubuntu-20.04
python-version: "3.13-dev"
allowed_failure: true
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
# Type specs
- os: ubuntu-20.04
python-version: "3.9"
backend: c
env: { EXTRA_CFLAGS: "-DCYTHON_USE_TYPE_SPECS=1" }
extra_hash: "-typespecs"
- os: ubuntu-20.04
python-version: "3.8"
backend: c
env: { EXTRA_CFLAGS: "-DCYTHON_USE_TYPE_SPECS=1" }
extra_hash: "-typespecs"
- os: ubuntu-20.04
python-version: "3.7"
backend: c
env: { EXTRA_CFLAGS: "-DCYTHON_USE_TYPE_SPECS=1" }
extra_hash: "-typespecs"
# Stackless
- os: ubuntu-20.04
python-version: "3.8"
backend: c
env: { STACKLESS: true, PY: 3 }
extra_hash: "-stackless"
# Pypy
- os: ubuntu-20.04
python-version: pypy-3.9
backend: c
env: { NO_CYTHON_COMPILE: 1 }
- os: ubuntu-20.04
python-version: pypy-3.10
backend: c
env: { NO_CYTHON_COMPILE: 1 }
# Free-threading
- os: ubuntu-20.04
python-version: 3.13-freethreading-dev
backend: "c,cpp"
env: {}
allowed_failure: true
# This defaults to 360 minutes (6h) which is way too long and if a test gets stuck, it can block other pipelines.
# From testing, the runs tend to take ~20 minutes for ubuntu / macos and ~40 for windows,
# so a limit of 80 minutes should be enough. This can always be changed in the future if needed.
timeout-minutes: 80
runs-on: ${{ matrix.os }}
env:
BACKEND: ${{ matrix.backend }}
PYTHON_VERSION: ${{ matrix.python-version }}
MACOSX_DEPLOYMENT_TARGET: 11.0
GCC_VERSION: 8
USE_CCACHE: 1
CCACHE_SLOPPINESS: "pch_defines,time_macros"
CCACHE_COMPRESS: 1
CCACHE_MAXSIZE: "200M"
steps:
- name: Checkout repo
uses: actions/[email protected]
with:
fetch-depth: 1
- name: Setup python
uses: actions/[email protected]
if: "!endsWith(matrix.python-version, '-freethreading-dev')"
with:
python-version: ${{ matrix.python-version }}
- name: Setup python from deadsnakes
uses: deadsnakes/[email protected]
if: "endsWith(matrix.python-version, '-freethreading-dev')"
with:
python-version: 3.13-dev
nogil: true
- name: Compilation Cache
uses: hendrikmuhs/[email protected]
with:
variant: ${{ startsWith(runner.os, 'windows') && 'sccache' || 'ccache' }} # fake ternary
key: ${{ runner.os }}-hendrikmuhs-ccache${{ matrix.extra_hash }}-${{ matrix.python-version }}-${{ matrix.backend == 'c' || matrix.backend == 'c,cpp' }}-${{ contains(matrix.backend, 'cpp') }}-${{ hashFiles('test-requirements*.txt', '.github/**/ci.yml', 'Tools/**/ci-run.sh') }}
max-size: ${{ env.CCACHE_MAXSIZE }}
- name: Run CI
continue-on-error: ${{ matrix.allowed_failure || false }}
env: ${{ matrix.env }}
run: bash ./Tools/ci-run.sh
- name: Upload HTML docs
uses: actions/[email protected]
with:
name: htmldocs
path: docs/build/html
if-no-files-found: ignore
- name: Upload wheels
uses: actions/[email protected]
with:
name: wheels-${{ runner.os }}-${{ matrix.python-version }}${{ matrix.extra_hash }}
path: dist/*.whl
if-no-files-found: ignore
pycoverage:
runs-on: ubuntu-20.04
env:
BACKEND: c,cpp
OS_NAME: ubuntu-20.04
PYTHON_VERSION: "3.11"
steps:
- name: Checkout repo
uses: actions/[email protected]
- name: Setup python
uses: actions/[email protected]
with:
python-version: "3.11"
- name: Run Coverage
env: { COVERAGE: 1, NO_CYTHON_COMPILE: 1 }
run: bash ./Tools/ci-run.sh
- name: Upload Coverage Report
uses: actions/[email protected]
with:
name: pycoverage_html
path: coverage-report-html
cycoverage:
runs-on: ubuntu-20.04
env:
BACKEND: c,cpp
OS_NAME: ubuntu-20.04
PYTHON_VERSION: "3.11"
steps:
- name: Checkout repo
uses: actions/[email protected]
with:
fetch-depth: 1
- name: Setup python
uses: actions/[email protected]
with:
python-version: "3.11"
- name: Run Coverage
env: { COVERAGE: 1 }
run: bash ./Tools/ci-run.sh
- name: Upload Coverage Report
uses: actions/[email protected]
with:
name: cycoverage_html
path: coverage-report-html
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Codespell
uses: codespell-project/actions-codespell@v2