Skip to content

Latest commit

 

History

History
152 lines (122 loc) · 7.1 KB

ci.md

File metadata and controls

152 lines (122 loc) · 7.1 KB

CI and release pipeline

The repository runs one workflow per push or pull request: .github/workflows/ci.yml. Every check of the project is a job inside that workflow, staged so that the cheap feedback arrives first and the expensive work only starts when the cheap work is green.

Stages

Stage Jobs Purpose
0. Change detection changes classifies the diff so untouched stages are skipped
1. Instant feedback fmt, compliance, supply-chain formatting, license, workflow linting and dependency policy — no workspace compilation
2. Shared build clippy, msrv, docs the first full compilation; warms the rust-cache that the later stages restore
3. Heavy verification test, coverage, zlib-parity, benchmarks, pages the test matrix, the coverage gate, the size parity oracle, the benchmarks and the playground build
4. Release build release-build the optimized workspace build, once everything else is green
5. Release pipeline version-bump, release-gate, build-release, create-release version bump, tag, per-platform binaries, provenance attestation and the GitHub Release — main only

The changes job classifies the diff with dorny/paths-filter: rust (sources, manifests, ruleset, tooling), playground and deny (dependency policy). A docs-only change skips every compilation job; the release jobs treat "nothing that ran failed" as green, so a skipped job never blocks a release and never fakes one. workflow_dispatch runs everything.

External services never redden the pipeline: the Codecov uploads and the CodSpeed run are continue-on-error, so an outage shows up in the step log but does not fail the job. The local gates — the 95% coverage threshold, the benchmark build — stay hard.

The pages and pages-deploy jobs replace the former standalone Pages workflow: the playground is built and published by the same run that verifies the workspace.

Tooling

Tool Version Scope
actionlint 1.7.12 workflow syntax, expressions and shellcheck for every run: block
zizmor 1.32.0 security audit of the workflow definitions
yamllint latest YAML style of the workflow files
reuse 6.0.0 license compliance of every file
cargo-deny 2.1.1 advisories, licenses, duplicate and wildcard bans
cargo-llvm-cov latest coverage, gated at 95% of lines
cargo-nextest latest test runner, JUnit report for Codecov
cargo-codspeed 6.0.0 benchmark execution for CodSpeed
git-cliff latest changelog and version computation

actionlint, zizmor and git-cliff are installed from pinned releases with a verified checksum, so the CI never depends on an unpinned download and never compiles a tool at run time.

Authentication

The repository is public, so only Codecov needs a stored credential:

Service Authentication
Codecov, coverage and test results the CODECOV_TOKEN repository secret
CodSpeed, benchmarks OIDC (id-token: write)
GitHub Pages, releases, attestations the built-in GITHUB_TOKEN

CODECOV_TOKEN is the repository upload token from the Codecov settings. Both upload steps pass it with fail_ci_if_error: true and continue-on-error: true: a rejected or failed upload is visible in the step log but never reddens the pipeline.

The only optional secret is CARGO_REGISTRY_TOKEN, needed once the crates are published to crates.io; the current release pipeline builds binaries and creates the GitHub Release without publishing to a registry.

Each job declares the permissions it needs, so the repository setting Settings → Actions → General → Workflow permissions may stay at its default value.

Workflow dependency lockfile

.github/workflows/actions.lock pins every action the workflow uses to an exact commit, including the transitive dependencies that a plain uses: pin cannot reach (actions/github-script through Codecov, actions/cache through CodSpeed, actions/attest through the provenance action). The file is generated by gh actions-lock and must never be edited by hand:

gh extension install github/gh-actions-lock
gh actions-lock          # regenerate
gh actions-lock --no-fix # verify only

The lockfile records the numeric identity of every source repository, so a repository that is renamed or transferred cannot silently replace a locked action.

Cache policy

GitHub grants read-only cache tokens to runs triggered by untrusted events, so a pull request can never write into the cache of main. The release jobs additionally declare cache-mode: none: a released binary is always built from a clean tree and never comes out of a cache.

actionlint 1.7.12 predates the cache-mode key, so the single check that reports it as unknown is filtered explicitly. The key itself is documented and generally available since September 2026.

Release flow

  1. A conventional commit lands on main.
  2. version-bump computes the next version with git-cliff, taking the greater of the computed version and the version in Cargo.toml, then commits the bumped manifest and lockfile, regenerates CHANGELOG.md, tags the commit and pushes both. It also moves the floating tag of the action (v0.1 while the version is 0.x, v1 from 1.0 on) to the new release, so uses: RAprogramm/widgetlint@v0.1 always points at the newest release of the line. The floating tags never enter the version computation: git-cliff matches release tags with a strict semver expression and git describe selects the same tags.
  3. release-gate verifies that the tag matches the manifest version.
  4. build-release builds the widgetlint binary for Linux, macOS and Windows, packs it with the license and the readme, signs the build provenance and uploads the archive with its SHA-256 checksum.
  5. create-release publishes the GitHub Release with the notes generated by git-cliff.

The changelog in the repository and the release notes in the GitHub Release are different artifacts: CHANGELOG.md is committed and covers every release, while RELEASE_NOTES.md is generated inside the release job, never committed, and covers the released version only.

Repository settings

The pipeline declares its own token permissions per job, so the repository setting Settings → Actions → General → Workflow permissions may stay at its default value. The only required repository secret is CODECOV_TOKEN, as the Authentication section above explains.

Local reproduction

cargo +nightly fmt --all --check
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings -W clippy::pedantic -W clippy::nursery
cargo nextest run --workspace
cargo test --doc --workspace
cargo llvm-cov nextest --workspace --locked --fail-under-lines 95
cargo bench --workspace --no-run
actionlint -color -ignore 'unexpected key "cache-mode"'
zizmor .github/workflows/ .github/dependabot.yml
yamllint .github/workflows/
reuse lint