|
| 1 | +name: Rust Cache Seed |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_TERM_COLOR: always |
| 11 | + CARGO_INCREMENTAL: "0" |
| 12 | + MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 13 | + SCCACHE_GHA_ENABLED: "true" |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + packages: read |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +jobs: |
| 24 | + rust: |
| 25 | + name: Rust (${{ matrix.runner }}) |
| 26 | + strategy: |
| 27 | + fail-fast: false |
| 28 | + matrix: |
| 29 | + runner: [linux-amd64-cpu8, linux-arm64-cpu8] |
| 30 | + runs-on: ${{ matrix.runner }} |
| 31 | + env: |
| 32 | + SCCACHE_GHA_VERSION: branch-checks-rust-${{ matrix.runner }} |
| 33 | + container: |
| 34 | + image: ghcr.io/nvidia/openshell/ci:latest |
| 35 | + credentials: |
| 36 | + username: ${{ github.actor }} |
| 37 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 40 | + |
| 41 | + - name: Install tools |
| 42 | + run: mise install --locked |
| 43 | + |
| 44 | + - name: Configure GHA sccache backend |
| 45 | + uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10 |
| 46 | + |
| 47 | + - name: Cache Rust target and registry |
| 48 | + uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2 |
| 49 | + with: |
| 50 | + shared-key: rust-checks-${{ matrix.runner }} |
| 51 | + cache-on-failure: true |
| 52 | + |
| 53 | + - name: Format |
| 54 | + run: mise run rust:format:check |
| 55 | + |
| 56 | + - name: Lint |
| 57 | + run: mise run rust:lint |
| 58 | + |
| 59 | + - name: Test |
| 60 | + run: mise run test:rust |
| 61 | + |
| 62 | + - name: sccache stats |
| 63 | + if: always() |
| 64 | + run: | |
| 65 | + set +e |
| 66 | + stats_bin="${SCCACHE_PATH:-sccache}" |
| 67 | + "$stats_bin" --show-stats |
| 68 | + status=$? |
| 69 | + if [ "$status" -ne 0 ]; then |
| 70 | + echo "::warning::sccache stats unavailable (exit $status)" |
| 71 | + fi |
| 72 | + exit 0 |
0 commit comments