2026-09-10 13:10:56 -04:00
|
|
|
name: ci
|
|
|
|
|
|
|
|
|
|
# Tests and clippy run on the Pi runner (aarch64) inside a rust container, so
|
|
|
|
|
# this CI proves the aarch64 build too. Jobs use the runner's `docker` label.
|
2026-09-12 01:39:41 -04:00
|
|
|
#
|
|
|
|
|
# Path allowlist: skip the cargo job when the change cannot affect the Rust
|
|
|
|
|
# build (docs, android, scripts, sibling workflows, markdown). No required
|
|
|
|
|
# status checks on main, so a missing run is not a merge trap.
|
|
|
|
|
# workflow_dispatch has no path filter — it always runs the suite.
|
ci: skip superseded runs, move fuzz to nightly, trim the android PR trigger
Three sources of wasted Pi time, measured over a two-week window
(353 workflow runs, 694 job runs): ~78% of CI wall-clock was spent on
work that did not need to happen.
1. Nothing was ever cancelled. Every `concurrency:` block in the repo
had `cancel-in-progress: false`, and 279 of 353 runs sat in the
queue behind a newer commit on the same branch. The comment
justifying it ("shared the container name `onionwire-ci`") was
stale — the name has been per-run-id for a while — but the real
constraint is the shared cargo target volume, which two concurrent
writers corrupt (`Permission denied (os error 13)` on
/target/debug/deps). So the flag stays false and superseded runs
instead stand down at a new gate: compare GITHUB_SHA against the
remote branch tip and skip. Seconds, not minutes, and it cannot
release the concurrency group into a volume race. Added to
ci.yml (test, sdk) and android-ci.yml (android).
Verified against the run history: Forgejo's pull_request GITHUB_SHA
is the branch head, never a synthetic merge commit (245/245 recorded
PR runs match a refs/pull/*/head tip), so the gate cannot skip a
live run. It fails open — an unresolvable ref runs the job. 232 of
477 historical PR runs would have been skipped.
2. `fuzz` ran on almost every push. A job cannot narrow a
workflow-level path filter, so `fuzz/**` sat in ci.yml's list
beside `src/**` and `crates/**`: 80 of 84 recorded runs touched
nothing in fuzz/, each paying a nightly toolchain install and
`cargo install cargo-fuzz` for 15 seconds of actual fuzzing. Moved
to its own workflow, schedule-only (03:30 UTC, off the arti-watch
slot) plus workflow_dispatch. The build/run single-container fix
and the PATH export from #106/#107 come along unchanged.
3. android-ci built a full APK for commits that touched no android/
file — 95 of 143 runs, at ~11 minutes each. The PR trigger now
covers android/**, crates/onionwire-sdk/**, Cargo.toml, Cargo.lock
and the build script. The push-to-main trigger keeps src/** and
crates/**, so every merge still runs the in-APK checks that earn
their keep (the target_max_memory marker gate, the .so listing, the
sha256 round-trip) — a Rust-only PR now finds out at merge instead
of before it, and nothing reaches a release untested.
Also drops `fetch-depth: 0` from android-ci: nothing in the build
reads git history (PUBLISH_TAG comes from the environment).
ci.yml's `push: [main]` trigger is unchanged. It re-tests trees a PR
already tested identically (73 job runs in the window), but branch
protection is empty, so it is not a merge gate — it is the "CI green
on main" signal docs/RELEASING.md's readiness gate reads, and a merge
commit has a different sha so statuses do not carry over. The
staleness gate already removes most of its cost.
docs/RELEASING.md describes all of the above; its android-ci path
list and its fuzz-job account were both wrong after this change.
2026-09-27 15:34:58 -04:00
|
|
|
#
|
|
|
|
|
# The nightly cargo-fuzz job used to be a third job here. It had its own
|
|
|
|
|
# workflow (`.forgejo/workflows/fuzz.yml`, `schedule` only) because a job
|
|
|
|
|
# cannot narrow a workflow-level path filter: `fuzz/**` sat in the list
|
|
|
|
|
# alongside `src/**` and `crates/**`, so 80 of 84 recorded fuzz runs touched
|
|
|
|
|
# nothing in `fuzz/`.
|
2026-09-10 13:10:56 -04:00
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
branches: [main]
|
2026-09-12 01:39:41 -04:00
|
|
|
paths:
|
|
|
|
|
- "src/**"
|
|
|
|
|
- "crates/**"
|
|
|
|
|
- "tests/**"
|
|
|
|
|
- "Cargo.toml"
|
|
|
|
|
- "Cargo.lock"
|
|
|
|
|
- ".forgejo/workflows/ci.yml"
|
2026-09-10 13:10:56 -04:00
|
|
|
pull_request:
|
2026-09-12 01:39:41 -04:00
|
|
|
paths:
|
|
|
|
|
- "src/**"
|
|
|
|
|
- "crates/**"
|
|
|
|
|
- "tests/**"
|
|
|
|
|
- "Cargo.toml"
|
|
|
|
|
- "Cargo.lock"
|
|
|
|
|
- ".forgejo/workflows/ci.yml"
|
2026-09-10 13:10:56 -04:00
|
|
|
workflow_dispatch:
|
|
|
|
|
|
ci: skip superseded runs, move fuzz to nightly, trim the android PR trigger
Three sources of wasted Pi time, measured over a two-week window
(353 workflow runs, 694 job runs): ~78% of CI wall-clock was spent on
work that did not need to happen.
1. Nothing was ever cancelled. Every `concurrency:` block in the repo
had `cancel-in-progress: false`, and 279 of 353 runs sat in the
queue behind a newer commit on the same branch. The comment
justifying it ("shared the container name `onionwire-ci`") was
stale — the name has been per-run-id for a while — but the real
constraint is the shared cargo target volume, which two concurrent
writers corrupt (`Permission denied (os error 13)` on
/target/debug/deps). So the flag stays false and superseded runs
instead stand down at a new gate: compare GITHUB_SHA against the
remote branch tip and skip. Seconds, not minutes, and it cannot
release the concurrency group into a volume race. Added to
ci.yml (test, sdk) and android-ci.yml (android).
Verified against the run history: Forgejo's pull_request GITHUB_SHA
is the branch head, never a synthetic merge commit (245/245 recorded
PR runs match a refs/pull/*/head tip), so the gate cannot skip a
live run. It fails open — an unresolvable ref runs the job. 232 of
477 historical PR runs would have been skipped.
2. `fuzz` ran on almost every push. A job cannot narrow a
workflow-level path filter, so `fuzz/**` sat in ci.yml's list
beside `src/**` and `crates/**`: 80 of 84 recorded runs touched
nothing in fuzz/, each paying a nightly toolchain install and
`cargo install cargo-fuzz` for 15 seconds of actual fuzzing. Moved
to its own workflow, schedule-only (03:30 UTC, off the arti-watch
slot) plus workflow_dispatch. The build/run single-container fix
and the PATH export from #106/#107 come along unchanged.
3. android-ci built a full APK for commits that touched no android/
file — 95 of 143 runs, at ~11 minutes each. The PR trigger now
covers android/**, crates/onionwire-sdk/**, Cargo.toml, Cargo.lock
and the build script. The push-to-main trigger keeps src/** and
crates/**, so every merge still runs the in-APK checks that earn
their keep (the target_max_memory marker gate, the .so listing, the
sha256 round-trip) — a Rust-only PR now finds out at merge instead
of before it, and nothing reaches a release untested.
Also drops `fetch-depth: 0` from android-ci: nothing in the build
reads git history (PUBLISH_TAG comes from the environment).
ci.yml's `push: [main]` trigger is unchanged. It re-tests trees a PR
already tested identically (73 job runs in the window), but branch
protection is empty, so it is not a merge gate — it is the "CI green
on main" signal docs/RELEASING.md's readiness gate reads, and a merge
commit has a different sha so statuses do not carry over. The
staleness gate already removes most of its cost.
docs/RELEASING.md describes all of the above; its android-ci path
list and its fuzz-job account were both wrong after this change.
2026-09-27 15:34:58 -04:00
|
|
|
# One cargo job on the Pi at a time. Overlapping runs share the
|
|
|
|
|
# `onionwire-cargo-registry` and `onionwire-target-ci` volumes, and two
|
|
|
|
|
# writers to one cargo target dir produce `Permission denied (os error 13)`
|
|
|
|
|
# on /target/debug/deps binaries. The per-run container name (below) is no
|
|
|
|
|
# longer shared, so the docker Conflict is gone — but the volume race is not,
|
|
|
|
|
# and the serialization is what prevents it.
|
|
|
|
|
#
|
|
|
|
|
# `cancel-in-progress` stays false: cancelling a *queued* run would release
|
|
|
|
|
# this group and let the next run start a second cargo job against the same
|
|
|
|
|
# volume. Superseded runs are instead skipped by the staleness gate at the
|
|
|
|
|
# top of each job, which costs seconds instead of the minutes a full build
|
|
|
|
|
# spends proving something nobody will look at.
|
2026-09-10 20:12:41 -04:00
|
|
|
concurrency:
|
|
|
|
|
group: onionwire-ci-pi
|
|
|
|
|
cancel-in-progress: false
|
|
|
|
|
|
2026-09-10 13:10:56 -04:00
|
|
|
env:
|
|
|
|
|
CARGO_TERM_COLOR: never
|
2026-09-10 13:14:55 -04:00
|
|
|
RUST_IMAGE: rust:1.91-bookworm
|
2026-09-10 13:10:56 -04:00
|
|
|
CARGO_REGISTRY_VOLUME: onionwire-cargo-registry
|
|
|
|
|
CARGO_TARGET_VOLUME: onionwire-target-ci
|
2026-09-10 20:12:41 -04:00
|
|
|
BUILD_CONTAINER: onionwire-ci-${{ github.run_id }}
|
2026-09-17 20:48:05 -04:00
|
|
|
# The SDK job gets its own target volume: `crates/onionwire-sdk` is a
|
|
|
|
|
# separate cargo workspace with its own lockfile and its own crate set, so
|
|
|
|
|
# sharing a target dir with the root job would thrash both.
|
2026-09-12 18:16:21 -04:00
|
|
|
SDK_CARGO_TARGET_VOLUME: onionwire-target-ci-sdk
|
|
|
|
|
SDK_BUILD_CONTAINER: onionwire-ci-sdk-${{ github.run_id }}
|
2026-09-10 13:10:56 -04:00
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
test:
|
|
|
|
|
runs-on: docker
|
|
|
|
|
timeout-minutes: 120
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout
|
|
|
|
|
uses: https://code.forgejo.org/actions/checkout@v4
|
|
|
|
|
|
ci: skip superseded runs, move fuzz to nightly, trim the android PR trigger
Three sources of wasted Pi time, measured over a two-week window
(353 workflow runs, 694 job runs): ~78% of CI wall-clock was spent on
work that did not need to happen.
1. Nothing was ever cancelled. Every `concurrency:` block in the repo
had `cancel-in-progress: false`, and 279 of 353 runs sat in the
queue behind a newer commit on the same branch. The comment
justifying it ("shared the container name `onionwire-ci`") was
stale — the name has been per-run-id for a while — but the real
constraint is the shared cargo target volume, which two concurrent
writers corrupt (`Permission denied (os error 13)` on
/target/debug/deps). So the flag stays false and superseded runs
instead stand down at a new gate: compare GITHUB_SHA against the
remote branch tip and skip. Seconds, not minutes, and it cannot
release the concurrency group into a volume race. Added to
ci.yml (test, sdk) and android-ci.yml (android).
Verified against the run history: Forgejo's pull_request GITHUB_SHA
is the branch head, never a synthetic merge commit (245/245 recorded
PR runs match a refs/pull/*/head tip), so the gate cannot skip a
live run. It fails open — an unresolvable ref runs the job. 232 of
477 historical PR runs would have been skipped.
2. `fuzz` ran on almost every push. A job cannot narrow a
workflow-level path filter, so `fuzz/**` sat in ci.yml's list
beside `src/**` and `crates/**`: 80 of 84 recorded runs touched
nothing in fuzz/, each paying a nightly toolchain install and
`cargo install cargo-fuzz` for 15 seconds of actual fuzzing. Moved
to its own workflow, schedule-only (03:30 UTC, off the arti-watch
slot) plus workflow_dispatch. The build/run single-container fix
and the PATH export from #106/#107 come along unchanged.
3. android-ci built a full APK for commits that touched no android/
file — 95 of 143 runs, at ~11 minutes each. The PR trigger now
covers android/**, crates/onionwire-sdk/**, Cargo.toml, Cargo.lock
and the build script. The push-to-main trigger keeps src/** and
crates/**, so every merge still runs the in-APK checks that earn
their keep (the target_max_memory marker gate, the .so listing, the
sha256 round-trip) — a Rust-only PR now finds out at merge instead
of before it, and nothing reaches a release untested.
Also drops `fetch-depth: 0` from android-ci: nothing in the build
reads git history (PUBLISH_TAG comes from the environment).
ci.yml's `push: [main]` trigger is unchanged. It re-tests trees a PR
already tested identically (73 job runs in the window), but branch
protection is empty, so it is not a merge gate — it is the "CI green
on main" signal docs/RELEASING.md's readiness gate reads, and a merge
commit has a different sha so statuses do not carry over. The
staleness gate already removes most of its cost.
docs/RELEASING.md describes all of the above; its android-ci path
list and its fuzz-job account were both wrong after this change.
2026-09-27 15:34:58 -04:00
|
|
|
- name: Skip superseded run
|
|
|
|
|
id: staleness
|
|
|
|
|
run: |
|
|
|
|
|
set -uo pipefail
|
|
|
|
|
# A force-push, or a merge of another PR, can put a newer commit on
|
|
|
|
|
# this branch while this run sits in the concurrency queue above.
|
|
|
|
|
# Testing it then proves nothing about the tree that is actually on
|
|
|
|
|
# the branch. 279 of 353 runs in a two-week window were on an
|
|
|
|
|
# already-superseded sha — the single largest source of wasted Pi
|
|
|
|
|
# time, and `cancel-in-progress: true` cannot fix it without letting
|
|
|
|
|
# two cargo jobs share the target volume.
|
|
|
|
|
#
|
|
|
|
|
# For a pull_request, GITHUB_HEAD_REF is the PR's source branch (the
|
|
|
|
|
# ref itself is refs/pull/N/merge); for a push it is empty, so fall
|
|
|
|
|
# back to GITHUB_REF_NAME.
|
|
|
|
|
ref="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME:-}}"
|
|
|
|
|
remote=""
|
|
|
|
|
if [ -n "$ref" ]; then
|
|
|
|
|
remote="$(git ls-remote origin "refs/heads/$ref" 2>/dev/null | cut -f1)"
|
|
|
|
|
fi
|
|
|
|
|
if [ -n "$remote" ] && [ "$remote" != "$GITHUB_SHA" ]; then
|
|
|
|
|
echo "::notice::superseded: refs/heads/$ref is at ${remote:0:12}, this run is ${GITHUB_SHA:0:12} — skipping"
|
|
|
|
|
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
|
|
|
else
|
|
|
|
|
echo "tip=${remote:-unknown} sha=${GITHUB_SHA} ref=${ref:-none} — running"
|
|
|
|
|
echo "skip=false" >> "$GITHUB_OUTPUT"
|
|
|
|
|
fi
|
|
|
|
|
|
2026-09-10 13:10:56 -04:00
|
|
|
- name: cargo test + clippy on aarch64
|
ci: skip superseded runs, move fuzz to nightly, trim the android PR trigger
Three sources of wasted Pi time, measured over a two-week window
(353 workflow runs, 694 job runs): ~78% of CI wall-clock was spent on
work that did not need to happen.
1. Nothing was ever cancelled. Every `concurrency:` block in the repo
had `cancel-in-progress: false`, and 279 of 353 runs sat in the
queue behind a newer commit on the same branch. The comment
justifying it ("shared the container name `onionwire-ci`") was
stale — the name has been per-run-id for a while — but the real
constraint is the shared cargo target volume, which two concurrent
writers corrupt (`Permission denied (os error 13)` on
/target/debug/deps). So the flag stays false and superseded runs
instead stand down at a new gate: compare GITHUB_SHA against the
remote branch tip and skip. Seconds, not minutes, and it cannot
release the concurrency group into a volume race. Added to
ci.yml (test, sdk) and android-ci.yml (android).
Verified against the run history: Forgejo's pull_request GITHUB_SHA
is the branch head, never a synthetic merge commit (245/245 recorded
PR runs match a refs/pull/*/head tip), so the gate cannot skip a
live run. It fails open — an unresolvable ref runs the job. 232 of
477 historical PR runs would have been skipped.
2. `fuzz` ran on almost every push. A job cannot narrow a
workflow-level path filter, so `fuzz/**` sat in ci.yml's list
beside `src/**` and `crates/**`: 80 of 84 recorded runs touched
nothing in fuzz/, each paying a nightly toolchain install and
`cargo install cargo-fuzz` for 15 seconds of actual fuzzing. Moved
to its own workflow, schedule-only (03:30 UTC, off the arti-watch
slot) plus workflow_dispatch. The build/run single-container fix
and the PATH export from #106/#107 come along unchanged.
3. android-ci built a full APK for commits that touched no android/
file — 95 of 143 runs, at ~11 minutes each. The PR trigger now
covers android/**, crates/onionwire-sdk/**, Cargo.toml, Cargo.lock
and the build script. The push-to-main trigger keeps src/** and
crates/**, so every merge still runs the in-APK checks that earn
their keep (the target_max_memory marker gate, the .so listing, the
sha256 round-trip) — a Rust-only PR now finds out at merge instead
of before it, and nothing reaches a release untested.
Also drops `fetch-depth: 0` from android-ci: nothing in the build
reads git history (PUBLISH_TAG comes from the environment).
ci.yml's `push: [main]` trigger is unchanged. It re-tests trees a PR
already tested identically (73 job runs in the window), but branch
protection is empty, so it is not a merge gate — it is the "CI green
on main" signal docs/RELEASING.md's readiness gate reads, and a merge
commit has a different sha so statuses do not carry over. The
staleness gate already removes most of its cost.
docs/RELEASING.md describes all of the above; its android-ci path
list and its fuzz-job account were both wrong after this change.
2026-09-27 15:34:58 -04:00
|
|
|
if: steps.staleness.outputs.skip != 'true'
|
2026-09-10 13:10:56 -04:00
|
|
|
run: |
|
|
|
|
|
set -euo pipefail
|
2026-09-10 13:50:57 -04:00
|
|
|
cd "${GITHUB_WORKSPACE}"
|
|
|
|
|
echo "workspace: $GITHUB_WORKSPACE"
|
2026-09-10 13:10:56 -04:00
|
|
|
docker volume create "$CARGO_REGISTRY_VOLUME" > /dev/null
|
|
|
|
|
docker volume create "$CARGO_TARGET_VOLUME" > /dev/null
|
|
|
|
|
docker rm -f "$BUILD_CONTAINER" > /dev/null 2>&1 || true
|
|
|
|
|
docker create --name "$BUILD_CONTAINER" -i \
|
|
|
|
|
-e CARGO_TARGET_DIR=/target \
|
|
|
|
|
-e CARGO_BUILD_JOBS=2 \
|
|
|
|
|
-e CARGO_TERM_COLOR=never \
|
2026-09-17 20:57:50 -04:00
|
|
|
-e TMPDIR=/target/tmp \
|
2026-09-10 13:10:56 -04:00
|
|
|
-v "$CARGO_REGISTRY_VOLUME":/usr/local/cargo/registry \
|
|
|
|
|
-v "$CARGO_TARGET_VOLUME":/target \
|
|
|
|
|
-w /src \
|
|
|
|
|
"$RUST_IMAGE" \
|
2026-09-17 22:16:25 -04:00
|
|
|
sh -euxc 'mkdir -p /src /target/tmp && tar xzf - -C /src && cd /src \
|
2026-09-10 13:24:59 -04:00
|
|
|
&& rustup component add clippy \
|
2026-09-10 13:10:56 -04:00
|
|
|
&& cargo test --locked \
|
|
|
|
|
&& cargo clippy --locked --all-targets -- -D warnings'
|
|
|
|
|
tar czf - --exclude=./target --exclude=./.git --exclude=./.worktrees . \
|
|
|
|
|
| docker start -a -i "$BUILD_CONTAINER"
|
|
|
|
|
docker rm -f "$BUILD_CONTAINER" > /dev/null
|
2026-09-12 18:16:21 -04:00
|
|
|
|
|
|
|
|
# `crates/onionwire-sdk` is a SEPARATE cargo workspace: its own Cargo.lock and
|
2026-09-17 20:48:05 -04:00
|
|
|
# a path dependency on the root crate. The `test` job above therefore never
|
|
|
|
|
# compiles it, so a root-crate signature change (`Node::send` gaining the
|
|
|
|
|
# outbox result, the SQLCipher passphrase entry points) breaks the Android SDK
|
|
|
|
|
# — and the tagged release AAR, since android-release.yml only builds on
|
|
|
|
|
# `v*.*.*` — while both the root suites and local `cargo test` stay green.
|
|
|
|
|
# Build it here.
|
|
|
|
|
#
|
|
|
|
|
# The root `test` job no longer installs `pkg-config`/`libssl-dev` — the root
|
|
|
|
|
# crate defaults to Arti's rustls backend, so TLS needs no system OpenSSL.
|
|
|
|
|
# The `rusqlite` `bundled-sqlcipher-vendored-openssl` feature that both jobs
|
|
|
|
|
# use compiles OpenSSL from source, which needs `perl` and `make` (present in
|
|
|
|
|
# the `rust:*-bookworm` image), not the `-dev` headers. This job keeps the
|
|
|
|
|
# install: the Android SDK build is unchanged by the root crate's TLS default.
|
2026-09-12 18:16:21 -04:00
|
|
|
sdk:
|
|
|
|
|
runs-on: docker
|
|
|
|
|
timeout-minutes: 120
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout
|
|
|
|
|
uses: https://code.forgejo.org/actions/checkout@v4
|
|
|
|
|
|
ci: skip superseded runs, move fuzz to nightly, trim the android PR trigger
Three sources of wasted Pi time, measured over a two-week window
(353 workflow runs, 694 job runs): ~78% of CI wall-clock was spent on
work that did not need to happen.
1. Nothing was ever cancelled. Every `concurrency:` block in the repo
had `cancel-in-progress: false`, and 279 of 353 runs sat in the
queue behind a newer commit on the same branch. The comment
justifying it ("shared the container name `onionwire-ci`") was
stale — the name has been per-run-id for a while — but the real
constraint is the shared cargo target volume, which two concurrent
writers corrupt (`Permission denied (os error 13)` on
/target/debug/deps). So the flag stays false and superseded runs
instead stand down at a new gate: compare GITHUB_SHA against the
remote branch tip and skip. Seconds, not minutes, and it cannot
release the concurrency group into a volume race. Added to
ci.yml (test, sdk) and android-ci.yml (android).
Verified against the run history: Forgejo's pull_request GITHUB_SHA
is the branch head, never a synthetic merge commit (245/245 recorded
PR runs match a refs/pull/*/head tip), so the gate cannot skip a
live run. It fails open — an unresolvable ref runs the job. 232 of
477 historical PR runs would have been skipped.
2. `fuzz` ran on almost every push. A job cannot narrow a
workflow-level path filter, so `fuzz/**` sat in ci.yml's list
beside `src/**` and `crates/**`: 80 of 84 recorded runs touched
nothing in fuzz/, each paying a nightly toolchain install and
`cargo install cargo-fuzz` for 15 seconds of actual fuzzing. Moved
to its own workflow, schedule-only (03:30 UTC, off the arti-watch
slot) plus workflow_dispatch. The build/run single-container fix
and the PATH export from #106/#107 come along unchanged.
3. android-ci built a full APK for commits that touched no android/
file — 95 of 143 runs, at ~11 minutes each. The PR trigger now
covers android/**, crates/onionwire-sdk/**, Cargo.toml, Cargo.lock
and the build script. The push-to-main trigger keeps src/** and
crates/**, so every merge still runs the in-APK checks that earn
their keep (the target_max_memory marker gate, the .so listing, the
sha256 round-trip) — a Rust-only PR now finds out at merge instead
of before it, and nothing reaches a release untested.
Also drops `fetch-depth: 0` from android-ci: nothing in the build
reads git history (PUBLISH_TAG comes from the environment).
ci.yml's `push: [main]` trigger is unchanged. It re-tests trees a PR
already tested identically (73 job runs in the window), but branch
protection is empty, so it is not a merge gate — it is the "CI green
on main" signal docs/RELEASING.md's readiness gate reads, and a merge
commit has a different sha so statuses do not carry over. The
staleness gate already removes most of its cost.
docs/RELEASING.md describes all of the above; its android-ci path
list and its fuzz-job account were both wrong after this change.
2026-09-27 15:34:58 -04:00
|
|
|
- name: Skip superseded run
|
|
|
|
|
id: staleness
|
|
|
|
|
run: |
|
|
|
|
|
set -uo pipefail
|
|
|
|
|
# Same gate as the `test` job above — see the comment there.
|
|
|
|
|
ref="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME:-}}"
|
|
|
|
|
remote=""
|
|
|
|
|
if [ -n "$ref" ]; then
|
|
|
|
|
remote="$(git ls-remote origin "refs/heads/$ref" 2>/dev/null | cut -f1)"
|
|
|
|
|
fi
|
|
|
|
|
if [ -n "$remote" ] && [ "$remote" != "$GITHUB_SHA" ]; then
|
|
|
|
|
echo "::notice::superseded: refs/heads/$ref is at ${remote:0:12}, this run is ${GITHUB_SHA:0:12} — skipping"
|
|
|
|
|
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
|
|
|
else
|
|
|
|
|
echo "tip=${remote:-unknown} sha=${GITHUB_SHA} ref=${ref:-none} — running"
|
|
|
|
|
echo "skip=false" >> "$GITHUB_OUTPUT"
|
|
|
|
|
fi
|
|
|
|
|
|
2026-09-12 18:16:21 -04:00
|
|
|
- name: cargo test + clippy for crates/onionwire-sdk on aarch64
|
ci: skip superseded runs, move fuzz to nightly, trim the android PR trigger
Three sources of wasted Pi time, measured over a two-week window
(353 workflow runs, 694 job runs): ~78% of CI wall-clock was spent on
work that did not need to happen.
1. Nothing was ever cancelled. Every `concurrency:` block in the repo
had `cancel-in-progress: false`, and 279 of 353 runs sat in the
queue behind a newer commit on the same branch. The comment
justifying it ("shared the container name `onionwire-ci`") was
stale — the name has been per-run-id for a while — but the real
constraint is the shared cargo target volume, which two concurrent
writers corrupt (`Permission denied (os error 13)` on
/target/debug/deps). So the flag stays false and superseded runs
instead stand down at a new gate: compare GITHUB_SHA against the
remote branch tip and skip. Seconds, not minutes, and it cannot
release the concurrency group into a volume race. Added to
ci.yml (test, sdk) and android-ci.yml (android).
Verified against the run history: Forgejo's pull_request GITHUB_SHA
is the branch head, never a synthetic merge commit (245/245 recorded
PR runs match a refs/pull/*/head tip), so the gate cannot skip a
live run. It fails open — an unresolvable ref runs the job. 232 of
477 historical PR runs would have been skipped.
2. `fuzz` ran on almost every push. A job cannot narrow a
workflow-level path filter, so `fuzz/**` sat in ci.yml's list
beside `src/**` and `crates/**`: 80 of 84 recorded runs touched
nothing in fuzz/, each paying a nightly toolchain install and
`cargo install cargo-fuzz` for 15 seconds of actual fuzzing. Moved
to its own workflow, schedule-only (03:30 UTC, off the arti-watch
slot) plus workflow_dispatch. The build/run single-container fix
and the PATH export from #106/#107 come along unchanged.
3. android-ci built a full APK for commits that touched no android/
file — 95 of 143 runs, at ~11 minutes each. The PR trigger now
covers android/**, crates/onionwire-sdk/**, Cargo.toml, Cargo.lock
and the build script. The push-to-main trigger keeps src/** and
crates/**, so every merge still runs the in-APK checks that earn
their keep (the target_max_memory marker gate, the .so listing, the
sha256 round-trip) — a Rust-only PR now finds out at merge instead
of before it, and nothing reaches a release untested.
Also drops `fetch-depth: 0` from android-ci: nothing in the build
reads git history (PUBLISH_TAG comes from the environment).
ci.yml's `push: [main]` trigger is unchanged. It re-tests trees a PR
already tested identically (73 job runs in the window), but branch
protection is empty, so it is not a merge gate — it is the "CI green
on main" signal docs/RELEASING.md's readiness gate reads, and a merge
commit has a different sha so statuses do not carry over. The
staleness gate already removes most of its cost.
docs/RELEASING.md describes all of the above; its android-ci path
list and its fuzz-job account were both wrong after this change.
2026-09-27 15:34:58 -04:00
|
|
|
if: steps.staleness.outputs.skip != 'true'
|
2026-09-12 18:16:21 -04:00
|
|
|
run: |
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
cd "${GITHUB_WORKSPACE}"
|
|
|
|
|
echo "workspace: $GITHUB_WORKSPACE"
|
|
|
|
|
docker volume create "$CARGO_REGISTRY_VOLUME" > /dev/null
|
|
|
|
|
docker volume create "$SDK_CARGO_TARGET_VOLUME" > /dev/null
|
|
|
|
|
docker rm -f "$SDK_BUILD_CONTAINER" > /dev/null 2>&1 || true
|
|
|
|
|
docker create --name "$SDK_BUILD_CONTAINER" -i \
|
|
|
|
|
-e CARGO_TARGET_DIR=/target \
|
|
|
|
|
-e CARGO_BUILD_JOBS=2 \
|
|
|
|
|
-e CARGO_TERM_COLOR=never \
|
2026-09-17 20:57:50 -04:00
|
|
|
-e TMPDIR=/target/tmp \
|
2026-09-12 18:16:21 -04:00
|
|
|
-v "$CARGO_REGISTRY_VOLUME":/usr/local/cargo/registry \
|
|
|
|
|
-v "$SDK_CARGO_TARGET_VOLUME":/target \
|
|
|
|
|
-w /src \
|
|
|
|
|
"$RUST_IMAGE" \
|
2026-09-17 22:16:25 -04:00
|
|
|
sh -euxc 'mkdir -p /src /target/tmp && tar xzf - -C /src && cd /src/crates/onionwire-sdk \
|
2026-09-12 18:16:21 -04:00
|
|
|
&& apt-get update \
|
|
|
|
|
&& apt-get install -y --no-install-recommends pkg-config libssl-dev \
|
|
|
|
|
&& rustup component add clippy \
|
|
|
|
|
&& cargo test --locked \
|
|
|
|
|
&& cargo clippy --locked --all-targets -- -D warnings'
|
|
|
|
|
tar czf - --exclude=./target --exclude=./.git --exclude=./.worktrees \
|
|
|
|
|
--exclude=./crates/onionwire-sdk/target . \
|
|
|
|
|
| docker start -a -i "$SDK_BUILD_CONTAINER"
|
|
|
|
|
docker rm -f "$SDK_BUILD_CONTAINER" > /dev/null
|