Repository navigation
ci: cache Rust builds, harden the workflows, share the release workflow - #3
Merged
Merged
Conversation
Jertlok
force-pushed
the
ci/cache-harden
branch
from
September 15, 2026 23:20
e9b7fa2 to
217a005
Compare
Jertlok
marked this pull request as ready for review
September 15, 2026 23:20
Jertlok
force-pushed
the
ci/cache-harden
branch
3 times, most recently
from
September 16, 2026 06:27
e37218c to
93904a8
Compare
The CI of a push was 27 minutes of runner time: Lint, Test and Build each compiled the whole dependency graph from scratch, and the Test job did it twice, both times with the shipped release profile (fat LTO, one codegen unit) whose link step alone took six minutes of each fourteen-minute run. - Swatinem/rust-cache in all three jobs, keyed by Cargo.lock and the compiler. Only pushes to main save, so pull requests restore main's cache instead of filling the repository's 10 GB with copies only they can read. GNU tar and zstd are installed because actions/cache cannot write the cache with busybox tar -- and only warns when it fails. - The Test job builds without fat LTO (CARGO_PROFILE_RELEASE_LTO=false, 16 codegen units) and shares one target directory between the unit tests and the preview build, so the dependencies are compiled once. The Build job keeps the shipped profile. - Concurrency per pull request, cancelling only superseded pull request runs; a second push to main no longer cancels the first push's checks. - A timeout on every job, and merge_group so the workflow can back a merge queue. - A weekly run: the alpine:edge image the jobs use is the distribution the app ships to, and breakage it brings should not wait for a commit. - The commit check and the release are porthole-dev/.github's shared action and reusable workflow instead of four copied scripts and a 172-line copy of the release workflow. Releases gain the source archive and SHA512SUMS as assets, and a provenance attestation of the archive once the repository is public. - Workflow lint (actionlint, zizmor) and a "CI passed" aggregate job: the one status check a ruleset needs to require. - Dependabot keeps the pinned actions and the Rust dependencies current, weekly and grouped, with a seven-day cooldown. Timings on ubuntu-24.04 (2 vCPU), run 35034032549 rerun with the caches warm, against the median of the last seven runs of main: Lint 318 s -> 35 s Test 889 s -> 121 s Build 442 s -> 115 s Assisted-by: Claude Signed-off-by: Giuseppe Maggio <jertlok@proton.me>
The previous pin named a commit from the pull request branch, which the rebase merge orphaned; an orphaned commit can be garbage-collected and the action then stops resolving. Point at the commit main was tagged v1.0.0. Assisted-by: Claude Signed-off-by: Giuseppe Maggio <jertlok@proton.me>
Jertlok
force-pushed
the
ci/cache-harden
branch
from
September 16, 2026 06:37
4dce697 to
1786748
Compare
The earlier re-pin only covered porthole-dev/.github/actions/*; the reusable workflow reference still named the pull request commit, which the rebase merge orphaned. zizmor flags it as an impostor-commit, correctly. Assisted-by: Claude Signed-off-by: Giuseppe Maggio <jertlok@proton.me>
Jertlok
force-pushed
the
ci/cache-harden
branch
from
September 16, 2026 07:41
6c5fa56 to
43e4c76
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
concurrency: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }},cancel-in-progressonly for pull requestsci-<ref>, always cancelling) let a second push tomaincancel the first push's run: tap run 35024225791 shows it.timeout-minuteson every jobmerge_grouptriggerporthole-dev/.github/actions/commit-check, pinned by commit--filter=tree:0, so a base older than the formerfetch-depth: 100fails loudly instead of reporting "no new commits". Check name stays Commit check.Swatinem/rust-cachein Lint, Test and Build, saving only onmainsave-if: github.ref == refs/heads/main, from the action's own README): pull requests restoremain's cache and cannot evict it with copies only they can read.lto = "fat",codegen-units = 1; the link step alone was ~6 minutes of each run. Tests exercise the code, not the shipped optimization; the Build job keeps the real profile.tarandzstdin the containersactions/cachecannot write a cache with busyboxtarand only warns: the first run saved nothing and went green.porthole-dev/.github/.github/workflows/app-release.yml; releases carry the source archive,SHA512SUMSand a provenance attestationgh attestation verifyattach to.check-zizmor.yml); both tools are what the OpenSSF Scorecard and GitHub's security hardening guide checks are about (pinning, token permissions, injection)..github/dependabot.yml: GitHub Actions weekly, grouped, 7-day cooldowndependabot-cooldownrecommendation. Dependabot commits need the maintainer's sign-off before merge like any other.persist-credentials: false, least-privilegepermissionsartipacked/excessive-permissions.Timing (run 35034032549, ubuntu-24.04, 2 vCPU)
main)Cold numbers are the first run after a
Cargo.lockor compiler change; the caches are 302 MB (build), 342 MB (test), 215 MB (lint).Depends on
porthole-dev/.githubis private: its Settings > Actions > General > Access set to "Accessible from repositories in the porthole-dev organization". Until then Commit check, Workflow lint and CI passed fail with "Unable to resolve actionporthole-dev/.github, repository not found".@43919fe... # main) moved to the merged commit and its tag (# v1.0.0); zizmor'sref-version-mismatchwarns until the comment names a tag.Merge note
The Commit check fails until the commit carries the maintainer's
Signed-off-by(git rebase --signoff main).