Skip to content

Commit

Permalink
ci: Fix pin for cibuildwheel when building matrix
Browse files Browse the repository at this point in the history
We used to install cibuildwheel manually in order to generate the
Python-version matrix. This means that dependabot does not notice or
update it. This is normally fine, but when cibuildwheel adds new Python
versions, they won't be in the generated matrix until the pin is
updated.

Instead of the manual install, use the action to install cibuildwheel,
but don't have it run anything.

Also, expand the jq arguments so it's a bit clearer what it does.
  • Loading branch information
QuLogic committed Oct 8, 2024
1 parent d3a6e72 commit af4d2c0
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Build and upload to PyPI

concurrency:
Expand Down Expand Up @@ -75,19 +76,23 @@ jobs:
include: ${{ steps.set-matrix.outputs.include }}
steps:
- uses: actions/checkout@v4
- name: Install cibuildwheel
run: pipx install cibuildwheel==2.16.2
- uses: pypa/cibuildwheel@f1859528322d7b29d4493ee241a167807661dfb4 # v2.21.2
id: cibw
with:
# We only use this action to install cibuildwheel with a pin that
# dependabot can see and update, so don't actually run cibuildwheel.
package-dir: --help
- id: set-matrix
run: |
MATRIX=$(
{
cibuildwheel --print-build-identifiers --platform linux \
| jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \
&& cibuildwheel --print-build-identifiers --platform macos \
| jq -nRc '{"only": inputs, "os": "macos-latest"}' \
&& cibuildwheel --print-build-identifiers --platform windows \
| jq -nRc '{"only": inputs, "os": "windows-2019"}'
} | jq -sc
"${{ steps.cibw.outputs.cibw-path }}" --print-build-identifiers --platform linux \
| jq --null-input --raw-input --compact-output '{"only": inputs, "os": "ubuntu-latest"}' \
&& "${{ steps.cibw.outputs.cibw-path }}" --print-build-identifiers --platform macos \
| jq --null-input --raw-input --compact-output '{"only": inputs, "os": "macos-latest"}' \
&& "${{ steps.cibw.outputs.cibw-path }}" --print-build-identifiers --platform windows \
| jq --null-input --raw-input --compact-output '{"only": inputs, "os": "windows-2019"}'
} | jq --slurp --compact-output
)
echo "include=$MATRIX" >> $GITHUB_OUTPUT
env:
Expand Down

0 comments on commit af4d2c0

Please sign in to comment.