Skip to content

Fix release artifact handling for upload-artifact@v4 (would drop wheels/sdist on next release)#684

Merged
wbarnha merged 1 commit into
masterfrom
claude/fix-release-artifacts
Jul 17, 2026
Merged

Fix release artifact handling for upload-artifact@v4 (would drop wheels/sdist on next release)#684
wbarnha merged 1 commit into
masterfrom
claude/fix-release-artifacts

Conversation

@wbarnha

@wbarnha wbarnha commented Jul 17, 2026

Copy link
Copy Markdown
Member

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-artifact v3→v4 breaking-change trap.

Root cause

#649 (af0ed799, Nov 2024) bumped upload-artifact/download-artifact from v3 → v4 but kept the v3-era pattern:

  • All three build_wheels matrix legs (ubuntu-20.04, macos-13, macos-14) uploaded under the same name wheel-artifacts.
  • publish downloaded the sdist by name into dist/, then downloaded wheels with pattern: "*artifact*" and no path: (so they land in the workspace root, not dist/ — and gh-action-pypi-publish publishes from dist/).

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 misses dist/.

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)

  • Unique artifact names per uploader: cibw-wheels-${{ matrix.os }} and cibw-sdist.
  • Single collection in publish: download-artifact@v4 with pattern: cibw-*, merge-multiple: true, path: dist.
  • skip-existing: true on the publish step so a re-run can backfill missing files idempotently.
  • if-no-files-found: error on the uploads so an empty build fails loudly instead of silently publishing nothing.

Notes / follow-ups

  • Release jobs only run on release: created, so this can't be exercised by PR CI — it's validated by inspection + valid-YAML check. Consider adding a workflow_dispatch trigger (gated alongside the release condition) 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

#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

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.10%. Comparing base (a413a74) to head (0d3e304).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wbarnha
wbarnha merged commit bb06adc into master Jul 17, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant