name: CI on: pull_request: branches: - main # Only newer runs of the same PR supersede one another. Other events use a # unique run id, so future manual/main runs cannot cancel a PR or each other. concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: CARGO_TERM_COLOR: always jobs: changes: # Decides whether the Rust matrix runs. Docs-only pushes (plan ticks, kb # notes, README) skip it; the `ci` job below still reports, so `ci` can be # the one required status check without stranding docs-only PRs. runs-on: ubuntu-latest outputs: code: ${{ steps.filter.outputs.code }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 - id: filter run: | base="${{ github.event.pull_request.base.sha }}" if git diff --name-only "$base...HEAD" | grep -vE '^(kb/|.*\.md$|LICENSE|\.gitignore$)' | grep -q .; then echo "code=true" >> "$GITHUB_OUTPUT" else echo "code=false" >> "$GITHUB_OUTPUT" fi fmt: needs: changes if: needs.changes.outputs.code == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable with: components: rustfmt - run: cargo fmt --all --check clippy: needs: changes if: needs.changes.outputs.code == 'true' # Every OS the `test` job runs on: `cfg(windows)` / `cfg(target_os = # "macos")` code, and test helpers used only under `cfg(unix)`, are only # linted on a runner of that OS. Any red leg fails `clippy`, hence `ci`. strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable with: components: clippy - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 - run: cargo clippy --workspace --all-targets -- -D warnings # iter-105 Theme D: pin a job to the declared MSRV (`rust-version` in # [workspace.package]) so an accidental use of a newer-than-MSRV stdlib/lang # feature is a red check here, not a downstream user's build failure. Uses # the exact MSRV toolchain and only *builds* (compile is the MSRV contract; # tests/lints keep running on stable in the jobs above). msrv: needs: changes if: needs.changes.outputs.code == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # 1.100 with: toolchain: "1.100" - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 - name: Build workspace on MSRV run: cargo build --workspace --all-targets test: needs: changes if: needs.changes.outputs.code == 'true' strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 - name: Allow test binary through Windows Firewall if: runner.os == 'Windows' shell: pwsh run: | New-NetFirewallRule -DisplayName "ff-rdp-e2e" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 1024-65535 -ErrorAction SilentlyContinue # Also runs the repo checks that used to be xtask subcommands in a # separate `discipline` job (DEC-059): source invariants, live-test # layout, vendored-JS pins, SKILL.md drift, --help idioms (ff-rdp-cli # tests) and the kb/iterations plan lint (xtask's kb_plans test). - name: Run tests timeout-minutes: 10 run: cargo test --workspace - name: Verify CLI runs run: cargo run -p ff-rdp-cli -- --help supply-chain: needs: changes if: needs.changes.outputs.code == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 - name: Install cargo-audit and cargo-deny uses: taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3 with: tool: cargo-audit,cargo-deny - name: cargo audit run: cargo audit - name: cargo deny check run: cargo deny check fuzz: needs: changes if: needs.changes.outputs.code == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # nightly with: toolchain: nightly # libFuzzer requires the gnu (non-musl) toolchain; address-sanitiser # is incompatible with musl libc. Pin explicitly so the runner's # default target (which may be musl on some ubuntu-latest images) # does not cause a link failure. See fuzz/README.md. targets: x86_64-unknown-linux-gnu - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 with: workspaces: fuzz - name: Install cargo-fuzz uses: taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3 with: tool: cargo-fuzz - name: Fuzz transport_recv_from (60 s) working-directory: fuzz run: cargo +nightly fuzz run --target x86_64-unknown-linux-gnu transport_recv_from seeds/transport_recv_from -- -max_total_time=60 - name: Fuzz parse_page_map_str (60 s) working-directory: fuzz run: cargo +nightly fuzz run --target x86_64-unknown-linux-gnu parse_page_map_str seeds/parse_page_map_str -- -max_total_time=60 - name: Fuzz parse_script_file (60 s) working-directory: fuzz run: cargo +nightly fuzz run --target x86_64-unknown-linux-gnu parse_script_file seeds/parse_script_file -- -max_total_time=60 - name: Upload crash artifacts if: failure() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: fuzz-artifacts path: | fuzz/artifacts/ fuzz/corpus/ # iter-75c: PR-time smoke that proves `gh attestation verify` will succeed # against a freshly built artifact. Builds the Linux x86_64 CLI, runs # actions/attest-build-provenance against it, then re-runs the same # `gh attestation verify --owner ractive` invocation that release # consumers use. Catches mis-wired permissions, OIDC token scope changes, # or a Sigstore transparency-log regression before they reach a tagged # release. Skipped on fork PRs (no OIDC token). verify-attestation: needs: changes if: needs.changes.outputs.code == 'true' && github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest permissions: contents: read id-token: write attestations: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 - name: Build ff-rdp-cli (release) run: cargo build -p ff-rdp-cli --release --target x86_64-unknown-linux-gnu - name: Package artifact run: | set -euo pipefail tar czf ff-rdp-x86_64-unknown-linux-gnu.tar.gz \ -C target/x86_64-unknown-linux-gnu/release ff-rdp ls -la ff-rdp-x86_64-unknown-linux-gnu.tar.gz - name: Attest build provenance id: attest uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 with: subject-path: ff-rdp-x86_64-unknown-linux-gnu.tar.gz - name: Verify attestation end-to-end env: GH_TOKEN: ${{ github.token }} run: | set -euo pipefail # Offline path: verify the bundle the attest action just produced. # Catches any local mis-config (wrong subject digest, malformed # bundle) before the transparency log is involved. gh attestation verify ff-rdp-x86_64-unknown-linux-gnu.tar.gz \ --owner ractive \ --bundle "${{ steps.attest.outputs.bundle-path }}" # Online path: round-trip through GitHub's attestation API the # same way a release consumer does. This is the actual smoke # check — if this fails on a no-op PR, the release would too. gh attestation verify ff-rdp-x86_64-unknown-linux-gnu.tar.gz \ --owner ractive ci: # The single required status check on `main`. Green when every job that # ran succeeded; skipped jobs (docs-only PRs, fork PRs) count as fine. needs: [changes, fmt, clippy, msrv, test, supply-chain, fuzz, verify-attestation] if: always() runs-on: ubuntu-latest steps: - name: Check job results run: | echo '${{ toJSON(needs) }}' | jq -r 'to_entries[] | "\(.key)=\(.value.result)"' echo '${{ toJSON(needs) }}' | jq -e '[.[] | .result] | all(. == "success" or . == "skipped")' > /dev/null