|
| 1 | +name: Shadow Branch Checks |
| 2 | + |
| 3 | +# OS-129 Phase 5: non-required branch-check coverage on supported shared CPU |
| 4 | +# runners. Pull request coverage uses copy-pr-bot's trusted pull-request/* |
| 5 | +# mirror branches; workflow_dispatch is for ad hoc bake runs. |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - "pull-request/[0-9]+" |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + packages: read |
| 16 | + |
| 17 | +env: |
| 18 | + CARGO_TERM_COLOR: always |
| 19 | + CARGO_INCREMENTAL: "0" |
| 20 | + MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 21 | + SCCACHE_GHA_ENABLED: "true" |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + pr_metadata: |
| 29 | + name: Resolve PR metadata |
| 30 | + runs-on: ubuntu-latest |
| 31 | + permissions: |
| 32 | + contents: read |
| 33 | + pull-requests: read |
| 34 | + outputs: |
| 35 | + should_run: ${{ steps.gate.outputs.should_run }} |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + |
| 39 | + - id: gate |
| 40 | + uses: ./.github/actions/pr-gate |
| 41 | + |
| 42 | + mise-lockfile: |
| 43 | + name: mise Lockfile |
| 44 | + needs: pr_metadata |
| 45 | + if: needs.pr_metadata.outputs.should_run == 'true' |
| 46 | + runs-on: linux-amd64-cpu8 |
| 47 | + container: |
| 48 | + image: ghcr.io/nvidia/openshell/ci:latest |
| 49 | + credentials: |
| 50 | + username: ${{ github.actor }} |
| 51 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + |
| 55 | + - name: Mark workspace as safe for git |
| 56 | + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 57 | + |
| 58 | + - name: Detect mise config changes |
| 59 | + id: changed |
| 60 | + uses: tj-actions/changed-files@aa08304bd477b800d468db44fe10f6c61f7f7b11 # v42.1.0 |
| 61 | + with: |
| 62 | + files: | |
| 63 | + mise.toml |
| 64 | + mise.lock |
| 65 | +
|
| 66 | + - name: Verify mise.lock is in sync with mise.toml |
| 67 | + if: steps.changed.outputs.any_changed == 'true' |
| 68 | + run: | |
| 69 | + mise lock |
| 70 | + if ! git diff --exit-code mise.lock; then |
| 71 | + echo "::error::mise.lock is out of sync with mise.toml. Run 'mise lock' locally and commit the result." >&2 |
| 72 | + exit 1 |
| 73 | + fi |
| 74 | +
|
| 75 | + license-headers: |
| 76 | + name: License Headers |
| 77 | + needs: pr_metadata |
| 78 | + if: needs.pr_metadata.outputs.should_run == 'true' |
| 79 | + runs-on: linux-amd64-cpu8 |
| 80 | + container: |
| 81 | + image: ghcr.io/nvidia/openshell/ci:latest |
| 82 | + credentials: |
| 83 | + username: ${{ github.actor }} |
| 84 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v4 |
| 87 | + |
| 88 | + - name: Install tools |
| 89 | + run: mise install --locked |
| 90 | + |
| 91 | + - name: Check license headers |
| 92 | + run: mise run license:check |
| 93 | + |
| 94 | + rust: |
| 95 | + name: Rust (${{ matrix.runner }}) |
| 96 | + needs: pr_metadata |
| 97 | + if: needs.pr_metadata.outputs.should_run == 'true' |
| 98 | + strategy: |
| 99 | + fail-fast: false |
| 100 | + matrix: |
| 101 | + runner: [linux-amd64-cpu8, linux-arm64-cpu8] |
| 102 | + runs-on: ${{ matrix.runner }} |
| 103 | + env: |
| 104 | + SCCACHE_GHA_VERSION: shadow-branch-checks-rust-${{ matrix.runner }} |
| 105 | + container: |
| 106 | + image: ghcr.io/nvidia/openshell/ci:latest |
| 107 | + credentials: |
| 108 | + username: ${{ github.actor }} |
| 109 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 110 | + steps: |
| 111 | + - uses: actions/checkout@v4 |
| 112 | + |
| 113 | + - name: Install tools |
| 114 | + run: mise install --locked |
| 115 | + |
| 116 | + - name: Configure GHA sccache backend |
| 117 | + uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 |
| 118 | + |
| 119 | + - name: Cache Rust target and registry |
| 120 | + uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2 |
| 121 | + with: |
| 122 | + shared-key: shadow-branch-checks-rust-${{ matrix.runner }} |
| 123 | + cache-directories: .cache/sccache |
| 124 | + |
| 125 | + - name: Format |
| 126 | + run: mise run rust:format:check |
| 127 | + |
| 128 | + - name: Lint |
| 129 | + run: mise run rust:lint |
| 130 | + |
| 131 | + - name: Test |
| 132 | + run: mise run test:rust |
| 133 | + |
| 134 | + - name: sccache stats |
| 135 | + if: always() |
| 136 | + run: | |
| 137 | + set +e |
| 138 | + stats_bin="${SCCACHE_PATH:-sccache}" |
| 139 | + "$stats_bin" --show-stats |
| 140 | + status=$? |
| 141 | + if [[ $status -ne 0 ]]; then |
| 142 | + echo "::warning::sccache stats unavailable (exit $status)" |
| 143 | + fi |
| 144 | + exit 0 |
| 145 | +
|
| 146 | + python: |
| 147 | + name: Python (${{ matrix.runner }}) |
| 148 | + needs: pr_metadata |
| 149 | + if: needs.pr_metadata.outputs.should_run == 'true' |
| 150 | + strategy: |
| 151 | + fail-fast: false |
| 152 | + matrix: |
| 153 | + runner: [linux-amd64-cpu8, linux-arm64-cpu8] |
| 154 | + runs-on: ${{ matrix.runner }} |
| 155 | + container: |
| 156 | + image: ghcr.io/nvidia/openshell/ci:latest |
| 157 | + credentials: |
| 158 | + username: ${{ github.actor }} |
| 159 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 160 | + steps: |
| 161 | + - uses: actions/checkout@v4 |
| 162 | + |
| 163 | + - name: Install tools |
| 164 | + run: mise install --locked |
| 165 | + |
| 166 | + - name: Install dependencies |
| 167 | + run: uv sync --frozen |
| 168 | + |
| 169 | + - name: Lint |
| 170 | + run: mise run python:lint |
| 171 | + |
| 172 | + - name: Test |
| 173 | + run: mise run test:python |
| 174 | + |
| 175 | + markdown: |
| 176 | + name: Markdown |
| 177 | + needs: pr_metadata |
| 178 | + if: needs.pr_metadata.outputs.should_run == 'true' |
| 179 | + runs-on: linux-amd64-cpu8 |
| 180 | + container: |
| 181 | + image: ghcr.io/nvidia/openshell/ci:latest |
| 182 | + credentials: |
| 183 | + username: ${{ github.actor }} |
| 184 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 185 | + steps: |
| 186 | + - uses: actions/checkout@v4 |
| 187 | + |
| 188 | + - name: Install tools |
| 189 | + run: mise install --locked |
| 190 | + |
| 191 | + - name: Lint |
| 192 | + run: mise run markdown:lint |
0 commit comments