chore(actions): flattens the wheel atrifacts upload #139
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## IMPORTANT: the configuration for cibuildwheel is kept in pyproject.toml | |
name: wheels | |
on: | |
push: | |
branches: | |
# on push, only build on wip chore/cicd branches so we can test in those | |
# contexts without triggering pull-requests. | |
- chore/cicd/* | |
pull_request: | |
jobs: | |
generate-wheels-matrix: | |
name: Generate wheels matrix | |
runs-on: ubuntu-latest | |
outputs: | |
include: ${{ steps.set-matrix.outputs.include }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install cibuildwheel | |
run: pipx install cibuildwheel==2.22.0 | |
- id: set-matrix | |
run: | | |
# Some notes on this: | |
# - macos-13 is a amd64 builder. | |
# - maxos-14 is the default builder which is arm64, probably because | |
# it's more effecient. | |
# - We don't yet specifiy arm64 versions on linux, even though AWS | |
# provides cheaper ec2 instaces running on arm64 cores. /FIXME | |
MATRIX=$( | |
{ | |
cibuildwheel --print-build-identifiers --platform linux \ | |
| jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \ | |
&& cibuildwheel --print-build-identifiers --platform macos --arch x86_64 \ | |
| jq -nRc '{"only": inputs, "os": "macos-13"}' \ | |
&& cibuildwheel --print-build-identifiers --platform macos --arch arm64 \ | |
| jq -nRc '{"only": inputs, "os": "macos-14"}' \ | |
&& cibuildwheel --print-build-identifiers --platform windows \ | |
| jq -nRc '{"only": inputs, "os": "windows-latest"}' | |
} | jq -sc | |
) | |
echo "include=$MATRIX" >> $GITHUB_OUTPUT | |
build_wheels: | |
name: Build ${{ matrix.only }} | |
needs: generate-wheels-matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
only: ${{ matrix.only }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./wheelhouse/*.whl | |
collate-wheels: | |
name: Collate all wheels | |
needs: build_wheels | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download all wheel artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: wheelhouse | |
- name: Compress wheels | |
run: | | |
tar -czvf wheels-archive.tar.gz -C wheelhouse . | |
zip -r wheels-archive.zip wheelhouse | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-archive | |
path: | | |
wheels-archive.tar.gz | |
wheels-archive.zip |