policy: panic-safety / file / lint policy stack (Stage 1, advisory) #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: policy | |
| # Stage 1 of the policy rollout (see docs/policy/). | |
| # Runs the no-panic, file-policy, and lint-policy checkers as **advisory** | |
| # (continue-on-error). Reports are uploaded as artifacts so reviewers can | |
| # inspect them without blocking merges. | |
| # | |
| # A separate `file-policy-required` job blocks the merge if a non-Rust | |
| # file is added without a receipt. That lane is currently clean and worth | |
| # protecting eagerly. | |
| on: | |
| pull_request: | |
| paths: | |
| - "**/*.rs" | |
| - "**/Cargo.toml" | |
| - "Cargo.lock" | |
| - "policy/**" | |
| - "docs/policy/**" | |
| - "xtask/src/policy/**" | |
| - ".github/workflows/policy.yml" | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: policy-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_BUILD_JOBS: "2" | |
| RUST_TEST_THREADS: "2" | |
| RAYON_NUM_THREADS: "4" | |
| TOKIO_WORKER_THREADS: "2" | |
| jobs: | |
| policy-report: | |
| name: policy report (advisory) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: policy | |
| - name: Run no-panic checker (advisory) | |
| run: cargo run -p xtask --quiet -- check-no-panic-family | |
| continue-on-error: true | |
| - name: Run file-policy checker (advisory) | |
| run: cargo run -p xtask --quiet -- check-file-policy | |
| continue-on-error: true | |
| - name: Run lint-policy checker (advisory) | |
| run: cargo run -p xtask --quiet -- check-lint-policy | |
| continue-on-error: true | |
| - name: Generate combined policy summary | |
| run: cargo run -p xtask --quiet -- policy-report | |
| continue-on-error: true | |
| - name: Upload policy reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: policy-reports | |
| path: target/policy/reports/ | |
| if-no-files-found: warn | |
| retention-days: 14 | |
| file-policy-required: | |
| name: file policy (required) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: policy | |
| - name: Enforce file policy (--strict) | |
| run: cargo run -p xtask --quiet -- check-file-policy --strict |