Skip to content

ci: macOS (universal2) wheels + release path hardening; v3.1.0 - #626

Merged
phenobarbital merged 4 commits into
devfrom
ci/release-dryrun-macos-wheels
Nov 5, 2026
Merged

phenobarbital merged 4 commits into
devfrom
ci/release-dryrun-macos-wheels

Conversation

@phenobarbital

Copy link
Copy Markdown
Owner

What

release.yml could not build or distribute macOS wheels. It now does, and the
release path it publishes through is verifiable without touching PyPI.

The bug this started from

The publish step uploaded a hand-maintained list of per-platform globs:

twine upload dist/*-manylinux*.whl dist/*-win_amd64.whl dist/*.tar.gz

A navconfig-3.1.0-cp312-cp312-macosx_11_0_universal2.whl matches none of
them. Adding a macOS build job alone would have produced wheels that were
built, uploaded as artifacts, moved into dist/, printed in the file
listing — and never published, on a green build.

It now uploads dist/* behind the completeness gate, which is what that gate
is for. Consequence: the per-job artifact paths became load-bearing. The
manylinux job must upload dist/*-manylinux*.whl, not dist/*.whl, because
the manylinux action leaves both the raw linux_x86_64 wheels and the
audited ones in dist/, and PyPI rejects a bare linux_x86_64 tag.

macOS wheels are universal2, not arm64

actions/setup-python hands macos-15 a universal2 interpreter, so the
wheels come out tagged macosx_11_0_universal2. Inspecting the Mach-O headers
of the published artifact confirms all seven extension modules are fat
binaries with real x86_64 and arm64 slices:

navconfig/exceptions.cpython-312-darwin.so            x86_64, arm64
navconfig/loaders/parsers/toml.cpython-312-darwin.so  x86_64, arm64
...  (7 of 7)

So one wheel per interpreter serves Apple Silicon and Intel Macs, and no
macos-15-intel job is needed.

This is also why ARCHFLAGS is deliberately left unset: forcing
-arch arm64 under that universal2 interpreter would emit arm64-only
binaries that sysconfig still tags universal2 — a wheel promising Intel
support it does not have. The arch gate derives
delocate-wheel --require-archs from the tag (universal2 → x86_64,arm64,
*arm64 → arm64, anything else → error) precisely to catch that.

Dry-runnable release path

deploy was split so everything checkable without credentials runs on any
event:

Job Credentials Runs in a dry run
build (manylinux), build-windows ×5, build-macos ×5, build-source — yes
validate-dist — artifact aggregation, completeness gate, twine check none yes
publish PyPI token, environment: pypi, id-token no — if: github.event_name == 'release'
test-install — no (needs: publish)

secrets. and id-token appear in publish only, verified by script. With
workflow_dispatch plus a push: ci/release-dryrun-** trigger, the whole
path is a dry run away. Note workflow_dispatch only becomes usable once this
file is on the default branch, which is why the branch-prefix trigger exists.

Also here

  • build.yml (new). Compiles the extensions and runs the suite on Linux,
    Windows and macOS for every push and PR. Previously the first macOS or
    Windows compile of a change happened inside release.yml — after the GitHub
    release had already been created, when the only remedy is yanking a version.
  • setup.py: dropped CYTHON_COMPILING_IN_PYPY=1 from the
    navconfig.exceptions extension. The macro told Cython-generated C it was
    running under PyPy and enabled PyPy-only code paths on CPython. /O2 vs
    -O2 is now selected from the detected compiler instead of relying on MSVC
    accepting the GCC spelling.
  • pyproject.toml: real OS classifiers; OS Independent was never true
    of binary wheels.
  • .bumpversion.cfg: dropped [bumpversion:file:pyproject.toml]. That
    file declares dynamic = ["version"], so its only version-shaped strings
    are dependency pins (python-logstash-async>=2.7.2,<=3.0.0,
    pre-commit>=3.0.0) — and bumpversion substitutes with str.replace, i.e.
    every occurrence.
  • v3.1.0 and the changelog release cut.

Verification

Dry run 42090622381 — green, 13 jobs, publish and test-install skipped. 16 artifacts, all 3.1.0, twine check PASSED on every one, no raw linux_x86_64 wheels:

  • 5 × manylinux2014_x86_64.manylinux_2_17_x86_64
  • 5 × win_amd64
  • 5 × macosx_11_0_universal2
  • 1 × sdist

Locally: 7/7 extensions rebuild clean without the PyPy macro, ruff clean on
setup.py, every bash block in both workflows parses, suite unchanged at
128 passed.

Open points for the reviewer

  1. Semver. [3.1.0] carries "VaultReader.set/delete now split nested
    keys on the last / — behavior change for keys like a/b/KEY"
    . That is
    arguably breaking and would point at 4.0.0. Left at 3.1.0 as decided.
  2. test-install no longer has continue-on-error, so a PyPI propagation
    delay can turn a run red after a correct publish. Informative, not
    destructive — one line to revert if unwanted.
  3. test-install only runs on arm64 macOS runners, so the x86_64 slice is
    never exercised at install time. A macos-15-intel entry on that job alone
    would cover it.
  4. Keep the push: ci/release-dryrun-** trigger? It is inert unless someone
    names a branch with that prefix on purpose.
  5. The run warns that checkout@v4, setup-python@v5, upload-artifact@v4
    and setup-uv@v4 target Node 20 and are being forced onto Node 24.
    Separate cleanup.

The only thing a dry run cannot cover is, by definition, the twine upload
itself.

🤖 Generated with Claude Code

phenobarbital and others added 4 commits November 5, 2026 19:43
Add a build-macos job to release.yml: macos-15 (arm64), CPython 3.10-3.14,
MACOSX_DEPLOYMENT_TARGET=11.0, with two gates before the artifact is kept --
an assertion that the wheel's platform tag is macosx_*_arm64 or
macosx_*_universal2, and `delocate-wheel --require-archs arm64` on the
binaries. ARCHFLAGS is deliberately left unset: forcing `-arch arm64` under a
universal2 interpreter would emit arm64-only binaries still tagged
`universal2`, i.e. a wheel claiming Intel support it does not have.

Fix the publish step, which would have dropped the new wheels silently. It
uploaded a hand-maintained list of per-platform globs
(`dist/*-manylinux*.whl dist/*-win_amd64.whl dist/*.tar.gz`); a
`macosx_11_0_arm64` wheel matches none of them, so it would have been
downloaded, moved into dist/, listed -- and never uploaded, with a green
build. Upload `dist/*` instead, behind the completeness gate that now also
requires macOS wheels. This makes the per-job artifact paths load-bearing:
the manylinux job must upload `dist/*-manylinux*.whl` rather than
`dist/*.whl`, because the manylinux action leaves both the raw `linux_x86_64`
wheels and the audited ones in dist/, and PyPI rejects a bare `linux_x86_64`
tag.

Split deploy into validate-dist and publish so the aggregation and gating
logic -- where that silent failure lived -- can be exercised without
credentials. validate-dist holds no secrets and no environment; publish is
the only job gated on `github.event_name == 'release'`. With workflow_dispatch
and a `ci/release-dryrun-**` push trigger, the entire release path is now a
dry run away.

Add build.yml: compile the extensions and run the suite on Linux, Windows and
macOS for every push and pull request. Previously the first macOS or Windows
compile of a change happened inside release.yml, after the GitHub release had
already been created, when the only remedy is yanking a version.

Drop CYTHON_COMPILING_IN_PYPY=1 from the navconfig.exceptions extension: the
macro told Cython-generated C it was running under PyPy and enabled
PyPy-only code paths on CPython. Select /O2 or -O2 from the detected compiler
instead of relying on MSVC accepting the GCC spelling.

Verified: 7/7 extensions rebuild clean without the macro, `twine check`
passes on the resulting wheel, ruff is clean on setup.py, every bash block in
both workflows parses, and the suite is unchanged at 128 passed. Native
macOS/Windows compilation can only be verified on GitHub Actions.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The dry run (run 42087120664) showed actions/setup-python hands macos-15 a
universal2 interpreter: the wheels come out tagged
`macosx_11_0_universal2`, and inspecting the Mach-O headers confirms all
seven extension modules are fat binaries with real x86_64 and arm64 slices.
So Intel Macs are covered by the same wheel and no macos-15-intel job is
needed -- the comment and CHANGELOG entry claiming Intel falls back to the
sdist were wrong.

This also vindicates leaving ARCHFLAGS unset: with `-arch arm64` forced, that
universal2 interpreter would have produced arm64-only binaries that sysconfig
still tags universal2, i.e. a wheel promising Intel support it does not have.

Derive --require-archs from the tag instead of hardcoding arm64, so that
exact mislabelling cannot pass the gate: universal2 now requires both slices,
a thin arm64 tag requires arm64, and any other macosx tag is an error.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Minor bump, equivalent to `make bump-minor`, plus `.bumpversion.cfg`'s
current_version, which that Makefile target leaves behind.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Also drop `[bumpversion:file:pyproject.toml]`. pyproject.toml carries no
version field -- it declares `dynamic = ["version"]` and reads
`navconfig.version.__version__` -- so the only version-shaped strings in it
are dependency pins (`python-logstash-async>=2.7.2,<=3.0.0`,
`pre-commit>=3.0.0`). bumpversion substitutes with str.replace, i.e. every
occurrence, so a real `bumpversion` run would have silently rewritten those
pins. navconfig/version.py is now the single declared target, which is also
the only file `make bump-minor` touches.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@phenobarbital
phenobarbital merged commit 803576c into dev Nov 5, 2026
16 of 37 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