# 18:00 UTC = 03:00 JST next day. This workflow only targets main. name: Nightly PCE fixture (change-aware, not BIOS) on: schedule: - cron: '0 18 * * *' workflow_dispatch: permissions: contents: read actions: read concurrency: group: oss-pce-cd-bios-nightly cancel-in-progress: false jobs: plan: runs-on: ubuntu-24.04 timeout-minutes: 5 outputs: build: ${{ steps.decide.outputs.build }} source_sha: ${{ steps.decide.outputs.source_sha }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: ref: main persist-credentials: false - name: Compare exact main SHA against last successful built artifact id: decide env: GH_TOKEN: ${{ github.token }} run: bash tools/nightly_plan.sh build: needs: plan if: needs.plan.outputs.build == 'true' runs-on: ubuntu-24.04 timeout-minutes: 20 permissions: contents: read steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: ref: ${{ needs.plan.outputs.source_sha }} fetch-depth: 0 persist-credentials: false - name: Prepare pinned tools from source run: make setup - name: Build original HuCARD fixture run: make build - name: Host tests (no Geargrafx needed) run: make test - name: Real Geargrafx tests (required, fail-closed; Issue #398) run: make test-real-core - name: Static checks including Actions validation run: make check - name: Verify release-mode fixture run: | make build MODE=release cmp build/debug/smoke-test-not-bios.pce build/release/smoke-test-not-bios.pce python3 tools/build.py --verify build/debug/smoke-test-not-bios.pce - name: Record candidate success state env: SOURCE_SHA: ${{ needs.plan.outputs.source_sha }} run: python3 tools/nightly.py record - name: Hand off the nightly outputs as an intermediate artifact (unverified here; the guard job checks them) run: | mkdir -p intermediate cp --parents build/debug/*.pce build/debug/*.json build/debug/*.map build/debug/*.lbl build/nightly-state.json intermediate/ - name: Intermediate nightly artifact (the guard job publishes it) uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with: name: intermediate-nightly-${{ needs.plan.outputs.source_sha }} path: intermediate/ if-no-files-found: error retention-days: 1 guard-nightly: # Publishes only what the build 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 uploads. needs: [plan, build] 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 nightly artifact uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: name: intermediate-nightly-${{ needs.plan.outputs.source_sha }} path: .intake - name: Stage artifacts (trusted guard) for Archive verified original fixture (not a release) run: | "${{ steps.pyresolve.outputs.python }}" ".trusted-main/tools/artifact_guard.py" --root ".intake" --workflow-root "$GITHUB_WORKSPACE" --stage .github/workflows/nightly.yml "Archive verified original fixture (not a release)" - name: Verify staged artifacts (trusted guard) for Archive verified original fixture (not a release) run: | "${{ steps.pyresolve.outputs.python }}" ".trusted-main/tools/artifact_guard.py" --root ".intake" --workflow-root "$GITHUB_WORKSPACE" --verify .github/workflows/nightly.yml "Archive verified original fixture (not a release)" - name: Archive verified original fixture (not a release) uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with: name: nightly-smoke-not-bios-${{ needs.plan.outputs.source_sha }} path: | .intake/.artifact-stage/build/debug/*.pce .intake/.artifact-stage/build/debug/*.json .intake/.artifact-stage/build/debug/*.map .intake/.artifact-stage/build/debug/*.lbl if-no-files-found: error retention-days: 14 - name: Stage artifacts (trusted guard) for Save baseline; accepted only when the whole run succeeds run: | "${{ steps.pyresolve.outputs.python }}" ".trusted-main/tools/artifact_guard.py" --root ".intake" --workflow-root "$GITHUB_WORKSPACE" --stage .github/workflows/nightly.yml "Save baseline; accepted only when the whole run succeeds" - name: Verify staged artifacts (trusted guard) for Save baseline; accepted only when the whole run succeeds run: | "${{ steps.pyresolve.outputs.python }}" ".trusted-main/tools/artifact_guard.py" --root ".intake" --workflow-root "$GITHUB_WORKSPACE" --verify .github/workflows/nightly.yml "Save baseline; accepted only when the whole run succeeds" - name: Save baseline; accepted only when the whole run succeeds uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with: name: nightly-success-state path: .intake/.artifact-stage/build/nightly-state.json if-no-files-found: error retention-days: 90