Skip to content

Commit 77c3e64

Browse files
committed
Merge branch 'maintenance/generic-gha-cibuildwheel' into devel
PR #750
2 parents 895525a + 7af089e commit 77c3e64

File tree

3 files changed

+106
-80
lines changed

3 files changed

+106
-80
lines changed

.github/workflows/ci-cd.yml

Lines changed: 70 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -627,41 +627,41 @@ jobs:
627627
- pre-setup # transitive, for accessing settings
628628
strategy:
629629
matrix:
630-
os:
630+
runner-vm-os:
631631
- macos-13
632632
uses: ./.github/workflows/reusable-cibuildwheel.yml
633633
with:
634-
os: ${{ matrix.os }}
635-
wheel-tags-to-skip: >-
636-
${{
637-
!fromJSON(needs.pre-setup.outputs.release-requested)
638-
&& '*_i686
639-
*-macosx_universal2
640-
*-musllinux_*
641-
*-win32
642-
*_arm64
643-
pp*'
644-
|| ''
645-
}}
634+
runner-vm-os: ${{ matrix.runner-vm-os }}
635+
timeout-minutes: 9
646636
source-tarball-name: >-
647637
${{ needs.pre-setup.outputs.sdist-artifact-name }}
648638
dists-artifact-name: >-
649639
${{ needs.pre-setup.outputs.dists-artifact-name }}
650-
# cython-tracing: >- # Cython line tracing for coverage collection
651-
# ${{
652-
# (
653-
# github.event_name == 'push'
654-
# && contains(github.ref, 'refs/tags/')
655-
# )
656-
# && 'false'
657-
# || 'true'
658-
# }}
659-
cython-tracing: >- # Cython line tracing for coverage collection
660-
${{
640+
# CIBW_CONFIG_SETTINGS: `with-cython-tracing` — for coverage collection
641+
# CIBW_ARCHS_MACOS=all x86_64 arm64 universal2
642+
environment-variables: |-
643+
CIBW_ARCHS_MACOS=native
644+
645+
CIBW_CONFIG_SETTINGS<<EOF
646+
with-cython-tracing=${{
661647
fromJSON(needs.pre-setup.outputs.profiling-enabled)
662648
&& 'true'
663649
|| 'false'
664650
}}
651+
EOF
652+
653+
${{
654+
!fromJSON(needs.pre-setup.outputs.release-requested)
655+
&& 'CIBW_SKIP<<EOF
656+
*_i686
657+
*-macosx_universal2
658+
*-musllinux_*
659+
*-win32
660+
*_arm64
661+
pp*
662+
EOF'
663+
|| ''
664+
}}
665665
666666
build-bin-manylinux-tested-arches:
667667
name: >-
@@ -683,22 +683,35 @@ jobs:
683683
- pre-setup # transitive, for accessing settings
684684
uses: ./.github/workflows/reusable-cibuildwheel.yml
685685
with:
686-
os: ubuntu-latest
687-
wheel-tags-to-skip: >-
688-
*_i686
689-
*-musllinux_*
690-
*-*linux_{aarch64,ppc64le,s390x}
691-
pp*
686+
runner-vm-os: ubuntu-latest
687+
timeout-minutes: 9
692688
source-tarball-name: >-
693689
${{ needs.pre-setup.outputs.sdist-artifact-name }}
694690
dists-artifact-name: >-
695691
${{ needs.pre-setup.outputs.dists-artifact-name }}
696-
cython-tracing: >- # Cython line tracing for coverage collection
697-
${{
692+
# CIBW_CONFIG_SETTINGS: `with-cython-tracing` — for coverage collection
693+
# CIBW_ARCHS_MACOS=all x86_64 arm64 universal2
694+
environment-variables: |-
695+
CIBW_ARCHS_MACOS=native
696+
697+
CIBW_CONFIG_SETTINGS<<EOF
698+
with-cython-tracing=${{
698699
fromJSON(needs.pre-setup.outputs.profiling-enabled)
699700
&& 'true'
700701
|| 'false'
701702
}}
703+
EOF
704+
705+
${{
706+
!fromJSON(needs.pre-setup.outputs.release-requested)
707+
&& 'CIBW_SKIP<<EOF
708+
*_i686
709+
*-musllinux_*
710+
*-*linux_{aarch64,ppc64le,s390x}
711+
pp*
712+
EOF'
713+
|| ''
714+
}}
702715
703716
build-bin-manylinux-odd-arches:
704717
name: >-
@@ -720,23 +733,39 @@ jobs:
720733
- pre-setup # transitive, for accessing settings
721734
uses: ./.github/workflows/reusable-cibuildwheel.yml
722735
with:
723-
os: ubuntu-latest
724-
wheel-tags-to-skip: >-
725-
*_i686
726-
*-musllinux_*
727-
*-*linux_x86_64
728-
pp*
736+
runner-vm-os: ubuntu-latest
737+
timeout-minutes: 70
729738
source-tarball-name: >-
730739
${{ needs.pre-setup.outputs.sdist-artifact-name }}
731740
dists-artifact-name: >-
732741
${{ needs.pre-setup.outputs.dists-artifact-name }}
733-
qemu: all
734-
cython-tracing: >- # Cython line tracing for coverage collection
735-
${{
742+
qemu: true
743+
# CIBW_ARCHS_LINUX: Build emulated architectures if QEMU, else "auto"
744+
# CIBW_CONFIG_SETTINGS: `with-cython-tracing` — for coverage collection
745+
# CIBW_ARCHS_MACOS=all x86_64 arm64 universal2
746+
environment-variables: |-
747+
CIBW_ARCHS_LINUX=all
748+
749+
CIBW_ARCHS_MACOS=native
750+
751+
CIBW_CONFIG_SETTINGS<<EOF
752+
with-cython-tracing=${{
736753
fromJSON(needs.pre-setup.outputs.profiling-enabled)
737754
&& 'true'
738755
|| 'false'
739756
}}
757+
EOF
758+
759+
${{
760+
!fromJSON(needs.pre-setup.outputs.release-requested)
761+
&& 'CIBW_SKIP<<EOF
762+
*_i686
763+
*-musllinux_*
764+
*-*linux_x86_64
765+
pp*
766+
EOF'
767+
|| ''
768+
}}
740769
741770
build-src:
742771
name: >-

.github/workflows/reusable-cibuildwheel.yml

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,32 @@ on: # yamllint disable-line rule:truthy
1313
description: A custom name for the Checks API-reported status
1414
required: false
1515
type: string
16-
cython-tracing:
17-
description: Whether to build Cython modules with line tracing
18-
default: '0'
19-
required: false
20-
type: string
21-
os:
22-
description: VM OS to use, without version suffix
23-
default: ubuntu
16+
environment-variables:
17+
description: >-
18+
A newline-delimited blob of text with environment variables
19+
to be set using `${GITHUB_ENV}`
2420
required: false
2521
type: string
2622
qemu:
27-
description: Emulated QEMU architecture
28-
default: ''
23+
default: false
24+
description: >-
25+
Whether this job needs to configure QEMU to emulate a foreign
26+
architecture before running `cibuildwheel`. Defaults to "false".
27+
required: false
28+
type: boolean
29+
runner-vm-os:
30+
description: VM OS to use
31+
default: ubuntu-latest
2932
required: false
3033
type: string
3134
source-tarball-name:
3235
description: Sdist filename wildcard
3336
required: true
3437
type: string
35-
wheel-tags-to-skip:
36-
description: Wheel tags to skip building
37-
default: ''
38-
required: false
39-
type: string
38+
timeout-minutes:
39+
description: Deadline for the job to complete
40+
required: true
41+
type: number
4042

4143
env:
4244
FORCE_COLOR: "1" # Make tools pretty.
@@ -50,11 +52,22 @@ jobs:
5052
${{
5153
inputs.check-name
5254
&& inputs.check-name
53-
|| format('Build wheels on {0} {1}', inputs.os, inputs.qemu)
55+
|| format(
56+
'Build wheels on {0}{1}',
57+
inputs.runner-vm-os,
58+
inputs.qemu && ' under QEMU' || ''
59+
)
5460
}}
55-
runs-on: ${{ inputs.os }}
56-
timeout-minutes: ${{ inputs.qemu && 70 || 9 }}
61+
runs-on: ${{ inputs.runner-vm-os }}
62+
timeout-minutes: ${{ fromJSON(inputs.timeout-minutes) }}
5763
steps:
64+
- name: Export requested job-global environment variables
65+
if: inputs.environment-variables != ''
66+
env:
67+
INPUT_ENVIRONMENT_VARIABLES: ${{ inputs.environment-variables }}
68+
run: echo "${INPUT_ENVIRONMENT_VARIABLES}" >> "${GITHUB_ENV}"
69+
shell: bash
70+
5871
- name: Compute GHA artifact name ending
5972
id: gha-artifact-name
6073
run: |
@@ -85,35 +98,16 @@ jobs:
8598
uses: docker/setup-qemu-action@v3
8699
with:
87100
platforms: all
88-
id: qemu
89-
- name: Prepare emulation
90-
if: inputs.qemu
91-
run: |
92-
# Build emulated architectures only if QEMU is set,
93-
# use default "auto" otherwise
94-
echo "CIBW_ARCHS_LINUX=${{ inputs.qemu }}" >> "${GITHUB_ENV}"
95-
shell: bash
96-
97-
- name: Skip building some wheel tags
98-
if: inputs.wheel-tags-to-skip
99-
run: |
100-
echo "CIBW_SKIP=${{ inputs.wheel-tags-to-skip }}" >> "${GITHUB_ENV}"
101-
shell: bash
102101

103102
- name: Build wheels
104103
uses: pypa/[email protected]
105-
env:
106-
# CIBW_ARCHS_MACOS: all x86_64 arm64 universal2
107-
CIBW_ARCHS_MACOS: native
108-
CIBW_CONFIG_SETTINGS: >- # Cython line tracing for coverage collection
109-
with-cython-tracing=${{ inputs.cython-tracing }}
110104

111105
- name: Upload built artifacts for testing and publishing
112106
uses: actions/upload-artifact@v4
113107
with:
114108
name: ${{ inputs.dists-artifact-name }}-
115-
${{ inputs.os }}-
116-
${{ inputs.qemu }}-
109+
${{ inputs.runner-vm-os }}-
110+
${{ inputs.qemu && 'qemu-' || '' }}
117111
${{ steps.gha-artifact-name.outputs.hash }}
118112
path: ./wheelhouse/*.whl
119113

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The :file:`reusable-cibuildwheel.yml` workflow has been refactored to
2+
be more generic and :file:`ci-cd.yml` now holds all the configuration
3+
toggles -- by :user:`webknjaz`.

0 commit comments

Comments
 (0)