Skip to content

Commit

Permalink
CI: Explicitly separate dist archives and remerge them
Browse files Browse the repository at this point in the history
Upgrading to `actions/upload-artifact@v4` to use version 20 of NodeJS caused
our entire CI wheel-building matrix to fail.  It seems that `v4` of this action
introduced a breaking change when uploading to the an artifact with the same
name several times during the same workflow: in `v3`, this would silently
incorporate the new files into the same artifact; in `v4`, however, artifacts
are immutable, and the job simply fails.  It is possible [to migrate
this behavior][v4-migration] by uniquely renaming each uploaded archive, and
reuploading a single artifact with the new `actions/upload-artifact/merge@v4`
action.  This patch renames all artifacts created when building sdists, Linux
wheels, and MacOS wheels, and then introduces a new job to merge each of these
separate artifacts into a single `dist` archive.

[v4-migration]: https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md

Signed-off-by: Patrick M. Niedzielski <[email protected]>
  • Loading branch information
pniedzielski committed Jan 31, 2024
1 parent 1b2baac commit 82f5c47
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
name: dist-sdist
path: dist-sdist

- uses: actions/upload-artifact@v4
with:
name: tests
path: tests
name: tests-sdist
path: tests-sdist

- uses: actions/upload-artifact@v4
with:
name: bin
path: bin
name: bin-sdist
path: bin-sdist

choose_architectures:
name: Decide which architectures to build wheels for
Expand Down Expand Up @@ -67,15 +67,15 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
name: dist
name: dist-sdist
path: dist
- uses: actions/download-artifact@v4
with:
name: tests
name: tests-sdist
path: tests
- uses: actions/download-artifact@v4
with:
name: bin
name: bin-sdist
path: bin
- uses: docker/setup-qemu-action@v3
if: runner.os == 'Linux'
Expand All @@ -96,7 +96,7 @@ jobs:
CIBW_TEST_REQUIRES: pytest mock pkgconfig
- uses: actions/upload-artifact@v4
with:
name: dist
name: dist-Linux-${{ matrix.cibw_python }}-${{ matrix.cibw_arch }}
path: ./wheelhouse/*.whl

build_wheels_macos:
Expand Down Expand Up @@ -146,12 +146,21 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: dist
name: dist-MacOS-${{ matrix.cibw_python }}-${{ matrix.cibw_arch }}
path: ./wheelhouse/*.whl

upload_pypi:
merge:
needs: [build_wheels, build_wheels_macos, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/upload-artifact/merge@v4
with:
name: dist
pattern: dist-*

upload_pypi:
needs: merge
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
Expand Down

0 comments on commit 82f5c47

Please sign in to comment.