From 6f5d8505c4793741e3ddf621880657c183fad3e6 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 7 Oct 2024 18:58:56 -0400 Subject: [PATCH] ci: Fix pin for cibuildwheel when building matrix 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. --- .github/workflows/release.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 983c0c24e..59c8e0475 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,4 @@ +--- name: Build and upload to PyPI concurrency: @@ -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 + "${{ runner.temp }}/cibw/bin/cibuildwheel" --print-build-identifiers --platform linux \ + | jq --null-input --raw-input --compact-output '{"only": inputs, "os": "ubuntu-latest"}' \ + && "${{ runner.temp }}/cibw/bin/cibuildwheel" --print-build-identifiers --platform macos \ + | jq --null-input --raw-input --compact-output '{"only": inputs, "os": "macos-latest"}' \ + && "${{ runner.temp }}/cibw/bin/cibuildwheel" --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: