Skip to content

feat(visaged): profile the verify path — emit per-stage timing on eve… #240

feat(visaged): profile the verify path — emit per-stage timing on eve…

feat(visaged): profile the verify path — emit per-stage timing on eve… #240

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libpam0g-dev libdbus-1-dev
- name: Read the pinned toolchain
id: rust
run: |
set -euo pipefail
channel="$(grep '^channel' rust-toolchain.toml | sed 's/.*"\(.*\)"/\1/')"
# Refuse rather than hand the action an empty string, which it would
# silently resolve to something else.
if [ -z "$channel" ]; then
echo "::error::no channel found in rust-toolchain.toml"
exit 1
fi
echo "using pinned toolchain: ${channel}"
echo "channel=${channel}" >> "$GITHUB_OUTPUT"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rust.outputs.channel }}
components: clippy, rustfmt
- name: Cache cargo registry and build
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy
# --all-targets so integration tests under crates/*/tests/ are linted
# too. Without it the five contract tests added in #91 are invisible
# to CI even though they are clean locally.
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Build
run: cargo build --release --workspace
- name: Test
run: cargo test --workspace
build-deb:
runs-on: ubuntu-24.04
needs: test
steps:
- uses: actions/checkout@v7
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libpam0g-dev libdbus-1-dev
- name: Read the pinned toolchain
id: rust
run: |
set -euo pipefail
channel="$(grep '^channel' rust-toolchain.toml | sed 's/.*"\(.*\)"/\1/')"
# Refuse rather than hand the action an empty string, which it would
# silently resolve to something else.
if [ -z "$channel" ]; then
echo "::error::no channel found in rust-toolchain.toml"
exit 1
fi
echo "using pinned toolchain: ${channel}"
echo "channel=${channel}" >> "$GITHUB_OUTPUT"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rust.outputs.channel }}
components: clippy, rustfmt
- name: Cache cargo registry and build
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-deb
# Pinned. This tool produces the SHIPPED artifact, and an unpinned
# `cargo install` is the same drift class that took CI down for six
# days on 2026-08-24 (see rust-toolchain.toml). It happened to resolve
# to the same version locally and in CI that day — by luck, not design.
run: cargo install cargo-deb --version 3.7.0 --locked
- name: Build release
run: cargo build --release --workspace
- name: Build .deb package
run: cargo deb -p visaged
- name: Upload .deb artifact
uses: actions/upload-artifact@v7
with:
name: visage-deb
path: target/debian/visage_*.deb
release:
runs-on: ubuntu-24.04
needs: build-deb
# Tag-triggered, deliberately.
#
# This previously gated on the head commit message starting with "release:".
# That stopped matching when the repo adopted Conventional Commits
# ("chore(release): 0.3.4"), and nothing reported a failure: v0.3.4, v0.3.5
# and v0.3.6 were all published by hand with no .deb attached, and each one
# looked correct. A commit-message convention should never be load-bearing
# for a release. A tag is explicit and no convention can silently sever it.
# See issue #75.
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- name: Download .deb artifact
uses: actions/download-artifact@v8
with:
name: visage-deb
- name: Resolve version and verify it matches the tag
id: version
run: |
set -euo pipefail
tag="${GITHUB_REF_NAME#v}"
manifest="$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')"
if [ "$tag" != "$manifest" ]; then
echo "::error::tag v${tag} does not match Cargo.toml version ${manifest}"
exit 1
fi
echo "version=${tag}" >> "$GITHUB_OUTPUT"
# SemVer: a pre-release is a version carrying a hyphenated suffix.
case "$tag" in
*-*) echo "prerelease=true" >> "$GITHUB_OUTPUT" ;;
*) echo "prerelease=false" >> "$GITHUB_OUTPUT" ;;
esac
- name: Extract this version's changelog section
run: |
set -euo pipefail
v="${{ steps.version.outputs.version }}"
awk -v tag="v${v}" '
$1 == "##" && $2 == tag { f = 1; next }
f && $1 == "##" { exit }
f { print }
' CHANGELOG.md > RELEASE_NOTES.md
if [ ! -s RELEASE_NOTES.md ]; then
echo "::error::CHANGELOG.md has no '## v${v}' section"
exit 1
fi
- name: Verify a .deb is actually present
run: |
set -euo pipefail
found=0
for deb in visage_*.deb; do
[ -e "$deb" ] || continue
found=1
printf ' %s (%s bytes)\n' "$deb" "$(stat -c %s "$deb")"
done
if [ "$found" -eq 0 ]; then
echo "::error::no visage_*.deb to attach — refusing to publish an assetless release"
exit 1
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
name: Visage v${{ steps.version.outputs.version }}
body_path: RELEASE_NOTES.md
files: visage_*.deb
draft: false
prerelease: ${{ steps.version.outputs.prerelease }}
clippy-latest:
# Non-blocking early warning for toolchain drift.
#
# The jobs above are pinned (rust-toolchain.toml), so a new clippy release
# can no longer halt the repository the way it did on 2026-08-24 — identical
# commit, green on 08-18, red on 08-24, purely because @stable floated.
#
# Pinning alone would trade that failure for a slower one: lints would
# accumulate unseen until someone bumped the pin. This job keeps the early
# warning without the blocking property. `continue-on-error` means it cannot
# fail the workflow, and it is not in the required status checks, so a red
# result here is information rather than a gate.
runs-on: ubuntu-24.04
continue-on-error: true
steps:
- uses: actions/checkout@v7
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libpam0g-dev libdbus-1-dev
- name: Install current stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Report the toolchain being tested
run: cargo clippy --version
- name: Clippy on current stable
run: cargo clippy --workspace --all-targets -- -D warnings
msrv:
# Verifies the MSRV we PUBLISH is true.
#
# `Cargo.toml` declared rust-version = "1.75" until 2026-08-24. That was not
# stale, it was false: `ort` and `image` both require 1.88, and 59 packages
# in the resolved graph require more than 1.75. The crate could not build on
# the version it advertised, and anyone who trusted the field got a failure
# deep inside a dependency rather than a clear "your toolchain is too old".
#
# Nothing checked it. That is the fifth instance in this repository of a
# claim in one artifact that nothing in another artifact enforces — see also
# the release trigger (#75), the network-isolation claim (#78), and
# TimeoutStopSec. This job closes it for the MSRV.
#
# The version is read from Cargo.toml, so the manifest stays the single
# source of truth and this job cannot drift from it.
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libpam0g-dev libdbus-1-dev
- name: Read the declared MSRV
id: msrv
run: |
set -euo pipefail
msrv="$(grep '^rust-version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')"
# Refuse rather than hand the action an empty string it would resolve
# to something else — the same failure shape as the release trigger.
if [ -z "$msrv" ]; then
echo "::error::no rust-version found in Cargo.toml — nothing to verify"
exit 1
fi
echo "verifying the published MSRV: ${msrv}"
echo "version=${msrv}" >> "$GITHUB_OUTPUT"
- name: Install the declared MSRV toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.msrv.outputs.version }}
- name: Build at the declared MSRV
run: cargo check --workspace --all-targets --locked