22
33name : Build wheel
44
5- on :
5+ on : # yamllint disable-line rule:truthy
66 workflow_call :
77 inputs :
88 dists-artifact-name :
99 description : Workflow artifact name containing dists
1010 required : true
1111 type : string
12- os :
13- description : VM OS to use, without version suffix
14- default : ubuntu
12+ check-name :
13+ description : A custom name for the Checks API-reported status
1514 required : false
1615 type : string
17- qemu :
18- description : Emulated QEMU architecture
19- default : ' '
16+ environment-variables :
17+ description : >-
18+ A newline-delimited blob of text with environment variables
19+ to be set using `${GITHUB_ENV}`
2020 required : false
2121 type : string
22- tag :
23- description : Build platform tag wheels
24- default : ' '
22+ qemu :
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
2532 required : false
2633 type : string
2734 source-tarball-name :
2835 description : Sdist filename wildcard
2936 required : true
3037 type : string
31- wheel-tags-to-skip :
32- description : Wheel tags to skip building
33- default : ' '
34- required : false
35- type : string
38+ timeout-minutes :
39+ description : Deadline for the job to complete
40+ required : true
41+ type : number
3642
3743env :
3844 FORCE_COLOR : " 1" # Make tools pretty.
@@ -43,22 +49,38 @@ jobs:
4349
4450 build-wheel :
4551 name : >-
46- Build ${{ inputs.tag }} wheels on ${{ inputs.os }} ${{ inputs.qemu }}
47- runs-on : ${{
48- inputs.os == 'windows-11-arm' && inputs.os ||
49- format('{0}-latest', inputs.os)
52+ ${{
53+ inputs.check-name
54+ && inputs.check-name
55+ || format(
56+ 'Build wheels on {0}{1}',
57+ inputs.runner-vm-os,
58+ inputs.qemu && ' under QEMU' || ''
59+ )
5060 }}
51- timeout-minutes : ${{ inputs.qemu && 120 || 15 }}
61+ runs-on : ${{ inputs.runner-vm-os }}
62+ timeout-minutes : ${{ fromJSON(inputs.timeout-minutes) }}
5263 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+
5371 - name : Compute GHA artifact name ending
5472 id : gha-artifact-name
5573 run : |
5674 from hashlib import sha512
5775 from os import environ
5876 from pathlib import Path
77+
5978 FILE_APPEND_MODE = 'a'
79+
6080 inputs_json_str = """${{ toJSON(inputs) }}"""
81+
6182 hash = sha512(inputs_json_str.encode()).hexdigest()
83+
6284 with Path(environ['GITHUB_OUTPUT']).open(
6385 mode=FILE_APPEND_MODE,
6486 ) as outputs_file:
@@ -76,33 +98,16 @@ jobs:
7698 uses : docker/setup-qemu-action@v3
7799 with :
78100 platforms : all
79- id : qemu
80- - name : Prepare emulation
81- if : inputs.qemu
82- run : |
83- # Build emulated architectures only if QEMU is set,
84- # use default "auto" otherwise
85- echo "CIBW_ARCHS_LINUX=${{ inputs.qemu }}" >> "${GITHUB_ENV}"
86- shell : bash
87-
88- - name : Skip building some wheel tags
89- if : inputs.wheel-tags-to-skip
90- run : |
91- echo "CIBW_SKIP=${{ inputs.wheel-tags-to-skip }}" >> "${GITHUB_ENV}"
92- shell : bash
93101
94102 - name : Build wheels
9510396- env :
97- CIBW_ARCHS_MACOS : x86_64 arm64 universal2
98104
99105 - name : Upload built artifacts for testing and publishing
100106 uses : actions/upload-artifact@v4
101107 with :
102108 name : ${{ inputs.dists-artifact-name }}-
103- ${{ inputs.os }}-
104- ${{ inputs.qemu }}-
105- ${{ inputs.tag }}-
109+ ${{ inputs.runner-vm-os }}-
110+ ${{ inputs.qemu && 'qemu-' || '' }}
106111 ${{ steps.gha-artifact-name.outputs.hash }}
107112 path : ./wheelhouse/*.whl
108113
0 commit comments