name: BIOS DEV diagnostics (not compatible firmware) on: pull_request: push: branches: [main] workflow_dispatch: permissions: contents: read jobs: bios-dev: runs-on: ubuntu-24.04 timeout-minutes: 20 permissions: contents: read # builds and runs repository code: never gets signing permissions steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: fetch-depth: 0 persist-credentials: false - name: Prepare existing pinned source toolchain and Geargrafx run: make setup - name: Source inventory and diagnostic binary checks run: | python3 tools/contracts.py python3 tools/build_rom.py --check-source make dev-rom python3 -m unittest discover -s tests/host -p 'test_api*.py' -v - name: Real Geargrafx System Card diagnostic execution run: make dev-integration - name: Independent cold/warm System Card startup checkpoint (not BIOS boot) run: | make dev-startup python3 -m unittest discover -s tests/host -p 'test_startup.py' -v make dev-startup-integration - name: Minimal reset entry MPR0/MPR1/stack (Issue #143, not a complete BIOS) run: | make dev-reset-entry python3 -m unittest tests.host.test_reset_entry -v make dev-reset-entry-integration - name: CD media-state observation point, paired disc/no-disc control (Issue #144, not a BIOS API) run: | make dev-cd-media-state python3 -m unittest tests.host.test_cd_media_state -v make dev-cd-media-state-integration - name: Independent CD-ROM2 sector read by guest HuC6280 (diagnostic, not CD_READ / not BIOS) run: | make dev-cdread python3 -m unittest tests.host.test_cdimage tests.host.test_cdread -v make dev-cdread-integration - name: Independent CD sector load-and-execute by guest HuC6280 (diagnostic, not BIOS / not CD_READ) run: | make dev-cdload-exec python3 -m unittest tests.host.test_cdload_exec -v make dev-cdload-exec-integration - name: Real-core CD_RESET bus-reset observation (diagnostic, not the System Card CD_RESET API) run: | make dev-cdreset python3 -m unittest tests.host.test_cdreset_bus -v make dev-cdreset-integration - name: Real-core CD-DA observation via raw SCSI $D8/$DA/$D9/$DD (diagnostic, not the System Card CD_PLAY API) run: | make dev-cdda python3 -m unittest tests.host.test_cdda_verify -v make dev-cdda-integration - name: Isolated Geargrafx trace harness (Issue #6, real core; diagnostic only) run: make dev-trace-integration - name: Debug and release diagnostic bytes match run: | make dev-rom MODE=release cmp build/debug/bios-dev/dev-only-not-compatible-syscard3.pce build/release/bios-dev/dev-only-not-compatible-syscard3.pce make dev-startup MODE=release cmp build/debug/startup-probe/startup-probe-not-bios.pce build/release/startup-probe/startup-probe-not-bios.pce make dev-reset-entry MODE=release cmp build/debug/reset-entry/reset-entry-not-bios.pce build/release/reset-entry/reset-entry-not-bios.pce make dev-cd-media-state MODE=release cmp build/debug/cd-media-state/cd-media-state-not-bios.pce build/release/cd-media-state/cd-media-state-not-bios.pce make dev-cdread MODE=release cmp build/debug/cdread-probe/cdread-probe-not-bios.pce build/release/cdread-probe/cdread-probe-not-bios.pce make dev-cdload-exec MODE=release cmp build/debug/cdload-exec/cdload-exec-probe-not-bios.pce build/release/cdload-exec/cdload-exec-probe-not-bios.pce make dev-cdreset MODE=release cmp build/debug/cdreset-probe/cdreset-probe-not-bios.pce build/release/cdreset-probe/cdreset-probe-not-bios.pce - name: Incomplete firmware must be refused by the release gate (exit 3 + BLOCKED only) run: make dev-release-gate-blocked - name: Static checks with pinned actionlint run: make check - name: Verify CD load-and-execute evidence before archiving run: | test -s build/debug/cdload-exec/cdload-exec-evidence.json test -s build/debug/cdload-exec/manifest.json test -s build/debug/cdload-exec/cdload-exec-probe-not-bios.pce test -s build/debug/cdload-exec/payload.bin - name: Hand off bios-dev outputs as an intermediate artifact (unverified here; the guard job checks them) run: | mkdir -p intermediate cp --parents build/debug/bios-dev/*.pce build/debug/bios-dev/*.json build/debug/bios-dev/*.map build/debug/bios-dev/*.lbl build/debug/bios-dev/contract-probes/*.pce build/debug/bios-dev/contract-probes/*.json build/debug/bios-dev/contract-probes/*.map build/debug/bios-dev/contract-probes/*.lbl build/debug/startup-probe/*.pce build/debug/startup-probe/*.json build/debug/startup-probe/*.map build/debug/startup-probe/*.lbl build/debug/cdread-probe/*.pce build/debug/cdread-probe/*.json build/debug/cdread-probe/*.map build/debug/cdread-probe/*.lbl build/debug/cdload-exec/*.pce build/debug/cdload-exec/*.json build/debug/cdload-exec/*.map build/debug/cdload-exec/*.lbl build/debug/cdreset-probe/*.pce build/debug/cdreset-probe/*.json build/debug/cdreset-probe/*.map build/debug/cdreset-probe/*.lbl intermediate/ - name: Intermediate bios-dev artifact (the guard job publishes it) uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with: name: intermediate-bios-dev-${{ github.sha }} path: intermediate/ if-no-files-found: error retention-days: 1 guard-bios-dev: # Publishes only what the bios-dev job handed over. It runs no build code: the trusted main tools, python3 resolved # before anything else, the workflow files for the placement check, the download, the guard and the upload. needs: bios-dev runs-on: ubuntu-24.04 timeout-minutes: 20 permissions: contents: read steps: - name: Checkout workflow files only (data for the placement check) uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: sparse-checkout: .github/workflows persist-credentials: false - name: Trusted guard (main) uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: ref: main path: .trusted-main sparse-checkout: tools/artifact_guard.py sparse-checkout-cone-mode: false persist-credentials: false - name: Resolve python3 (trusted) id: pyresolve run: | echo "python=$(command -v python3)" >> "$GITHUB_OUTPUT" - name: Guard placement (trusted) run: | "${{ steps.pyresolve.outputs.python }}" ".trusted-main/tools/artifact_guard.py" --root "$GITHUB_WORKSPACE" --check-placement - name: Download intermediate bios-dev artifact uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: name: intermediate-bios-dev-${{ github.sha }} path: .intake - name: Stage artifacts (trusted guard) for Save diagnostic ROM and evidence, no linked GPL executable run: | "${{ steps.pyresolve.outputs.python }}" ".trusted-main/tools/artifact_guard.py" --root ".intake" --workflow-root "$GITHUB_WORKSPACE" --stage .github/workflows/api-source.yml "Save diagnostic ROM and evidence, no linked GPL executable" - name: Verify staged artifacts (trusted guard) for Save diagnostic ROM and evidence, no linked GPL executable run: | "${{ steps.pyresolve.outputs.python }}" ".trusted-main/tools/artifact_guard.py" --root ".intake" --workflow-root "$GITHUB_WORKSPACE" --verify .github/workflows/api-source.yml "Save diagnostic ROM and evidence, no linked GPL executable" - name: Save diagnostic ROM and evidence, no linked GPL executable uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with: name: bios-dev-not-compatible-${{ github.sha }} path: | .intake/.artifact-stage/build/debug/bios-dev/*.pce .intake/.artifact-stage/build/debug/bios-dev/*.json .intake/.artifact-stage/build/debug/bios-dev/*.map .intake/.artifact-stage/build/debug/bios-dev/*.lbl .intake/.artifact-stage/build/debug/bios-dev/contract-probes/*.pce .intake/.artifact-stage/build/debug/bios-dev/contract-probes/*.json .intake/.artifact-stage/build/debug/bios-dev/contract-probes/*.map .intake/.artifact-stage/build/debug/bios-dev/contract-probes/*.lbl .intake/.artifact-stage/build/debug/startup-probe/*.pce .intake/.artifact-stage/build/debug/startup-probe/*.json .intake/.artifact-stage/build/debug/startup-probe/*.map .intake/.artifact-stage/build/debug/startup-probe/*.lbl .intake/.artifact-stage/build/debug/cdread-probe/*.pce .intake/.artifact-stage/build/debug/cdread-probe/*.json .intake/.artifact-stage/build/debug/cdread-probe/*.map .intake/.artifact-stage/build/debug/cdread-probe/*.lbl .intake/.artifact-stage/build/debug/cdload-exec/*.pce .intake/.artifact-stage/build/debug/cdload-exec/*.json .intake/.artifact-stage/build/debug/cdload-exec/*.map .intake/.artifact-stage/build/debug/cdload-exec/*.lbl .intake/.artifact-stage/build/debug/cdreset-probe/*.pce .intake/.artifact-stage/build/debug/cdreset-probe/*.json .intake/.artifact-stage/build/debug/cdreset-probe/*.map .intake/.artifact-stage/build/debug/cdreset-probe/*.lbl if-no-files-found: error retention-days: 14 attest-cdread: # Only this job can sign, and it runs no repository code: it downloads the bios-dev artifact and attests it. # The job is skipped for pull_request events, so a PR (same-repo or fork) never receives id-token/attestations. # A PR could edit this file, but its attestation would carry refs/pull/N/merge and a pull_request trigger, # which tools/evidence_provenance.py rejects; only main is trusted. # Owner review (Issue #349): sign only on push to main. A workflow_dispatch on any ref, main included, does not sign. needs: guard-bios-dev if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-24.04 timeout-minutes: 10 permissions: id-token: write attestations: write steps: - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: name: bios-dev-not-compatible-${{ github.sha }} path: evidence - name: Attest CD-read evidence and probe ROM uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 with: # Owner decision (Issue #349): only these two synthetic files may be attested. The attestation publishes their # names and sha256. Scope and residual risk: docs/provenance.md "Attestation publication scope". subject-path: | evidence/cdread-probe/cdread-evidence.json evidence/cdread-probe/cdread-probe-not-bios.pce verify-cdread-attestation: # Push to main only. attest-cdread signs only on push to main (Issue #349), so there is no dispatch attestation to verify. needs: attest-cdread if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-24.04 timeout-minutes: 10 permissions: contents: read actions: read # gh api .../actions/runs/ID/attempts/N (runInvocationURI correlation) attestations: read # gh attestation verify steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: persist-credentials: false - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: name: bios-dev-not-compatible-${{ github.sha }} path: ${{ runner.temp }}/evidence - name: Verify CD-read attestation against main (gh + tools/evidence_provenance.py) env: GH_TOKEN: ${{ github.token }} run: | evidence="$RUNNER_TEMP/evidence/cdread-probe" gh attestation verify "$evidence/cdread-evidence.json" \ --repo "$GITHUB_REPOSITORY" --signer-workflow "$GITHUB_REPOSITORY/.github/workflows/api-source.yml" \ --source-ref refs/heads/main --source-digest "$GITHUB_SHA" --deny-self-hosted-runners \ --format json > "$RUNNER_TEMP/attestation-verify.json" gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/attempts/$GITHUB_RUN_ATTEMPT" \ > "$RUNNER_TEMP/workflow-run.json" python3 tools/evidence_provenance.py "$evidence/cdread-evidence.json" \ --repo "$GITHUB_REPOSITORY" --commit "$(git rev-parse HEAD)" \ --attestation "$RUNNER_TEMP/attestation-verify.json" --run "$RUNNER_TEMP/workflow-run.json" \ --rom "$evidence/cdread-probe-not-bios.pce" - name: Produce CD_READ verdict (Issue #156; docs/verdict-schema.md v1; T1-T5 from attested scenario coverage + approval boundary, BLOCKED at 0 approvals) env: GH_TOKEN: ${{ github.token }} run: | evidence="$RUNNER_TEMP/evidence/cdread-probe" gh api "repos/$GITHUB_REPOSITORY/rules/branches/main" > "$RUNNER_TEMP/main-rules.json" mkdir -p "$RUNNER_TEMP/verdict" python3 tools/cdread_verdict.py "$evidence/cdread-evidence.json" --rom "$evidence/cdread-probe-not-bios.pce" \ --attestation "$RUNNER_TEMP/attestation-verify.json" --run "$RUNNER_TEMP/workflow-run.json" \ --rules "$RUNNER_TEMP/main-rules.json" --out "$RUNNER_TEMP/verdict/cdread-verdict.json" - name: Hand off the verdict bytes as an intermediate artifact (unverified here; the guard job checks them) run: | mkdir -p intermediate/verdict cp "$RUNNER_TEMP/verdict/cdread-verdict.json" intermediate/verdict/ - name: Intermediate verdict artifact (the guard job publishes it) uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with: name: intermediate-cdread-verdict-${{ github.sha }} path: intermediate/ if-no-files-found: error retention-days: 1 guard-cdread-verdict: # Publishes only the verdict bytes handed over by verify-cdread-attestation. No build code runs here. needs: verify-cdread-attestation runs-on: ubuntu-24.04 timeout-minutes: 10 permissions: contents: read steps: - name: Checkout workflow files only (data for the placement check) uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: sparse-checkout: .github/workflows persist-credentials: false - name: Trusted guard (main) uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: ref: main path: .trusted-main sparse-checkout: tools/artifact_guard.py sparse-checkout-cone-mode: false persist-credentials: false - name: Resolve python3 (trusted) id: pyresolve run: | echo "python=$(command -v python3)" >> "$GITHUB_OUTPUT" - name: Guard placement (trusted) run: | "${{ steps.pyresolve.outputs.python }}" ".trusted-main/tools/artifact_guard.py" --root "$GITHUB_WORKSPACE" --check-placement - name: Download intermediate verdict artifact uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: name: intermediate-cdread-verdict-${{ github.sha }} path: .intake - name: Stage artifacts (trusted guard) for Save verdict bytes (hashes only; no ROM, BIOS or disc data) run: | "${{ steps.pyresolve.outputs.python }}" ".trusted-main/tools/artifact_guard.py" --root ".intake" --workflow-root "$GITHUB_WORKSPACE" --stage .github/workflows/api-source.yml "Save verdict bytes (hashes only; no ROM, BIOS or disc data)" - name: Verify staged artifacts (trusted guard) for Save verdict bytes (hashes only; no ROM, BIOS or disc data) run: | "${{ steps.pyresolve.outputs.python }}" ".trusted-main/tools/artifact_guard.py" --root ".intake" --workflow-root "$GITHUB_WORKSPACE" --verify .github/workflows/api-source.yml "Save verdict bytes (hashes only; no ROM, BIOS or disc data)" - name: Save verdict bytes (hashes only; no ROM, BIOS or disc data) uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with: name: cdread-verdict-${{ github.sha }} path: .intake/.artifact-stage/verdict/cdread-verdict.json if-no-files-found: error retention-days: 14 attest-cdread-verdict: # Signs the verdict bytes. Like attest-cdread it runs no repository code, and only on push to protected main. # No secret is used: the signature is GitHub OIDC (id-token) + Sigstore. Without id-token the job fails closed. needs: guard-cdread-verdict if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-24.04 timeout-minutes: 10 permissions: id-token: write attestations: write steps: - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: name: cdread-verdict-${{ github.sha }} path: verdict - name: Refuse to sign without an OIDC token run: | test -n "$ACTIONS_ID_TOKEN_REQUEST_URL" || { echo "no id-token, verdict not signed"; exit 1; } - name: Attest CD_READ verdict bytes uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 with: subject-path: verdict/cdread-verdict.json verify-cdread-verdict: # Round-trip check of the signature only. Trusting the verdict is the consumer's job (#153). needs: attest-cdread-verdict if: github.event_name == 'push' && github.ref == 'refs/heads/main' runs-on: ubuntu-24.04 timeout-minutes: 10 permissions: contents: read attestations: read steps: - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: name: cdread-verdict-${{ github.sha }} path: ${{ runner.temp }}/verdict - name: Verify verdict attestation against main env: GH_TOKEN: ${{ github.token }} run: | gh attestation verify "$RUNNER_TEMP/verdict/cdread-verdict.json" \ --repo "$GITHUB_REPOSITORY" --signer-workflow "$GITHUB_REPOSITORY/.github/workflows/api-source.yml" \ --source-ref refs/heads/main --source-digest "$GITHUB_SHA" --deny-self-hosted-runners \ --cert-oidc-issuer https://token.actions.githubusercontent.com \ --predicate-type https://slsa.dev/provenance/v1