Fix release artifact handling for upload-artifact@v4 (would drop wheels/sdist on next release)#684
Merged
Merged
Conversation
#649 bumped upload/download-artifact from v3 to v4 but kept the v3 pattern where every build_wheels matrix leg (and the sdist) uploaded under a shared artifact name and the publish job downloaded a single name. v3 merged same-named uploads; v4 does not -- each upload is its own immutable artifact and uploading the same name again fails. So the three matrix legs collide on 'wheel-artifacts', and the wheel download used pattern '*artifact*' with no path (landing outside dist/, which is what gh-action-pypi-publish publishes from). The last release (v0.11.3) predates #649 and used v3, so this is latent -- the next release would fail to publish or ship incomplete artifacts. Give each uploader a unique name (cibw-wheels-<os>, cibw-sdist), collect them all in the publish job with pattern: cibw-* + merge-multiple into dist/, add skip-existing so re-runs can backfill, and if-no-files-found: error so an empty build fails loudly instead of silently publishing nothing.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #684 +/- ##
=======================================
Coverage 94.10% 94.10%
=======================================
Files 102 102
Lines 11107 11107
Branches 1198 1198
=======================================
Hits 10452 10452
Misses 556 556
Partials 99 99 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The release workflow can publish an incomplete set of files (missing wheels and/or the sdist) even on a green run. This is the
upload-artifactv3→v4 breaking-change trap.Root cause
#649 (
af0ed799, Nov 2024) bumpedupload-artifact/download-artifactfrom v3 → v4 but kept the v3-era pattern:build_wheelsmatrix legs (ubuntu-20.04,macos-13,macos-14) uploaded under the same namewheel-artifacts.publishdownloaded the sdist by name intodist/, then downloaded wheels withpattern: "*artifact*"and nopath:(so they land in the workspace root, notdist/— andgh-action-pypi-publishpublishes fromdist/).Under v3, multiple uploads to the same name were merged, so this worked. Under v4 that implicit merge is gone: each upload is its own immutable artifact and re-uploading the same name fails. So the matrix legs collide on
wheel-artifacts, and the wheel download missesdist/.Why it hasn't broken a release yet
The most recent release, v0.11.3 (Aug 2024), predates #649 and still used
upload-artifact@v3, so it shipped a complete set (sdist + macOS/manylinux wheels — verified on PyPI). The bug is latent: the next release (first one after #649) is where it bites.The fix (canonical cibuildwheel-on-v4 pattern)
cibw-wheels-${{ matrix.os }}andcibw-sdist.publish:download-artifact@v4withpattern: cibw-*,merge-multiple: true,path: dist.skip-existing: trueon the publish step so a re-run can backfill missing files idempotently.if-no-files-found: erroron the uploads so an empty build fails loudly instead of silently publishing nothing.Notes / follow-ups
release: created, so this can't be exercised by PR CI — it's validated by inspection + valid-YAML check. Consider adding aworkflow_dispatchtrigger (gated alongside thereleasecondition) so a fixed release can be re-published on demand, and a post-publish check asserting the index has both an sdist and the expected wheels.Generated by Claude Code