-
Notifications
You must be signed in to change notification settings - Fork 518
602 lines (522 loc) · 21.7 KB
/
ci.yaml
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
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
---
name: PyYAML CI
on:
push:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
libyaml_repo:
description: Repo URL for libyaml
type: string
default: https://github.com/yaml/libyaml
libyaml_ref:
description: Tag/branch ref for libyaml
type: string
default: 0.2.5
skip_artifact_upload:
description: Skip most artifact uploads?
type: boolean
default: true
skip_ci_redundant_jobs:
description: Skip redundant jobs for CI?
type: boolean
default: true
skip_slow_jobs:
description: Skip slow (emulated) jobs for CI?
type: boolean
default: true
env:
LIBYAML_REPO: ${{ inputs.libyaml_repo || 'https://github.com/yaml/libyaml' }} # FIXME: can we ref the input.default value?
LIBYAML_REF: ${{ inputs.libyaml_ref || '0.2.5' }} # FIXME: can we ref the input.default value?
skip_ci_redundant_jobs: ${{ inputs.skip_ci_redundant_jobs || github.event_name == 'pull_request' || github.event_name == 'push' }}
skip_slow_jobs: ${{ inputs.skip_slow_jobs || github.event_name == 'pull_request' || github.event_name == 'push' }}
skip_artifact_upload: ${{ (github.event_name == 'workflow_dispatch' && inputs.skip_artifact_upload) || github.event_name != 'workflow_dispatch' }}
jobs:
python_sdist:
name: pyyaml sdist
runs-on: ubuntu-22.04
outputs:
artifact_name: ${{ steps.build_sdist.outputs.artifact_name }}
steps:
- name: Checkout PyYAML
uses: actions/checkout@v4
- name: Install a python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build sdist
id: build_sdist
env:
PYYAML_FORCE_CYTHON: 1
PYYAML_FORCE_LIBYAML: 0
run: |
python -V
python -m pip install build
python -m build -s .
echo "artifact_name=$(ls ./dist)" >> "$GITHUB_OUTPUT"
- name: Upload sdist artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build_sdist.outputs.artifact_name }}
path: dist/${{ steps.build_sdist.outputs.artifact_name }}
if-no-files-found: error
# always upload the sdist artifact- all the wheel build jobs require it
make_linux_libyaml_matrix:
runs-on: ubuntu-22.04
outputs:
matrix_json: ${{ steps.make_matrix.outputs.matrix_json }}
steps:
- uses: actions/checkout@v4
- name: make a matrix
id: make_matrix
uses: ./.github/actions/dynamatrix
with:
matrix_yaml: |
include:
- { platform: manylinux1, arch: x86_64 }
- { platform: manylinux2014, arch: x86_64 }
- { platform: manylinux2014, arch: aarch64, omit: ${{ env.skip_slow_jobs }} }
- { platform: manylinux2014, arch: s390x, omit: ${{ env.skip_slow_jobs }} }
- { platform: musllinux_1_1, arch: x86_64 }
- { platform: musllinux_1_1, arch: aarch64, omit: ${{ env.skip_slow_jobs }} }
linux_libyaml:
needs: [make_linux_libyaml_matrix]
name: libyaml ${{ matrix.platform }} ${{ matrix.arch }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.make_linux_libyaml_matrix.outputs.matrix_json) }}
env:
DOCKER_IMAGE: quay.io/pypa/${{ matrix.platform }}_${{ matrix.arch }}
steps:
- name: Check cached libyaml state
id: cached_libyaml
uses: actions/cache@v4
with:
path: libyaml
key: libyaml_${{ matrix.platform }}_${{ matrix.arch }}_${{ env.LIBYAML_REF }}
- name: configure docker foreign arch support
uses: docker/setup-qemu-action@v3
if: matrix.arch != 'x86_64' && steps.cached_libyaml.outputs.cache-hit != 'true'
- name: Checkout pyyaml
uses: actions/checkout@v4
if: steps.cached_libyaml.outputs.cache-hit != 'true'
- name: Build libyaml
run: >
docker run --rm
--volume "$(pwd):/io"
--env LIBYAML_REF
--env LIBYAML_REPO
--workdir /io
"$DOCKER_IMAGE"
/io/packaging/build/libyaml.sh
if: steps.cached_libyaml.outputs.cache-hit != 'true'
- name: ensure output is world readable (or cache fill fails with Permission Denied)
run: >
sudo chmod -R a+r ./libyaml/
if: steps.cached_libyaml.outputs.cache-hit != 'true'
make_linux_pyyaml_matrix:
runs-on: ubuntu-22.04
outputs:
matrix_json: ${{ steps.make_matrix.outputs.matrix_json }}
steps:
- uses: actions/checkout@v4
- name: make a matrix
id: make_matrix
uses: ./.github/actions/dynamatrix
with:
matrix_yaml: |
include:
- { platform: manylinux1, arch: x86_64, spec: cp38 }
- { platform: manylinux1, arch: x86_64, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs }} }
- { platform: manylinux2014, arch: x86_64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs }} }
- { platform: manylinux2014, arch: x86_64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs }} }
- { platform: manylinux2014, arch: x86_64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs }} }
- { platform: manylinux2014, arch: x86_64, spec: cp313 }
- { platform: manylinux2014, arch: aarch64, spec: cp38, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: manylinux2014, arch: aarch64, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: manylinux2014, arch: aarch64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: manylinux2014, arch: aarch64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: manylinux2014, arch: aarch64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: manylinux2014, arch: aarch64, spec: cp313, omit: ${{ env.skip_slow_jobs }} }
- { platform: manylinux2014, arch: s390x, spec: cp38, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: manylinux2014, arch: s390x, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: manylinux2014, arch: s390x, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: manylinux2014, arch: s390x, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: manylinux2014, arch: s390x, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: manylinux2014, arch: s390x, spec: cp313, omit: ${{ env.skip_slow_jobs }} }
- { platform: musllinux_1_1, arch: x86_64, spec: cp38, omit: ${{ env.skip_ci_redundant_jobs }} }
- { platform: musllinux_1_1, arch: x86_64, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs }} }
- { platform: musllinux_1_1, arch: x86_64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs }} }
- { platform: musllinux_1_1, arch: x86_64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs }} }
- { platform: musllinux_1_1, arch: x86_64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs }} }
- { platform: musllinux_1_1, arch: x86_64, spec: cp313 }
- { platform: musllinux_1_1, arch: aarch64, spec: cp39, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: musllinux_1_1, arch: aarch64, spec: cp310, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: musllinux_1_1, arch: aarch64, spec: cp311, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: musllinux_1_1, arch: aarch64, spec: cp312, omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }} }
- { platform: musllinux_1_1, arch: aarch64, spec: cp313, omit: ${{ env.skip_slow_jobs }} }
linux_pyyaml:
needs: [python_sdist, linux_libyaml, make_linux_pyyaml_matrix]
name: pyyaml ${{matrix.spec}}-${{matrix.platform}}_${{matrix.arch}}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.make_linux_pyyaml_matrix.outputs.matrix_json) }}
steps:
- name: fetch sdist artifact
id: fetch_sdist
uses: actions/download-artifact@v4
with:
name: ${{ needs.build_sdist.outputs.artifact_name }}
- name: Fetch cached libyaml
id: cached_libyaml
uses: actions/cache/restore@v4
with:
path: libyaml
key: libyaml_${{matrix.platform}}_${{matrix.arch}}_${{env.LIBYAML_REF}}
fail-on-cache-miss: true
- name: configure docker foreign arch support
uses: docker/setup-qemu-action@v3
if: matrix.arch != 'x86_64'
- name: Build/Test/Package
id: build
env:
CIBW_ARCHS: all
# HACK: ick, maybe deconstruct the matrix a bit or query cibuildwheel for its default target *linux spec first?
CIBW_BUILD: ${{matrix.spec}}-${{ contains(matrix.platform, 'musllinux') && 'musllinux' || 'manylinux' }}_${{matrix.arch}}
CIBW_BUILD_VERBOSITY: 1
# containerized Linux builds require explicit CIBW_ENVIRONMENT
CIBW_ENVIRONMENT: >
LD_LIBRARY_PATH=../libyaml/src/.libs
PYYAML_FORCE_CYTHON=1
PYYAML_FORCE_LIBYAML=1
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_img || '' }}
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_img || '' }}
CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux_img || '' }}
CIBW_MANYLINUX_S390X_IMAGE: ${{ matrix.manylinux_img || '' }}
CIBW_MUSLLINUX_X86_64_IMAGE: ${{ matrix.musllinux_img || 'musllinux_1_1' }}
CIBW_MUSLLINUX_I686_IMAGE: ${{ matrix.musllinux_img || 'musllinux_1_1' }}
CIBW_MUSLLINUX_AARCH64_IMAGE: ${{ matrix.musllinux_img || 'musllinux_1_1' }}
CIBW_PRERELEASE_PYTHONS: 1
CIBW_TEST_COMMAND: cd {project}; pytest
CIBW_TEST_REQUIRES: pytest
run: |
set -eux
python3 -V
python3 -m pip install -U --user ${{ matrix.cibw_version || 'cibuildwheel' }}
mkdir pyyaml
tar zxf ${{ steps.fetch_sdist.outputs.download-path }}/pyyaml*.tar.gz/pyyaml*.tar.gz --strip-components=1 -C pyyaml
cat << 'EOF' > build_config.toml
[tool.cibuildwheel.config-settings]
pyyaml_build_config='{"force":1, "library_dirs": ["../libyaml/src/.libs"], "include_dirs": ["../libyaml/include"]}'
EOF
CIBW_BEFORE_BUILD="ls -l {project}" python3 -m cibuildwheel --config-file $(pwd)/build_config.toml --platform auto --output-dir ./dist ./pyyaml
echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT"
# FIXME: ensure exactly one artifact
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.artifact_name }}
path: dist/*.whl
if-no-files-found: error
if: ${{ env.skip_artifact_upload != 'true' }}
macos_libyaml:
name: libyaml macos ${{matrix.arch}}
strategy:
matrix:
include:
- arch: x86_64
runs-on: macos-13
run_wrapper: arch -x86_64 bash --noprofile --norc -eo pipefail {0}
- arch: arm64
deployment_target: '11.0'
run_wrapper: arch -arm64 bash --noprofile --norc -eo pipefail {0}
defaults:
run:
shell: ${{ matrix.run_wrapper || 'arch -x86_64 bash --noprofile --norc -eo pipefail {0}' }}
runs-on: ${{ matrix.runs-on || 'macos-14' }}
steps:
- name: Check cached libyaml state
id: cached_libyaml
uses: actions/cache@v4
with:
path: libyaml
key: libyaml_macos_${{matrix.arch}}_${{env.LIBYAML_REF}}
- name: Checkout PyYAML
uses: actions/checkout@v4
if: steps.cached_libyaml.outputs.cache-hit != 'true'
- name: Build libyaml
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }}
SDKROOT: ${{ matrix.sdkroot || 'macosx' }}
run: |
set -eux
brew install automake coreutils m4 libtool
bash ./packaging/build/libyaml.sh
echo "finished artifact arch is $(lipo -archs libyaml/src/.libs/libyaml.a)"
if: steps.cached_libyaml.outputs.cache-hit != 'true'
make_macos_pyyaml_matrix:
runs-on: ubuntu-22.04
outputs:
matrix_json: ${{ steps.make_matrix.outputs.matrix_json }}
steps:
- uses: actions/checkout@v4
- name: make a matrix
id: make_matrix
uses: ./.github/actions/dynamatrix
with:
matrix_yaml: |
include:
- spec: cp38-macosx_x86_64
cibw_version: cibuildwheel==2.11.1
runs_on: [macos-13]
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp39-macosx_x86_64
runs_on: [macos-13]
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp310-macosx_x86_64
runs_on: [macos-13]
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp311-macosx_x86_64
runs_on: [macos-13]
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp312-macosx_x86_64
runs_on: [macos-13]
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp313-macosx_x86_64
runs_on: [macos-13]
- spec: cp39-macosx_arm64
deployment_target: '11.0'
arch: arm64
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp310-macosx_arm64
deployment_target: '11.0'
arch: arm64
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp311-macosx_arm64
deployment_target: '11.0'
arch: arm64
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp312-macosx_arm64
deployment_target: '11.0'
arch: arm64
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp313-macosx_arm64
deployment_target: '11.0'
arch: arm64
macos_pyyaml:
needs: [python_sdist, macos_libyaml, make_macos_pyyaml_matrix]
name: pyyaml ${{ matrix.spec }}
runs-on: ${{ matrix.runs_on || 'macos-14' }}
defaults:
run:
shell: ${{ matrix.run_wrapper || 'bash --noprofile --norc -eo pipefail {0}' }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.make_macos_pyyaml_matrix.outputs.matrix_json) }}
steps:
- name: fetch sdist artifact
id: fetch_sdist
uses: actions/download-artifact@v4
with:
name: ${{ needs.build_sdist.outputs.artifact_name }}
- name: Get cached libyaml state
id: cached_libyaml
uses: actions/cache/restore@v4
with:
path: libyaml
key: libyaml_macos_${{ matrix.arch || 'x86_64' }}_${{env.LIBYAML_REF}}
fail-on-cache-miss: true
- name: Install python
uses: actions/setup-python@v5
with:
python-version: '3.11' # as of 2024-05, this has to be < 3.12 since the macos-13 runner image's
# built-in virtualenv/pip are pinned to busted versions that fail on newer Pythons
- name: Build/Test/Package
id: build
env:
C_INCLUDE_PATH: ../libyaml/include
CIBW_BUILD: ${{matrix.spec}}
CIBW_BUILD_VERBOSITY: 1
CIBW_PRERELEASE_PYTHONS: 1
CIBW_TEST_COMMAND: pytest {package}
CIBW_TEST_REQUIRES: pytest
LIBRARY_PATH: ../libyaml/src/.libs
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }}
PYYAML_FORCE_CYTHON: 1
PYYAML_FORCE_LIBYAML: 1
SDKROOT: ${{ matrix.sdkroot || 'macosx' }}
run: |
set -eux
python3 -V
python3 -m pip install -U --user ${{ matrix.cibw_version || 'cibuildwheel' }}
mkdir pyyaml
tar zxf pyyaml*.tar.gz/pyyaml*.tar.gz --strip-components=1 -C pyyaml
cat << 'EOF' > build_config.toml
[tool.cibuildwheel.config-settings]
pyyaml_build_config='{"force":1, "library_dirs": ["../libyaml/src/.libs"], "include_dirs": ["../libyaml/include"]}'
EOF
python3 -m cibuildwheel --config-file $(pwd)/build_config.toml --platform auto --output-dir ./dist ./pyyaml
echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT"
# FIXME: ensure exactly one artifact
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.artifact_name }}
path: dist/*.whl
if-no-files-found: error
if: ${{ env.skip_artifact_upload != 'true' }}
windows_libyaml:
name: libyaml windows ${{ matrix.arch }}
runs-on: ${{ matrix.platform || 'windows-2022' }}
strategy:
matrix:
include:
- arch: x64
- arch: win32
steps:
- name: Get cached libyaml state
id: cached_libyaml
uses: actions/cache@v4
with:
path: libyaml
key: libyaml_${{ 'windows' }}_${{ matrix.arch }}_${{ env.LIBYAML_REF }}
- name: Build libyaml
shell: bash
if: steps.cached_libyaml.outputs.cache-hit != 'true'
run: |
# git spews all over stderr unless we tell it not to
export GIT_REDIRECT_STDERR="2>&1"
if [[ ! -d ./libyaml ]]; then
git clone -b ${{ env.LIBYAML_REF }} ${{ env.LIBYAML_REPO }} 2>&1
fi
pushd libyaml
git clean -fdx
popd
mkdir libyaml/build
pushd libyaml/build
cmake.exe -G "Visual Studio 17 2022" -A ${{ matrix.arch }} -DYAML_STATIC_LIB_NAME=yaml ..
cmake.exe --build . --config Release
popd
make_windows_pyyaml_matrix:
runs-on: ubuntu-22.04
outputs:
matrix_json: ${{ steps.make_matrix.outputs.matrix_json }}
steps:
- uses: actions/checkout@v4
- name: make a matrix
id: make_matrix
uses: ./.github/actions/dynamatrix
with:
matrix_yaml: |
include:
- spec: cp38-win_amd64
- spec: cp39-win_amd64
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp310-win_amd64
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp311-win_amd64
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp312-win_amd64
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp313-win_amd64
- spec: cp38-win32
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp39-win32
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp310-win32
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp311-win32
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp312-win32
omit: ${{ env.skip_ci_redundant_jobs }}
- spec: cp313-win32
omit: ${{ env.skip_ci_redundant_jobs }}
windows_pyyaml:
needs: [python_sdist, windows_libyaml, make_windows_pyyaml_matrix]
name: pyyaml ${{matrix.spec}}
runs-on: ${{ matrix.runs-on || 'windows-2022' }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.make_windows_pyyaml_matrix.outputs.matrix_json) }}
steps:
# autocrlf screws up tests under Windows
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: fetch sdist artifact
id: fetch_sdist
uses: actions/download-artifact@v4
with:
name: ${{ needs.build_sdist.outputs.artifact_name }}
- name: Get cached libyaml state
id: cached_libyaml
uses: actions/cache/restore@v4
with:
path: libyaml
key: libyaml_${{'windows'}}_${{ contains(matrix.spec, 'win_amd64') && 'x64' || 'win32' }}_${{env.LIBYAML_REF}}
fail-on-cache-miss: true
- name: Install python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build/Test/Package
id: build
shell: bash
env:
CIBW_BUILD: ${{matrix.spec}}
CIBW_BUILD_VERBOSITY: 1
CIBW_BEFORE_TEST: ls -l {package}
CIBW_TEST_COMMAND: pytest {package}
CIBW_TEST_REQUIRES: pytest
CIBW_PRERELEASE_PYTHONS: 1
#CIBW_CONFIG_SETTINGS: |
# pyyaml_build_config='{"include_dirs": ["libyaml/include"], "library_dirs": ["libyaml/build/Release"], "define": [["YAML_DECLARE_STATIC", 1]], "force": 1}'
run: |
set -eux
python -V
python -m pip install -U --user ${{ matrix.cibw_version || 'cibuildwheel' }}
mkdir pyyaml
tar zxf pyyaml*.tar.gz/pyyaml*.tar.gz --strip-components=1 -C pyyaml
cat << 'EOF' > build_config.toml
[tool.cibuildwheel.config-settings]
pyyaml_build_config='{"force":1, "include_dirs": ["../libyaml/include"], "library_dirs": ["../libyaml/build/Release"], "define": [["YAML_DECLARE_STATIC", 1]], "force": 1}'
EOF
python3 -m cibuildwheel --config-file $(pwd)/build_config.toml --platform auto --output-dir ./dist ./pyyaml
echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT"
# FIXME: ensure exactly one artifact
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.artifact_name }}
path: dist/*.whl
if-no-files-found: error
if: ${{ env.skip_artifact_upload != 'true' }}
merge_artifacts:
needs: [python_sdist, macos_pyyaml, linux_pyyaml, windows_pyyaml]
runs-on: ubuntu-22.04
steps:
- name: merge all artifacts
uses: actions/upload-artifact/merge@v4
with:
name: dist
delete-merged: true
if: ${{ env.skip_artifact_upload != 'true' }}
check:
if: always()
needs:
- python_sdist
- linux_pyyaml
- macos_pyyaml
- windows_pyyaml
- merge_artifacts
runs-on: ubuntu-latest
steps:
- name: Verify all previous jobs succeeded (provides a single check to sample for gating purposes)
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
...