Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions .github/workflows/actions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ workflows:
- 'actions/deploy-pages@v5.0.1'
- 'actions/upload-pages-artifact@v5.0.0'
- 'haskell-actions/setup@v2.12.1'
'.github/workflows/codeql.yml':
- 'metadatastician/standards@a797d308c0517d4e2d21cc7f1cb08d41f82b1a12'
'.github/workflows/ci.yml':
- 'actions/checkout@v7.0.1'
'.github/workflows/dashboard-check.yml':
- 'actions/checkout@v7.0.1'
- 'dtolnay/rust-toolchain@v1'
Expand All @@ -29,20 +29,10 @@ workflows:
- 'actions/checkout@v7.0.1'
- 'dtolnay/rust-toolchain@v1'
- 'swatinem/rust-cache@v2.9.3'
'.github/workflows/governance.yml':
- 'metadatastician/standards@a797d308c0517d4e2d21cc7f1cb08d41f82b1a12'
'.github/workflows/hypatia-scan.yml':
- 'metadatastician/standards@a797d308c0517d4e2d21cc7f1cb08d41f82b1a12'
'.github/workflows/idris-abi.yml':
- 'actions/checkout@v7.0.1'
'.github/workflows/label-triage.yml': []
'.github/workflows/labels.yml': []
'.github/workflows/mirror.yml':
- 'metadatastician/standards@a797d308c0517d4e2d21cc7f1cb08d41f82b1a12'
'.github/workflows/rust-ci.yml':
- 'metadatastician/standards@a797d308c0517d4e2d21cc7f1cb08d41f82b1a12'
'.github/workflows/scorecard.yml':
- 'metadatastician/standards@a797d308c0517d4e2d21cc7f1cb08d41f82b1a12'
'.github/workflows/secret-scanner.yml':
- 'metadatastician/standards@a797d308c0517d4e2d21cc7f1cb08d41f82b1a12'
'.github/workflows/squabble.yml':
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/agda-proofs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ name: Agda proofs
# Checks verification/proofs/agda/Reversibility.agda under the kernel flags
# and refuses the fixtures under tests/reject-agda. Local run: just test-agda.
on:
push:
branches: [main]
pull_request:
# Called from ci.yml, whose `CI/gate` aggregates it; no triggers of its own.
workflow_call:
permissions:
contents: read
jobs:
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# SPDX-License-Identifier: MPL-2.0
# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell
name: CI
# One entry point for the checks the `main` ruleset requires. `needs:` only
# works inside a single workflow, so the gated workflows (agda-proofs.yml,
# rust-ci.yml, dashboard-check.yml) are reusable (`on: workflow_call`) and are
# called from here. They have no push/pull_request triggers of their own, so
# nothing runs twice. `gate` is the required status check `CI/gate`: it passes
# only if every called workflow ended `success` (scripts/ci-gate.sh). A new
# gated workflow must be called here AND listed in the gate's `needs:`;
# tests/workflows/ci_gate_test.sh fails if it is not.
on:
push:
branches: [main, master]
pull_request:
permissions:
contents: read
jobs:
agda-proofs:
uses: ./.github/workflows/agda-proofs.yml
permissions:
contents: read
rust-ci:
# Called directly, not through rust-ci.yml: the suite reads the pin back
# from the top-level workflow file (this one). See rust-ci.yml's header.
# Keep this SHA identical to the one in rust-ci.yml. Its jobs ask for
# contents: read only; granting less is a startup_failure.
permissions:
contents: read
uses: hyperpolymath/proven-cicd-and-workflows/.github/workflows/rust-ci.yml@9eb0bbf9bd80b7964ce5b9957e75821b3cd4a55b # cicd-suite main
dashboard-check:
uses: ./.github/workflows/dashboard-check.yml
permissions:
actions: read
contents: read
gate:
name: CI/gate
needs: [agda-proofs, rust-ci, dashboard-check]
if: ${{ always() }}
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
# The gate's own regression test: a job missing from `needs:`, or a
# called workflow that regains its own trigger, fails the gate here.
- name: Gate regression test
run: bash tests/workflows/ci_gate_test.sh
- name: All required jobs succeeded
env:
NEEDS_JSON: ${{ toJSON(needs) }}
run: bash scripts/ci-gate.sh
Comment thread
hyperpolymath marked this conversation as resolved.
Resolved
6 changes: 2 additions & 4 deletions .github/workflows/dashboard-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
name: Dashboard Check

on:
pull_request:
branches: ['**']
push:
branches: [main, master]
# Called from ci.yml, whose `CI/gate` aggregates it; no triggers of its own.
workflow_call:

permissions:
actions: read
Expand Down
38 changes: 21 additions & 17 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
# This workflow is managed by gh actions-lock.
# SPDX-License-Identifier: MPL-2.0
# This workflow is managed by gh actions-lock.
# Rust CI — thin wrapper calling the shared estate reusable in
# hyperpolymath/standards. Configure once, propagate everywhere.
# See: docs/CI-REUSABLE-WORKFLOWS.adoc in standards.
# Rust CI — thin caller of the estate's strict Rust gate in
# hyperpolymath/proven-cicd-and-workflows (rust-ci.yml, a reusable workflow).
# This repository cannot call reusables owned by metadatastician (every such
# run ended startup_failure), so the previous call to
# metadatastician/standards rust-ci-reusable.yml is replaced.
#
# Weekly only: pull_request and push runs come from ci.yml, whose `rust-ci`
# job holds the same pin. The suite's gate scripts are selected by reading the
# TOP-LEVEL workflow file's `uses:` line back (GITHUB_WORKFLOW_REF), which is
# ci.yml under a ci.yml call, so a nested call through this file could not be
# verified and ci.yml calls the suite directly. Keep the two pins identical.
#
# The weekly run still catches a new RustSec advisory against an unchanged
# Cargo.lock. The old `enable_audit: true` (cargo audit) is replaced by the
# suite's `deny` job (cargo-deny: advisories, bans, sources); the suite's
# `enable_audit` input is a documented no-op.
#
# De-onboarded from actions.lock on purpose, as the suite's caller template
# requires: an onboarded cross-repository reusable startup-fails with zero
# jobs under sha_pinning_required. No `secrets:`: the reusable consumes none.
name: Rust CI

on:
push:
branches: [main, master]
pull_request:
# Weekly, so a new RustSec advisory against an unchanged Cargo.lock is still
# caught (the scheduled cargo-audit.yml was folded into this workflow).
schedule:
- cron: '0 6 * * 1'

permissions:
actions: read
contents: read

jobs:
rust-ci:
uses: metadatastician/standards/.github/workflows/rust-ci-reusable.yml@a797d308c0517d4e2d21cc7f1cb08d41f82b1a12
permissions:
actions: read
contents: read
security-events: write
with:
# Replaces the retired cargo-audit.yml (standards CI regularisation spec:
# fold the audit into rust-ci through enable_audit).
enable_audit: true
uses: hyperpolymath/proven-cicd-and-workflows/.github/workflows/rust-ci.yml@9eb0bbf9bd80b7964ce5b9957e75821b3cd4a55b # cicd-suite main
2 changes: 1 addition & 1 deletion crates/januskey-cli/src/obliteration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ fn secure_overwrite(path: &Path) -> Result<usize> {

/// Obliterate an arbitrary file on disk (not necessarily in the content
/// store): hash its current content, securely overwrite it with
/// [`OVERWRITE_PASSES`] passes, remove it, and return a proof of erasure.
/// `OVERWRITE_PASSES` (three) passes, remove it, and return a proof of erasure.
///
/// This touches only the working file. It is the fallback used by
/// `jk obliterate <path>` when no `.januskey/` store exists; when one does,
Expand Down
36 changes: 36 additions & 0 deletions scripts/ci-gate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MPL-2.0
# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell
#
# ci-gate.sh — the verdict behind the required status check `CI/gate`.
#
# Reads the `needs` context of a GitHub Actions job (toJSON(needs)) from
# $NEEDS_JSON and succeeds only if at least one job was aggregated and EVERY
# one ended `success`. `failure`, `cancelled` and `skipped` all fail: a skipped
# prover leg is a leg that proved nothing, and a gate that counts it as green is
# a rubber stamp (doctrine 3, fail loudly). An empty or unparseable context
# fails too, so a gate pointed at zero jobs cannot pass.
#
# Exit: 0 all aggregated jobs succeeded; 1 a job did not, or none were given;
# 2 setup error (no jq, no NEEDS_JSON).
set -euo pipefail

command -v jq >/dev/null 2>&1 || { echo "ci-gate: jq is required" >&2; exit 2; }
[ -n "${NEEDS_JSON:-}" ] || { echo "ci-gate: NEEDS_JSON is not set" >&2; exit 2; }

Check failure on line 19 in scripts/ci-gate.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_januskey&issues=AaHpVKZaviykvNsXuYHa&open=AaHpVKZaviykvNsXuYHa&pullRequest=190

jq -e 'type == "object"' <<<"$NEEDS_JSON" >/dev/null 2>&1 || { echo "::error::ci-gate: NEEDS_JSON is not a JSON object"; exit 1; }
total="$(jq -e 'length' <<<"$NEEDS_JSON")" || { echo "::error::ci-gate: NEEDS_JSON is not a JSON object"; exit 1; }
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
if [ "$total" -eq 0 ]; then

Check failure on line 23 in scripts/ci-gate.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_januskey&issues=AaHpVKZaviykvNsXuYHb&open=AaHpVKZaviykvNsXuYHb&pullRequest=190
echo "::error::CI/gate aggregates no jobs (denominator = 0); refusing to pass."
exit 1
fi

echo "CI/gate: ${total} aggregated job(s)"
jq -r 'to_entries[] | " \(.key): \(.value.result)"' <<<"$NEEDS_JSON"

bad="$(jq -r 'to_entries[] | select(.value.result != "success") | "\(.key)=\(.value.result)"' <<<"$NEEDS_JSON")"
if [ -n "$bad" ]; then

Check failure on line 32 in scripts/ci-gate.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_januskey&issues=AaHpVKZaviykvNsXuYHc&open=AaHpVKZaviykvNsXuYHc&pullRequest=190
while IFS= read -r line; do echo "::error::CI/gate: required job did not succeed: ${line}"; done <<<"$bad"
exit 1
fi
echo "CI/gate: all ${total} required job(s) succeeded"
70 changes: 70 additions & 0 deletions tests/workflows/ci_gate_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MPL-2.0
# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell
# CI/gate must be a verdict, not a rubber stamp. Positive control: all green
# passes. Negative cases: failure, cancelled, skipped, empty and malformed
# input each fail. Drift: the gate's `needs:` must list every other job of
# ci.yml; every workflow ci.yml calls must be reusable and must have no
# push/pull_request trigger of its own (else it would run twice).
# shellcheck disable=SC2015,SC2016
set -uo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." || exit 2
fail=0
chk() { # chk NAME WANT-RC JSON
NEEDS_JSON="$3" bash scripts/ci-gate.sh >/dev/null 2>&1; rc=$?
if [ "$rc" -eq "$2" ]; then echo "ok $1"; else echo "FAIL $1: rc=$rc want $2"; fail=1; fi

Check failure on line 15 in tests/workflows/ci_gate_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_januskey&issues=AaHpVKXUviykvNsXuYHV&open=AaHpVKXUviykvNsXuYHV&pullRequest=190

Check warning on line 15 in tests/workflows/ci_gate_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_januskey&issues=AaHpVKXUviykvNsXuYHW&open=AaHpVKXUviykvNsXuYHW&pullRequest=190
}
chk "all success passes" 0 '{"a":{"result":"success"},"b":{"result":"success"}}'
chk "one failure fails" 1 '{"a":{"result":"success"},"b":{"result":"failure"}}'
chk "one cancelled fails" 1 '{"a":{"result":"success"},"b":{"result":"cancelled"}}'
chk "one skipped fails" 1 '{"a":{"result":"success"},"b":{"result":"skipped"}}'
chk "empty needs fails" 1 '{}'
chk "malformed fails" 1 'not json'
chk "array input fails" 1 '[{"result":"success"}]'
chk "string input fails" 1 '"x"'
chk "number input fails" 1 '3'
chk "null input fails" 1 'null'
chk "underscore job passes" 0 '{"integration_tests":{"result":"success"}}'

wf=.github/workflows/ci.yml
# drift WORKFLOW: prints "jobs|needs"; equal and non-empty means no drift.
drift() {
local j n
j="$(sed -n '/^jobs:/,$ s/^ \([A-Za-z_][A-Za-z0-9_-]*\):[[:space:]]*\(#.*\)\{0,1\}$/\1/p' "$1" | grep -vx 'gate' | sort | tr '\n' ' ')"
n="$(sed -n 's/^ needs: \[\(.*\)\]$/\1/p' "$1" | tr -d ',' | tr ' ' '\n' | sort | tr '\n' ' ')"
echo "$j|$n"
}
d="$(drift "$wf")"; jobs="${d%%|*}"; needs="${d#*|}"
if [ -n "$jobs" ] && [ "$jobs" = "$needs" ]; then echo "ok gate needs every other job ($needs)"; else echo "FAIL needs drift: jobs=[$jobs] needs=[$needs]"; fail=1; fi

Check failure on line 38 in tests/workflows/ci_gate_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_januskey&issues=AaHpVKXUviykvNsXuYHY&open=AaHpVKXUviykvNsXuYHY&pullRequest=190

Check failure on line 38 in tests/workflows/ci_gate_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_januskey&issues=AaHpVKXUviykvNsXuYHX&open=AaHpVKXUviykvNsXuYHX&pullRequest=190
# Mutation: an underscore-named job absent from gate.needs must be detected.
mut="$(mktemp)"
sed 's/^ gate:$/ integration_tests:\n runs-on: ubuntu-latest\n gate:/' "$wf" > "$mut"
d="$(drift "$mut")"; rm -f "$mut"
if [ "${d%%|*}" != "${d#*|}" ]; then echo "ok drift check catches an underscore job missing from needs"; else echo "FAIL drift check missed integration_tests"; fail=1; fi

Check failure on line 43 in tests/workflows/ci_gate_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_januskey&issues=AaHpyQuV_pFOPjJE8RTE&open=AaHpyQuV_pFOPjJE8RTE&pullRequest=190
# Mutation: a job header with an inline comment (valid YAML) must be detected too.
mut="$(mktemp)"
sed 's/^ gate:$/ smoke: # quick suite\n runs-on: ubuntu-latest\n gate:/' "$wf" > "$mut"
d="$(drift "$mut")"; rm -f "$mut"
if [ "${d%%|*}" != "${d#*|}" ]; then echo "ok drift check catches a commented job header missing from needs"; else echo "FAIL drift check missed a commented job header"; fail=1; fi

Check failure on line 48 in tests/workflows/ci_gate_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_januskey&issues=AaHp3kK3AJg4BpsX7W0u&open=AaHp3kK3AJg4BpsX7W0u&pullRequest=190
grep -q '^ name: CI/gate$' "$wf" && echo "ok job name is exactly CI/gate" || { echo "FAIL job name"; fail=1; }
grep -q '^ if: \${{ always() }}$' "$wf" && echo "ok gate runs always()" || { echo "FAIL gate lacks always()"; fail=1; }

# Every workflow ci.yml calls: reusable, and no direct push/pull_request trigger.
called="$(sed -n 's/^ uses: \(\.\/\.github\/workflows\/[^ ]*\)$/\1/p' "$wf")"
[ -n "$called" ] || { echo "FAIL ci.yml calls no local workflow"; fail=1; }

Check failure on line 54 in tests/workflows/ci_gate_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_januskey&issues=AaHpVKXUviykvNsXuYHZ&open=AaHpVKXUviykvNsXuYHZ&pullRequest=190
for f in $called; do
f="${f#./}"
# the top-level `on:` block: from `on:` to the next unindented key
on_block="$(sed -n '/^on:/,/^[a-z]/p' "$f" | sed '$d')"
grep -q '^ workflow_call:' <<<"$on_block" && echo "ok $f is reusable" || { echo "FAIL $f lacks workflow_call"; fail=1; }
if grep -qE '^ (push|pull_request|pull_request_target):' <<<"$on_block"; then
echo "FAIL $f has its own push/pull_request trigger: it would run twice"; fail=1
else echo "ok $f has no push/pull_request trigger of its own"; fi
done
# The gated jobs the owner named must still be reachable from the called workflows.
for j in proofs recheck receipt; do
grep -q "^ $j:" .github/workflows/agda-proofs.yml && echo "ok agda-proofs.yml still has job $j" || { echo "FAIL agda-proofs.yml lost job $j"; fail=1; }
done
grep -q '^ dashboard-check:' .github/workflows/dashboard-check.yml && echo "ok dashboard-check job present" || { echo "FAIL dashboard-check job lost"; fail=1; }
grep -q '^ rust-ci:' .github/workflows/rust-ci.yml && echo "ok rust-ci job present" || { echo "FAIL rust-ci job lost"; fail=1; }
exit $fail
Loading