Repository navigation
ci: release a prebuilt x86_64 Linux binary for every published version - #7
Conversation
Every Arch program repo installs arch-kit with `cargo install`, which takes about four minutes per job; a stage deploy runs it in some twenty jobs, five of them back to back for aUSD funding alone. `Release binary` builds arch-kit from the exact commit crates.io packaged a version from (the crate's .cargo_vcs_info.json), smoke-tests `--version`, and attaches `arch-kit-<version>-x86_64-unknown-linux-gnu.tar.gz` and its SHA-256 to the GitHub release `v<version>`, creating the release and tag at that commit. The binary needs glibc 2.39+ and OpenSSL 3 (arch_sdk's reqwest uses native-tls), i.e. ubuntu-24.04 / ubuntu-latest runners. - Publish Crate calls it after `cargo publish`; run it by hand to backfill a version published earlier (0.1.8 next). - Published assets are never replaced: an identical asset is skipped, a different one, or a tag at another commit, fails the run. - Pull requests touching the crate build and smoke-test without releasing.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d08cff81e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| gh release create "${tag}" -R "${REPO}" --target "${COMMIT}" \ | ||
| --title "arch-kit ${VERSION}" --notes "${notes}" |
There was a problem hiding this comment.
Validate an existing tag before creating its release
When v${VERSION} already exists without a GitHub Release, as can happen during a historical backfill, this branch skips the tag-commit check and relies on --target. However, gh release create --help states that --target controls the automatic tag creation when the matching tag does not yet exist, so an existing tag is not retargeted. The workflow can therefore attach a binary built from COMMIT to a release whose tag points to a different commit; resolve and validate the tag independently of whether the release exists.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 91b002b: the tag is now checked whenever it exists, before anything is created. Existence comes from git/matching-refs with an exact-name filter, which answers [] when the tag is absent, so a failed lookup can't pass for "no tag". A tag at another commit fails the run.
| if gh release view "${tag}" -R "${REPO}" > /dev/null 2>&1; then | ||
| tag_commit="$(gh api "repos/${REPO}/commits/${tag}" --jq .sha)" | ||
| test "${tag_commit}" = "${COMMIT}" || { | ||
| echo "::error::tag ${tag} points at ${tag_commit}, but ${VERSION} was published from ${COMMIT}" >&2 | ||
| exit 1 | ||
| } |
There was a problem hiding this comment.
Add the checksum to existing release notes
When backfilling a version that already has a GitHub Release, this branch only validates the tag and leaves the existing notes unchanged; the checksum-bearing notes are constructed exclusively in the else branch. Such a backfill successfully uploads the assets but does not put the SHA-256 in the release notes, even though the new installation instructions tell consumers to pin the checksum from those notes. Update or append to existing notes while preserving their current content.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 91b002b: once the assets are in place, a release whose notes lack SHA-256 <checksum> gets the checksum section appended, and its existing content is kept. This happens once; a re-run doesn't touch the notes again.
… checksum in old notes Review follow-ups: - A tag v<version> that exists without a release skipped the commit check, and `gh release create --target` does not move an existing tag, so a binary could land on a tag at another commit. The tag is now checked whenever it exists (git/matching-refs answers [] for an absent tag, so a failed lookup cannot pass for "no tag"), before anything is created. - Backfilling into a release that already existed left its notes without the SHA-256 the README tells consumers to pin. Its notes now gain the checksum section once, keeping their content.
Why
Every Arch program repo installs arch-kit with
cargo install arch-kit --locked, which compiles it from source on each job. In the last realdeploy-stage-v2run (arch-infrastructure run 38264455030, 89 min):treasury-mint(×5, back to back)arch-deployarch-programarch-marketsAbout 16 workflows across 7 repos do this, and none caches it.
What
New
.github/workflows/release-binary.yml:.cargo_vcs_info.jsonin the published.crate), checks it out, and checks thatCargo.tomlsays that version.cargo build --locked --release, then a smoke test:arch-kit --versionmust printarch-kit <version>.arch-kit-<version>-x86_64-unknown-linux-gnu.tar.gzand its.sha256to the GitHub releasev<version>. If the release doesn't exist, it creates the release and its tag at that commit, and the release notes give the SHA-256.workflow_call, fromPublish Crateaftercargo publishworkflow_dispatch, to backfill a version published earlierpull_requeston crate changes: build and smoke test only, no releasePlatform:
x86_64-unknown-linux-gnu, built onubuntu-24.04. It needs glibc 2.39+ and OpenSSL 3, linked dynamically (readelfNEEDED: libssl.so.3, libcrypto.so.3, libgcc_s, libm, libc). A static musl build isn't possible as-is:arch_sdkpulls inreqwestwith native-tls, so OpenSSL comes along. Every current consumer runs onubuntu-24.04orubuntu-latest.publish-crate.yml: newbinaryjob (needs: publish) that calls the workflow above.README:
Verification
actionlintclean.0.1.8resolves to02377c4(the currentmain, which0.1.8was published from) and the version check passesarch-kit 0.1.8, and the archive contains onlyarch-kitand passessha256sum -cgh:pull_requestrun builds and smoke-tests the binary onubuntu-24.04.After merge
Run Release binary with
version=0.1.8to publishv0.1.8. Program repos can then swapcargo install arch-kitfor the download and pin the SHA-256 from the release notes.Need help on this PR? Tag
@codesmith-botwith what you need.