Skip to content

Enhancement | Gate the PyPI release on the test suite and the built package #331

Closed

Description

@diego-ojeda-binbash

Describe the Feature

Gate .github/workflows/release-pypi-build-push-package.yml on the test suite and on the package it is about to publish. Today the release job does bump → clean → build → twine check → upload with no tests at all, and it publishes whatever master points to rather than the released tag.

Current problems

Problem Detail
No tests before publishing Neither the unit tests nor the bats suite run in the release workflow. Between #316 (2026-04-09) and #322 (2026-09-15) the unit tests were red on master, so any release cut in that window would have reached PyPI untested.
Publishes master, not the tag actions/checkout uses ref: master on a release: published event. If master moved after the tag was cut, PyPI gets a different commit than the one released on GitHub.
Version taken from the latest tag make bump-version-ci uses git tag --sort=version:refname | tail -1, not the tag being released. Releasing a patch on an older line would stamp the wrong version.
The built wheel is never exercised Every CI job installs the CLI with pip install -e .. Nothing installs the wheel from dist/, so a packaging error (missing templates, broken entry point) would only show up for users.
Dead git push step commit_push runs git push but nothing is ever committed, so it is a no-op (and fails on a detached tag checkout).

Expected Behavior

A release reaches PyPI only if:

  1. the unit tests pass on the full Python matrix (3.9 - 3.13) on the tagged commit, and
  2. the wheel built for that tag installs in a clean environment, reports the tag's version, and passes the bats suite.

Use Case

Since the branch protection change, a PR cannot merge with red checks, but a release can still publish a broken artifact: the protection only covers what goes into master, not what goes to PyPI. The release is the last point where a defect can be stopped before it reaches every user.

Describe Ideal Solution

Split the release job into build → (unit_tests ‖ smoke) → publish, reusing the existing test workflows instead of duplicating them:

  • tests-unit.yml and tests-integration.yaml gain a workflow_call trigger.
  • tests-integration.yaml accepts an optional built distributable artifact: when given, the bats job installs that wheel instead of the editable checkout, checks leverage --version against the expected version, and the ref-arch job is skipped.
  • build checks out the release tag, stamps that tag's version, builds and runs twine check, and uploads dist/ as an artifact.
  • publish needs both test jobs, downloads the very same dist/ and uploads it to PyPI.
  • Drop the commit_push step.

Alternatives Considered

Additional Context

  • Follow-up, out of scope here: the Test PyPI workflow (release-pypi-build-push-test-package.yml) has the same gap.
  • Comes from the test strategy review of 2026-11-09 (finding H2).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions