-
-
Notifications
You must be signed in to change notification settings - Fork 38
336 lines (330 loc) · 10.9 KB
/
test.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
name: Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16'
- name: npm install
run: npm install
- name: lint
run: npm run lint
test:
name: Test Suite
runs-on: ${{ matrix.os }}
needs: [lint]
env:
RUST_BACKTRACE: '1'
strategy:
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
matrix:
os:
- ubuntu-latest
- macos-13
- windows-latest
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: PyO3/maturin
ref: main
path: maturin
- uses: dtolnay/rust-toolchain@stable
- name: maturin build
uses: ./
with:
rust-toolchain: ${{ matrix.toolchain }}
args: -o dist
working-directory: maturin/test-crates/pyo3-mixed
before-script-linux: |
sudo apt-get update
sudo apt-get install -y libclang-dev
- name: maturin build universal2 target
if: startsWith(matrix.os, 'macos')
uses: ./
with:
target: universal2
working-directory: maturin/test-crates/pyo3-mixed
- name: maturin build universal2
if: startsWith(matrix.os, 'macos')
uses: ./
with:
target: universal2-apple-darwin
working-directory: maturin/test-crates/pyo3-mixed
- name: maturin build arm64
if: startsWith(matrix.os, 'macos')
uses: ./
with:
target: aarch64-apple-darwin
args: -m maturin/test-crates/pyo3-mixed/Cargo.toml
- name: check maturin in PATH
run: maturin --help
- name: maturin build manylinux auto
if: matrix.os == 'ubuntu-latest'
uses: ./
with:
args: -i python3.10 --out dist
working-directory: maturin/test-crates/pyo3-mixed
manylinux: 'auto'
- name: maturin build manylinux2014
uses: ./
with:
args: -m maturin/test-crates/pyo3-mixed/Cargo.toml -i python3.10 --out dist
manylinux: '2014'
before-script-linux: |
yum install -y llvm-toolset-7-clang
source /opt/rh/llvm-toolset-7/enable
- name: maturin build nightly powerpc64le musl
if: ${{ matrix.os == 'ubuntu-latest' && matrix.toolchain == 'nightly' }}
uses: ./
with:
rust-toolchain: nightly
args: -m maturin/test-crates/hello-world/Cargo.toml
manylinux: 'auto'
target: 'powerpc64le-unknown-linux-musl'
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: maturin build manylinux off
uses: ./
with:
args: -m maturin/test-crates/pyo3-mixed/Cargo.toml -i python3.11
manylinux: 'off'
- name: maturin build container off
uses: ./
with:
rustup-components: rustfmt
args: -m maturin/test-crates/pyo3-mixed/Cargo.toml -i python3.11
manylinux: 'off'
container: 'off'
- name: maturin build container manylinux version
uses: ./
with:
rustup-components: |
rustfmt
rust-std
args: -m maturin/test-crates/pyo3-mixed/Cargo.toml -i python3.10
manylinux: 'auto'
container: '2_17'
- name: maturin build --cargo-extra-args
uses: ./
with:
args: -m tests/pyo3-pure/Cargo.toml --features python
manylinux: 'auto'
- name: docker pull
if: matrix.os == 'ubuntu-latest'
run: docker pull quay.io/pypa/manylinux_2_28_x86_64:latest
- name: maturin build with existing docker image
if: matrix.os == 'ubuntu-latest'
uses: ./
with:
rustup-components: rustfmt
container: quay.io/pypa/manylinux_2_28_x86_64:latest
args: -m maturin/test-crates/pyo3-mixed/Cargo.toml -i python3.10
manylinux: 'auto'
- name: maturin build --target args
if: matrix.os == 'ubuntu-latest'
uses: ./
with:
rust-toolchain: ${{ matrix.toolchain }}
args: -m maturin/test-crates/pyo3-pure/Cargo.toml --target aarch64-unknown-linux-gnu
- name: maturin build --zig
uses: ./
with:
rust-toolchain: ${{ matrix.toolchain }}
target: aarch64-unknown-linux-gnu
args: -m maturin/test-crates/pyo3-pure/Cargo.toml --zig
manylinux: 'auto'
- name: maturin build --zig container on
if: matrix.os == 'ubuntu-latest'
uses: ./
with:
rust-toolchain: ${{ matrix.toolchain }}
target: aarch64-unknown-linux-gnu
args: -m maturin/test-crates/pyo3-pure/Cargo.toml --zig
manylinux: 'auto'
container: 'on'
- name: maturin build --zig unsupported target
if: matrix.os == 'ubuntu-latest'
uses: ./
with:
rust-toolchain: ${{ matrix.toolchain }}
target: s390x-unknown-linux-gnu
args: -m maturin/test-crates/pyo3-pure/Cargo.toml --zig
manylinux: 'auto'
- name: maturin build cffi project
uses: ./
with:
args: -m maturin/test-crates/cffi-pure/Cargo.toml
manylinux: 'auto'
- run: cargo clean --manifest-path maturin/test-crates/pyo3-pure/Cargo.toml
- name: maturin build with sccache
uses: ./
with:
args: -m maturin/test-crates/pyo3-pure/Cargo.toml
manylinux: 'auto'
sccache: 'true'
test-manylinux:
name: Manylinux Test Suite
runs-on: ${{ matrix.os }}
needs: [lint]
strategy:
fail-fast: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-no-fail-fast') }}
matrix:
os:
- ubuntu-latest
platform: [
{
manylinux: '2014',
target: 'x86_64', # Test target alias
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: '2_35', # no docker images
target: 'x86_64',
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: '2014',
target: 'i686-unknown-linux-gnu',
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: '2014',
target: 'aarch64-unknown-linux-gnu',
test-crate: 'maturin/test-crates/pyo3-pure' # abi3
},
{
manylinux: '2014',
target: 'armv7-unknown-linux-gnueabihf',
test-crate: 'maturin/test-crates/pyo3-pure' # abi3
},
{
manylinux: '2014',
target: 'powerpc64le-unknown-linux-gnu',
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: 'manylinux_2_24',
target: 'powerpc64le-unknown-linux-gnu',
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: 'manylinux_2_28',
target: 'aarch64-unknown-linux-gnu',
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: 'manylinux2014',
target: 's390x',
test-crate: 'maturin/test-crates/pyo3-mixed'
},
{
manylinux: 'auto',
target: 'x86_64-unknown-linux-musl', # MUSL
test-crate: 'maturin/test-crates/hello-world' # binary
},
{
manylinux: 'musllinux_1_1',
target: 'x86_64',
test-crate: 'maturin/test-crates/pyo3-pure'
},
{
manylinux: 'musllinux_1_2',
target: 'x86_64-unknown-linux-musl', # MUSL
test-crate: 'maturin/test-crates/hello-world' # binary
},
]
toolchain: [stable, nightly]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: PyO3/maturin
path: maturin
- name: Set up QEMU
uses: dbhi/qus/action@main
- name: maturin build
uses: ./
env:
RUST_BACKTRACE: '1'
with:
container: ${{ matrix.platform.container }}
# Test docker-options
docker-options: |
-e FOO=bar
-e RUNNER_OS
rust-toolchain: ${{ matrix.toolchain }}
working-directory: ${{ matrix.platform.test-crate }}
args: -i python3.8
manylinux: ${{ matrix.platform.manylinux }}
target: ${{ matrix.platform.target }}
- name: setup rust-toolchain
run: echo ${{ matrix.toolchain }} > ${{ matrix.platform.test-crate }}/rust-toolchain
- name: maturin build rust-toolchain
uses: ./
env:
RUST_BACKTRACE: '1'
with:
container: ${{ matrix.platform.container }}
args: -m ${{ matrix.platform.test-crate }}/Cargo.toml -i python3.8
manylinux: ${{ matrix.platform.manylinux }}
target: ${{ matrix.platform.target }}
- name: setup rust-toolchain.toml
run: |
echo "[toolchain]
channel = \"${{ matrix.toolchain }}\"
" > ${{ matrix.platform.test-crate }}/rust-toolchain.toml
- name: maturin build rust-toolchain.toml
uses: ./
env:
RUST_BACKTRACE: '1'
with:
container: ${{ matrix.platform.container }}
args: -m ${{ matrix.platform.test-crate }}/Cargo.toml -i python3.8
manylinux: ${{ matrix.platform.manylinux }}
target: ${{ matrix.platform.target }}
- name: setup rust-toolchain with toml content
run: |
set -ex
rm ${{ matrix.platform.test-crate }}/rust-toolchain*
echo "[toolchain]
channel = \"${{ matrix.toolchain }}\"
" > ${{ matrix.platform.test-crate }}/rust-toolchain
- name: maturin build rust-toolchain with toml content
uses: ./
env:
RUST_BACKTRACE: '1'
with:
container: ${{ matrix.platform.container }}
args: -m ${{ matrix.platform.test-crate }}/Cargo.toml -i python3.8
manylinux: ${{ matrix.platform.manylinux }}
target: ${{ matrix.platform.target }}
all-green:
needs:
- lint
- test
- test-manylinux
if: always()
runs-on: ubuntu-latest
steps:
- name: Result
run: |
jq -C <<< "${needs}"
# Check if all needs were successful or skipped.
"$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")"
env:
needs: ${{ toJson(needs) }}