Skip to content

Commit 53e2c74

Browse files
authored
chore(action): update cibuildwheel arguments passing (#1757)
chore(action): update cibw arguments passing Only pass arguments that were set to cibuildwheel.
1 parent 32343a3 commit 53e2c74

File tree

2 files changed

+39
-12
lines changed

2 files changed

+39
-12
lines changed

.github/workflows/test.yml

+33
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,39 @@ jobs:
8585
env:
8686
CIBW_ARCHS_MACOS: x86_64 universal2 arm64
8787

88+
- name: Run a sample build (GitHub Action, only)
89+
uses: ./
90+
with:
91+
package-dir: sample_proj
92+
output-dir: wheelhouse_only
93+
only: cp312-${{ runner.os == 'Linux' && 'manylinux_x86_64' || (runner.os == 'Windows' && 'win_amd64' || 'macosx_x86_64') }}
94+
95+
- name: Create custom configuration file
96+
shell: bash
97+
run: |
98+
cat > sample_proj/cibw.toml <<EOF
99+
[tool.cibuildwheel]
100+
# Only build on CPython 3.12 on native arch
101+
archs = ["native"]
102+
build = "cp312-*"
103+
# Skip musllinux
104+
skip = "*-musllinux*"
105+
EOF
106+
107+
- name: Run a sample build (GitHub Action, config-file)
108+
uses: ./
109+
with:
110+
package-dir: sample_proj
111+
output-dir: wheelhouse_config_file
112+
config-file: sample_proj/cibw.toml
113+
114+
- name: Check Action artefacts
115+
shell: bash
116+
run: |
117+
test $(find wheelhouse -name '*.whl' | wc -l) -ge 1
118+
test $(find wheelhouse_only -name '*.whl' | wc -l) -eq 1
119+
test $(find wheelhouse_config_file -name '*.whl' | wc -l) -eq 1
120+
88121
- uses: actions/upload-artifact@v4
89122
with:
90123
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}

action.yml

+6-12
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,21 @@ runs:
4242
--spec '${{ github.action_path }}'
4343
cibuildwheel
4444
"${{ inputs.package-dir }}"
45-
--output-dir "${{ inputs.output-dir }}"
46-
--config-file "${{ inputs.config-file }}"
47-
--only "${{ inputs.only }}"
45+
${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
46+
${{ inputs.config-file != '' && format('--config-file "{0}"', inputs.config-file) || ''}}
47+
${{ inputs.only != '' && format('--only "{0}"', inputs.only) || ''}}
4848
2>&1
4949
shell: bash
5050
if: runner.os != 'Windows'
5151
5252
# Windows needs powershell to interact nicely with Meson
53-
# $PSNativeCommandArgumentPassing was introduced in pwsh 7.3 and the
54-
# legacy behaviour is needed for backwards compatibility with how this
55-
# was called in the past.
5653
- run: >
57-
if ($PSNativeCommandArgumentPassing) {
58-
$PSNativeCommandArgumentPassing = 'Legacy'
59-
};
6054
& "${{ steps.python.outputs.python-path }}" -m pipx run
6155
--spec "${{ github.action_path }}"
6256
cibuildwheel
6357
"${{ inputs.package-dir }}"
64-
--output-dir '"${{ inputs.output-dir }}"'
65-
--config-file '"${{ inputs.config-file }}"'
66-
--only '"${{ inputs.only }}"'
58+
${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
59+
${{ inputs.config-file != '' && format('--config-file "{0}"', inputs.config-file) || ''}}
60+
${{ inputs.only != '' && format('--only "{0}"', inputs.only) || ''}}
6761
shell: pwsh
6862
if: runner.os == 'Windows'

0 commit comments

Comments
 (0)