Skip to content

ci: biuld, verify and smoke-test releases - #426

Open
woodsh17 wants to merge 8 commits into
productionfrom
ci/pypi-release-workflow
Open

woodsh17 wants to merge 8 commits into
productionfrom
ci/pypi-release-workflow

Conversation

@woodsh17

@woodsh17 woodsh17 commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Adds a workflow that builds and checks rc-foundry release files from a tagged commit. It deliberately does not upload to PyPI; that stays a manual step for now.

How it works

Pushing a v* tag runs:

  1. gate: tagged commit must be on production and test, test_integration and lint_production must have passed on that commit.
  2. build: tag must equal v<pyproject version> (.github/release.py verify). Builds the sdist and wheel from a clean checkout.
  3. smoke-test: installs the wheel with each extra (base, rfo, rfd3, rfd3na, rf3, all) into its own fresh venv; pip check, imports, CLI --help.
  4. release-files: runs only if everything above passed. twine check --strict, writes the files' SHA-256 hashes to the run summary, and saves them as the run's dist artifact.

PRs touching pyproject.toml, release.yaml or release.py, and manual runs (workflow_dispatch) on a branch, do the same build and checks as a dry run: the gate only warns, and the files are saved as dist-dryrun, never dist. A manual run on a v* tag behaves like the tag push. Actions in this workflow are SHA-pinned; the new Dependabot github-actions entry covers all workflows, so expect version-bump PRs for the others too. Checkouts don't persist credentials.

Releasing with this

  1. Merge the version bump to production.
  2. An admin pushes the tag vX.Y.Z on that commit. A tag ruleset limits creating, moving and deleting v* tags to admins.
  3. When the run passes, download its dist artifact and run twine upload with a PyPI token scoped to rc-foundry.

woodsh17 and others added 7 commits November 24, 2026 22:18
Foundry has no release automation: all PyPI releases so far were uploaded
by hand, and the v0.1.8 tag was never published. This adds
.github/workflows/release.yaml, triggered by pushing a v* tag:

- build: verify the tag matches pyproject.toml's version
  (.github/release.py verify), then build the sdist and wheel from a clean
  checkout of the tagged commit.
- smoke-test: install the wheel into a fresh venv with no source tree,
  run pip check, import every package and run each CLI's --help.
- publish: upload to PyPI via Trusted Publishing (OIDC, environment
  `pypi`), so no API token is stored. Runs only on tag pushes.

A manual workflow_dispatch run does build + smoke-test without
publishing, as a dry run.

Before the first tag, a PyPI owner of rc-foundry must register the
trusted publisher (RosettaCommons/foundry, release.yaml, environment
pypi), and a repo admin should create the `pypi` environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub substitutes ${{ }} expressions into the script before the shell
runs it, and git tag names can contain shell metacharacters. Use the
GITHUB_REF_TYPE / GITHUB_REF_NAME environment variables the runner
already provides, so the tag is passed to release.py as data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The publish job holds id-token: write, so every action that runs in this
workflow can influence what is uploaded to PyPI as rc-foundry. Pin each
action to a full commit SHA, which cannot be moved the way a tag can,
with the release it corresponds to in a trailing comment. Pins keep the
major versions the repo already uses:

  actions/checkout              v4.4.0
  actions/setup-python          v5.6.0
  actions/upload-artifact       v4.6.2
  actions/download-artifact     v4.3.0
  pypa/gh-action-pypi-publish   v1.14.3 (peeled commit of annotated tag)

Add a github-actions entry to dependabot.yml so the pins get update PRs
instead of going stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sted creds

- smoke-test is now a matrix over base, rfo, rfd3, rfd3na, rf3 and all,
  each installed from the built wheel into its own fresh venv. Separate
  venvs catch a dependency missing from one extra that another extra
  would otherwise mask; `all` catches conflicts between extras (as the
  rfo `atomworks[ml]==3.0.1` pin in #417 would have caused). Each entry
  imports the modules that need its extra's dependencies, since --help
  does not load them. rf3's extra is CUDA kernels, so it is checked for
  install + pip check only. fail-fast is off so every broken extra shows.
- Run build + smoke-test on pull requests touching pyproject.toml or the
  release tooling, so a broken extra is caught at review time. Publish
  remains tag-only; superseded PR runs are cancelled.
- Set persist-credentials: false on both checkouts: no step needs git
  auth, and pip / the build backend run third-party code after checkout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a `gate` job that build (and so smoke-test and publish) depends on.
On a tag push it fails the release unless:

- the tagged commit is an ancestor of origin/production, i.e. it was
  merged through production's PR process; and
- the latest push-triggered run of test.yaml, test_integration.yaml and
  lint_production.yaml on exactly that commit completed successfully.
  Workflows are looked up by file name, so renaming jobs does not
  silently weaken the check. A tag pushed before those runs finish fails
  with a message to re-run once they complete.

On PR and manual runs both checks only emit warnings, since those
commits are not on production. The job gets actions: read; the token is
passed to the one step that queries the API and is not persisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The RosettaCommons org is on a legacy GitHub plan on which deployment
environments cannot be configured (the settings page and environments API
return 404 even for org owners). Referencing `environment: pypi` would
auto-create an environment with no protection rules, so it added nothing.

Trusted Publishing does not require an environment; the PyPI trusted
publisher is registered with the environment field left blank. Release
control comes from the gate job, production branch protection, and a
tag ruleset restricting who may create v* tags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Trusted Publishing from this repo is not safe on the org's legacy GitHub
plan: deployment environments cannot be configured, so a publisher with a
blank environment matches only repository + workflow filename, and anyone
with write access could publish by pushing a branch with an edited copy
of release.yaml. The tag ruleset, gate job and branch protection guard
only the official tag route.

Remove the publish job and its id-token permission. The workflow still
gates, builds and smoke-tests on tag pushes, manual runs and packaging
PRs, and saves the sdist and wheel as the `dist` artifact; uploading is
a manual twine step using that artifact until the team decides how to
automate publishing safely. This corrects the trust-model claims in the
previous commit's header comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@woodsh17 woodsh17 changed the title Ci/pypi release workflow ci: biuld, verify and smoke-test releases Nov 25, 2026
- Smoke tests now consume an internal `untested-build` artifact. A final
  `release-files` job, which runs only after the gate, build and all smoke
  tests pass, runs `twine check --strict`, records the files' SHA-256
  hashes in the run summary and uploads them.
- The uploaded artifact is named `dist` only on runs for a v* tag; PR and
  branch runs produce `dist-dryrun`, so dry-run files carrying the release
  file names can't be mistaken for release files.
- Rewrite the header comment to describe the manual upload process
  without detailing publishing internals, and correct comments that
  described manual runs as never having a tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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