From cb3a3533a664a8682779c276640ad8e2502e0708 Mon Sep 17 00:00:00 2001 From: Aljes Date: Fri, 30 Oct 2026 11:54:05 +0000 Subject: [PATCH 1/2] publish.yml creates the GitHub release from the changelog Releases were cut by hand with `gh release create` until 0.11.1, and the release checklist never named that step, so 0.12.0 to 0.17.3 went to PyPI with no release page (and benchmark.yml skipped its notes for each). A new job creates the release once PyPI has the version, with the tag's section of docs/changelog.md as its notes; check-version refuses a tag with no section before anything is published. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/benchmark.yml | 5 +++-- .github/workflows/publish.yml | 40 +++++++++++++++++++++++++++++++++ AGENTS.md | 6 +++-- STATUS.md | 5 +++++ docs/developers.md | 6 +++-- 5 files changed, 56 insertions(+), 6 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 1b43a3e..8bae080 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -101,8 +101,9 @@ jobs: done echo "could not push benchmark results"; exit 1 - # Best effort, and last: releases here are cut by hand, so this job may - # well run before one exists. The docs page is authoritative either way. + # Best effort, and last: publish.yml creates the release once PyPI has + # the version, which is normally long before this job gets here, but a + # failed publish leaves none. The docs page is authoritative either way. - name: Append to the release notes if: github.ref_type == 'tag' continue-on-error: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2aa57e7..6d0404e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,6 +30,14 @@ jobs: echo "::error::Tag $tag does not match pyproject version $declared" exit 1 fi + # The GitHub release's notes are this section, so check it before + # anything is published rather than after. + - name: The changelog must have a section for the tag + run: | + if ! grep -qxF "## ${GITHUB_REF_NAME}" docs/changelog.md; then + echo "::error::docs/changelog.md has no '## ${GITHUB_REF_NAME}' section" + exit 1 + fi test: uses: ./.github/workflows/tests.yml @@ -91,3 +99,35 @@ jobs: name: dist path: dist/ - uses: pypa/gh-action-pypi-publish@release/v1 + + # Releases were cut by hand with `gh release create` until 0.11.1. The + # checklist never named that step, so 0.12.0 to 0.17.3 were tagged and + # published with no release page, and backfilled later. Running after PyPI + # means a release page never announces a version pip cannot install. + github-release: + needs: [publish-pypi] + if: | + always() + && needs.publish-pypi.result == 'success' + && startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - name: Notes from the changelog + run: | + awk -v tag="$GITHUB_REF_NAME" \ + '$0 == "## " tag { on = 1; next } on && /^## / { exit } on' \ + docs/changelog.md > notes.md + test -s notes.md + - name: Create the release + env: + GH_TOKEN: ${{ github.token }} + run: | + # One cut by hand first is left alone. + if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then + echo "release $GITHUB_REF_NAME already exists"; exit 0 + fi + gh release create "$GITHUB_REF_NAME" --verify-tag \ + --title "$GITHUB_REF_NAME" --notes-file notes.md diff --git a/AGENTS.md b/AGENTS.md index 6d2e203..d69973d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -252,8 +252,10 @@ an item to Released when its tag is out. - entries that start with a bold one-line lead and an issue link. - Merge the release branch, then push a tag with no `v` prefix. The tag triggers: - - `publish.yml`, which checks that the tag matches pyproject, tests, builds - and publishes to PyPI; + - `publish.yml`, which checks that the tag matches pyproject and has a + changelog section, tests, builds, publishes to PyPI, then creates the + GitHub release with that section as its notes. Don't create the release + by hand; that step was missed from 0.12.0 to 0.17.3; - `quay-on-tag.yml`, which pushes the Docker image to `quay.io/cellgeni/adata-cli`; - `benchmark.yml`, which reruns `benchmarks/` and commits the results to diff --git a/STATUS.md b/STATUS.md index 3cc5476..08637f8 100644 --- a/STATUS.md +++ b/STATUS.md @@ -55,6 +55,11 @@ Steps: ## Follow-ups noticed +- GitHub releases stopped at 0.11.1: they were cut by hand, and the release + checklist never said so. PyPI, quay and the benchmark page were unaffected. + `publish.yml` now creates the release from the changelog section; 0.12.0 + to 0.17.3 are backfilled from the changelog plus each tag's benchmark + artifact (kept 90 days, so by mid-January 2027). - `cell_id` (with `in_cell`, `in_nucleus`) on 2 µm bins, from Space Ranger 4's `barcode_mappings.parquet` (a 0.17.x after the audit fixes). - Dropped: spatial bundles whose matrix is a MEX folder only. 10x always diff --git a/docs/developers.md b/docs/developers.md index a8f233e..707e5e1 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -218,8 +218,10 @@ It reports and never gates; the complexity guards gate. paragraph, then whichever of `### Added`, `### Changed` and `### Fixed` apply, each entry led by a bold line and an issue link. 4. Merge, then push a tag with no `v` prefix. The tag runs `publish.yml` (checks - the tag against `pyproject.toml`, tests, publishes to PyPI), - `quay-on-tag.yml` (the image) and `benchmark.yml` (the benchmark page). + the tag against `pyproject.toml` and `docs/changelog.md`, tests, publishes + to PyPI, then creates the GitHub release from the changelog section), + `quay-on-tag.yml` (the image) and `benchmark.yml` (the benchmark page, + which it also appends to the release notes). `h5ad` as a command name, `info` and `convert` with `recast`'s flags are deprecated and stay until 1.0.0. From ef5d7305215b677babc7a3529ac47efaef3e5f48 Mon Sep 17 00:00:00 2001 From: Aljes Date: Thu, 26 Nov 2026 16:43:38 +0000 Subject: [PATCH 2/2] Review: wait for the release, refuse an empty section, image runs beside - benchmark.yml's notes step waits up to 30 minutes for the release: the margin after publish-pypi was 7 minutes for 0.17.5, so slow tests or a re-run in Publish would have dropped the summary. - check-version extracts the section as github-release does and refuses one with no text (a heading straight before the next, or ending the file), since the notes cannot be mended once PyPI has the version. - A failed image still gets its release; the trigger matrix pins that. - AGENTS.md and developers.md: the image and the release run side by side, and a PyPI dispatch creates the release too. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/benchmark.yml | 19 +++++++++++++------ .github/workflows/publish.yml | 15 +++++++++++---- AGENTS.md | 15 ++++++++------- STATUS.md | 3 +++ docs/developers.md | 10 +++++----- tests/test_release_pipeline.py | 21 +++++++++++++++------ 6 files changed, 55 insertions(+), 28 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 58b11ae..ca53a0f 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -109,7 +109,8 @@ jobs: # not ask must not overwrite that release's results with another tier. if: needs.benchmark.outputs.measured == 'true' && (github.event_name == 'push' || inputs.publish) runs-on: ubuntu-latest - timeout-minutes: 15 + # 15 for the commit, and the 30 the notes step may wait for the release. + timeout-minutes: 45 continue-on-error: true permissions: contents: write # push to main, and edit the release notes @@ -147,10 +148,12 @@ jobs: done echo "could not push benchmark results"; exit 1 - # Best effort, and last: publish.yml creates the release once PyPI has - # the version, which is normally long before this job gets here (13 - # minutes for 0.17.6), but a failed publish leaves none. The docs page - # is authoritative either way. + # Best effort, and last. publish.yml creates the release once PyPI has + # the version, normally before this job gets here, but only by 7 to 13 + # minutes (0.17.4 to 0.17.6): slow tests or a re-run in Publish would + # leave no release yet. So it waits up to 30 minutes for one; a failed + # publish leaves none. The docs page is authoritative either way, and + # re-running this job appends the summary later. - name: Append to the release notes if: github.ref_type == 'tag' continue-on-error: true @@ -158,8 +161,12 @@ jobs: GH_TOKEN: ${{ github.token }} TAG: ${{ github.ref_name }} run: | + for _ in $(seq 30); do + gh release view "$TAG" >/dev/null 2>&1 && break + sleep 60 + done gh release view "$TAG" >/dev/null 2>&1 || { - echo "no release for $TAG yet; skipping"; exit 0 + echo "no release for $TAG after 30 minutes; skipping"; exit 0 } gh release view "$TAG" --json body -q .body > "$RUNNER_TEMP/body.md" # Idempotent: replace any block this job wrote before. diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6612560..37dd103 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -62,12 +62,19 @@ jobs: fi echo "version=$declared" >> "$GITHUB_OUTPUT" # The GitHub release's notes are this section, so check it before - # anything is published rather than after. + # anything is published rather than after: once PyPI has the version + # the tag cannot change, and no re-run could mend the notes. The + # extraction is the one github-release uses. - name: The changelog must have a section for the tag id: changelog + env: + TAG: ${{ github.ref_name }} run: | - if ! grep -qxF "## ${GITHUB_REF_NAME}" docs/changelog.md; then - echo "::error::docs/changelog.md has no '## ${GITHUB_REF_NAME}' section" + awk -v tag="$TAG" \ + '$0 == "## " tag { on = 1; next } on && /^## / { exit } on' \ + docs/changelog.md > notes.md + if ! grep -q '[^[:space:]]' notes.md; then + echo "::error::docs/changelog.md has no '## $TAG' section with text" exit 1 fi @@ -169,7 +176,7 @@ jobs: awk -v tag="$TAG" \ '$0 == "## " tag { on = 1; next } on && /^## / { exit } on' \ docs/changelog.md > notes.md - test -s notes.md + grep -q '[^[:space:]]' notes.md - name: Create the release env: GH_TOKEN: ${{ github.token }} diff --git a/AGENTS.md b/AGENTS.md index 3bad9fc..482c268 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -311,11 +311,12 @@ an item to Released when its tag is out. triggers: - `publish.yml`, which checks that the tag matches pyproject and has a changelog section, tests (`tests.yml`, including a build and smoke test - of the Docker image), builds and publishes to PyPI, then calls - `quay-on-tag.yml` to build the image, check that it runs, and push that - image to `quay.io/cellgeni/adata-cli`, and creates the GitHub release - with the changelog section as its notes. If the tests fail or a check - does not pass, nothing is published. `:latest` moves only to the + of the Docker image), builds and publishes to PyPI. Then, side by side, + it calls `quay-on-tag.yml` to build the image, check that it runs, and + push that image to `quay.io/cellgeni/adata-cli`, and creates the GitHub + release with the changelog section as its notes (a failed image does + not hold it back). If the tests fail or a check does not pass, nothing + is published. `:latest` moves only to the highest `X.Y.Z` tag. Don't create the release by hand: that step was missed from 0.12.0 on, and releases had to be backfilled; - `benchmark.yml`, which reruns `benchmarks/` and commits the results to @@ -323,8 +324,8 @@ an item to Released when its tag is out. appends a summary to the release notes. The job that measures has a read-only token; the one that commits installs nothing. - A manual `Publish` dispatch to `testpypi` publishes there alone, from any - ref. One to `pypi` publishes, and pushes the image, only when run from a - tag; from a branch it fails. + ref. One to `pypi` publishes, pushes the image and creates the release, + only when run from a tag; from a branch it fails. - Workflows pin third-party actions by commit SHA, with the version in a comment, and pass tags and inputs to scripts through `env:`. `tests/test_release_pipeline.py` and the `workflow lint` job check both. diff --git a/STATUS.md b/STATUS.md index d7f9f01..d4296b5 100644 --- a/STATUS.md +++ b/STATUS.md @@ -38,6 +38,9 @@ theirs. `publish.yml` now creates the release from the changelog section (#114). 0.12.0 to 0.17.6 were backfilled by hand from the changelog plus each tag's benchmark artifact; the next tag is the first end-to-end check. + GitHub renders each newline in a release body as a line break, so the + changelog's wrapped lines show ragged there; unwrapping paragraphs when + the notes are extracted would fix it (review of #114). - From waves 3 and 4 of the audit fixes: - The streaming transpose and other users of `csr_build.BucketSorter` append every input block to every bucket, (nnz/chunk)² appends, and diff --git a/docs/developers.md b/docs/developers.md index ceacad9..17d5847 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -263,9 +263,9 @@ It reports and never gates; the complexity guards gate. 4. Merge, then push a tag with no `v` prefix. The tag runs `publish.yml`, which checks the tag against `pyproject.toml` and `docs/changelog.md`, tests (`tests.yml`, including a build and smoke test of the image), - publishes to PyPI, then calls `quay-on-tag.yml` to build the image, check - that it runs, and push that image, and creates the GitHub release from - the changelog section. If the tests fail or a check does not pass, + publishes to PyPI. Then, side by side, it calls `quay-on-tag.yml` to + build the image, check that it runs, and push that image, and creates + the GitHub release from the changelog section. If the tests fail or a check does not pass, nothing is published. `:latest` moves only to the highest `X.Y.Z` tag. Don't create the release by hand. The tag also runs `benchmark.yml` (the benchmark page, which it also appends to the release notes), whose @@ -273,8 +273,8 @@ It reports and never gates; the complexity guards gate. installs nothing. A manual `Publish` dispatch to TestPyPI publishes there alone, from any ref; -one to PyPI publishes, and pushes the image, only when run from a tag, and -fails from a branch. +one to PyPI publishes, pushes the image and creates the release, only when +run from a tag, and fails from a branch. Workflows pin third-party actions by commit SHA, with the version in a comment, and pass tags and inputs to scripts through `env:`. `tests/test_release_pipeline.py` and the `workflow lint` job check both. diff --git a/tests/test_release_pipeline.py b/tests/test_release_pipeline.py index dad2bd2..3cc8182 100644 --- a/tests/test_release_pipeline.py +++ b/tests/test_release_pipeline.py @@ -117,11 +117,14 @@ def result(name): ("push", TAG, None, ("check-version",), set()), ("push", TAG, None, ("build",), set()), ("push", TAG, None, ("publish-pypi",), set()), + # PyPI has the version by then, so the release still announces it. + ("push", TAG, None, ("image",), {"publish-pypi", "github-release"}), ], ids=[ "tag", "testpypi-dispatch-from-tag", "pypi-dispatch-from-tag", "testpypi-dispatch-from-branch", "pypi-dispatch-from-branch", "tests-fail", "tag-is-not-the-version", "build-fails", "pypi-upload-fails", + "image-fails", ], ) def test_each_run_publishes_exactly_what_passed(event, ref, target, failing, published): @@ -184,17 +187,23 @@ def test_check_version_passes_only_a_tag_that_names_the_version( @pytest.mark.parametrize( "heading, ok", - [("## 0.17.5", True), ("## 0.17.4", False), ("## 0.17.5 (soon)", False)], - ids=["has-the-section", "no-section", "heading-is-not-the-tag"], + [ + ("## 0.17.5\n\nText.\n", True), + ("## 0.17.4\n\nText.\n", False), + ("## 0.17.5 (soon)\n\nText.\n", False), + ("## 0.17.5\n\n## 0.17.4\n\nText.\n", False), + ("## 0.17.5\n", False), + ], + ids=["has-the-section", "no-section", "heading-is-not-the-tag", "section-is-empty", "heading-ends-the-file"], ) def test_check_version_refuses_a_tag_the_changelog_does_not_cover(tmp_path, heading, ok): """The release's notes are the tag's changelog section, so a tag with - none is refused before anything is published, not after PyPI has it.""" + none, or with no text in it, is refused before anything is published: + once PyPI has the version the tag cannot change to mend the notes.""" (tmp_path / "docs").mkdir() - (tmp_path / "docs" / "changelog.md").write_text(f"# Changelog\n\n{heading}\n\nText.\n") + (tmp_path / "docs" / "changelog.md").write_text(f"# Changelog\n\n{heading}") done = _bash( - _script("publish.yml", "check-version", "changelog"), tmp_path, - GITHUB_REF_NAME="0.17.5", + _script("publish.yml", "check-version", "changelog"), tmp_path, TAG="0.17.5", ) assert (done.returncode == 0) == ok, done.stdout + done.stderr