name: CI permissions: contents: read env: CARGO_DIST_VERSION: 0.28.0 on: push: pull_request: jobs: action-pin-policy: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - name: Enforce SHA-pinned workflow actions run: scripts/check_action_pins.sh test: needs: action-pin-policy runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest] steps: - name: Checkout uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - name: Install Rust run: | rustup toolchain install stable --profile minimal --component rustfmt,clippy rustup default stable - name: Format run: cargo fmt --check - name: Clippy run: cargo clippy --locked --all-targets -- -D warnings - name: Test run: cargo test --locked - name: Demo drift (minimal) run: cargo run --locked -- demo drift --seed 1 --threads 1 --fault-profile ci --out-dir demo_out --clean - name: Verify demo bundle run: cargo run --locked -- verify --witness demo_out/drift/baseline_faults - name: Recompute witness root from demo bundle run: cargo run --locked -- verify --witness demo_out/drift/baseline_faults --recompute-witness-root - name: Determinism smoke test run: | cargo run --locked -- run --seed 99 --runs 5 --out-dir smoke_a --clean --no-tui cargo run --locked -- run --seed 99 --runs 5 --out-dir smoke_b --clean --no-tui diff -u smoke_a/witness_root.txt smoke_b/witness_root.txt release-dry-run: needs: action-pin-policy runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - name: Install Rust run: | rustup toolchain install stable --profile minimal rustup default stable - name: Install cargo-dist run: | curl -fsSL --proto '=https' --tlsv1.2 \ "https://github.com/axodotdev/cargo-dist/releases/download/v${CARGO_DIST_VERSION}/cargo-dist-installer.sh" \ -o /tmp/cargo-dist-installer.sh CARGO_DIST_NO_MODIFY_PATH=1 sh /tmp/cargo-dist-installer.sh - name: Verify cargo-dist version run: cargo dist --version | grep -F "cargo-dist ${CARGO_DIST_VERSION}" - name: Initialize cargo-dist config run: cargo dist init --yes - name: Build release artifacts (dry-run, no publish) run: cargo dist build --target=x86_64-unknown-linux-gnu - name: Verify dist outputs exist run: | if [ -d dist ] && [ -n "$(find dist -type f | head -n 1)" ]; then exit 0 fi if [ -d target/distrib ] && [ -n "$(find target/distrib -type f | head -n 1)" ]; then exit 0 fi echo "No artifacts found in dist/ or target/distrib" find dist target/distrib -maxdepth 3 -type f 2>/dev/null || true exit 1 no-git-build: needs: action-pin-policy runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Checkout uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - name: Install Rust run: | rustup toolchain install stable --profile minimal rustup default stable - name: Build and smoke test without .git and without git on PATH run: | tmpdir="$(mktemp -d)" tar -C "$GITHUB_WORKSPACE" --exclude=.git -cf - . | tar -C "$tmpdir" -xf - cd "$tmpdir" test ! -d .git toolbin="$tmpdir/toolbin" mkdir -p "$toolbin" while IFS= read -r tool; do ln -s "$tool" "$toolbin/$(basename "$tool")" done < <(find /bin /usr/bin -maxdepth 1 \( -type f -o -type l \) ! -name git) export PATH="$HOME/.cargo/bin:$toolbin:/usr/sbin:/sbin" hash -r if command -v git >/dev/null 2>&1; then echo "git must not be on PATH for this gate" exit 1 fi command -v cargo command -v rustup cargo build --locked cargo test --locked -q --test version_output ./target/debug/cogitator --version | tee version.txt grep -Eq '^cogitator [0-9]+\.[0-9]+\.[0-9]+ \(([0-9a-f]{7,40}|unknown)\)$' version.txt ordeal-witness: needs: action-pin-policy runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Checkout uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - name: Install Rust run: | rustup toolchain install stable --profile minimal rustup default stable - name: Check ordeal witness root run: cargo run --locked -- ordeal check --golden goldens/ordeal_witness_root.txt - name: Upload ordeal witness artifacts on failure if: failure() uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: name: ordeal-witness-artifacts path: | out_ci/run_0000 goldens/ordeal_witness_root.txt security-audit: needs: action-pin-policy runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - name: RustSec advisory audit (vulns only) run: | cargo install --locked cargo-audit --version 0.22.1 cargo audit --file ./Cargo.lock