Skip to content

Commit

Permalink
chore(action): update cibuildwheel arguments passing (#1757)
Browse files Browse the repository at this point in the history
chore(action): update cibw arguments passing

Only pass arguments that were set to cibuildwheel.
  • Loading branch information
mayeut committed Feb 17, 2024
1 parent 32343a3 commit 53e2c74
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 12 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,39 @@ jobs:
env:
CIBW_ARCHS_MACOS: x86_64 universal2 arm64

- name: Run a sample build (GitHub Action, only)
uses: ./
with:
package-dir: sample_proj
output-dir: wheelhouse_only
only: cp312-${{ runner.os == 'Linux' && 'manylinux_x86_64' || (runner.os == 'Windows' && 'win_amd64' || 'macosx_x86_64') }}

- name: Create custom configuration file
shell: bash
run: |
cat > sample_proj/cibw.toml <<EOF
[tool.cibuildwheel]
# Only build on CPython 3.12 on native arch
archs = ["native"]
build = "cp312-*"
# Skip musllinux
skip = "*-musllinux*"
EOF
- name: Run a sample build (GitHub Action, config-file)
uses: ./
with:
package-dir: sample_proj
output-dir: wheelhouse_config_file
config-file: sample_proj/cibw.toml

- name: Check Action artefacts
shell: bash
run: |
test $(find wheelhouse -name '*.whl' | wc -l) -ge 1
test $(find wheelhouse_only -name '*.whl' | wc -l) -eq 1
test $(find wheelhouse_config_file -name '*.whl' | wc -l) -eq 1
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
Expand Down
18 changes: 6 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,21 @@ runs:
--spec '${{ github.action_path }}'
cibuildwheel
"${{ inputs.package-dir }}"
--output-dir "${{ inputs.output-dir }}"
--config-file "${{ inputs.config-file }}"
--only "${{ inputs.only }}"
${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
${{ inputs.config-file != '' && format('--config-file "{0}"', inputs.config-file) || ''}}
${{ inputs.only != '' && format('--only "{0}"', inputs.only) || ''}}
2>&1
shell: bash
if: runner.os != 'Windows'
# Windows needs powershell to interact nicely with Meson
# $PSNativeCommandArgumentPassing was introduced in pwsh 7.3 and the
# legacy behaviour is needed for backwards compatibility with how this
# was called in the past.
- run: >
if ($PSNativeCommandArgumentPassing) {
$PSNativeCommandArgumentPassing = 'Legacy'
};
& "${{ steps.python.outputs.python-path }}" -m pipx run
--spec "${{ github.action_path }}"
cibuildwheel
"${{ inputs.package-dir }}"
--output-dir '"${{ inputs.output-dir }}"'
--config-file '"${{ inputs.config-file }}"'
--only '"${{ inputs.only }}"'
${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
${{ inputs.config-file != '' && format('--config-file "{0}"', inputs.config-file) || ''}}
${{ inputs.only != '' && format('--only "{0}"', inputs.only) || ''}}
shell: pwsh
if: runner.os == 'Windows'

0 comments on commit 53e2c74

Please sign in to comment.