|
| 1 | +name: 'Test All Nightlies' |
| 2 | + |
| 3 | +# Verifies that every breakpoint nightly (i.e., every nightly that has a |
| 4 | +# golden-file directory under tests/integration/expected/) builds and passes |
| 5 | +# integration and UI tests. This is the safety net that catches cfg-gating |
| 6 | +# mistakes: a conditional match arm that compiles on the pinned nightly but |
| 7 | +# not on an older (or newer) one in the supported range. |
| 8 | +# |
| 9 | +# Runs on: |
| 10 | +# - Weekly (Sunday 04:00 UTC): keeps the matrix green even when the branch |
| 11 | +# is quiet. |
| 12 | +# - Manual dispatch: for ad-hoc verification after absorbing new breakpoints. |
| 13 | +# - Push to master: ensures the supported range is intact on merge. |
| 14 | + |
| 15 | +on: |
| 16 | + schedule: |
| 17 | + - cron: '0 4 * * 0' # every Sunday at 04:00 UTC |
| 18 | + workflow_dispatch: |
| 19 | + push: |
| 20 | + branches: [master, cds/the-curious-case-of-stdlib] |
| 21 | + |
| 22 | +concurrency: |
| 23 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 24 | + cancel-in-progress: true |
| 25 | + |
| 26 | +env: |
| 27 | + CARGO_TERM_COLOR: always |
| 28 | + |
| 29 | +jobs: |
| 30 | + # --------------------------------------------------------------------------- |
| 31 | + # Discover the nightly matrix dynamically from the golden-file directories. |
| 32 | + # This means adding a new breakpoint nightly (with its golden files) is |
| 33 | + # sufficient to include it in CI; no workflow file edits needed. |
| 34 | + # --------------------------------------------------------------------------- |
| 35 | + enumerate-nightlies: |
| 36 | + name: 'Enumerate nightlies' |
| 37 | + runs-on: [self-hosted, linux, normal] |
| 38 | + outputs: |
| 39 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - name: 'Build nightly matrix from golden-file directories' |
| 44 | + id: set-matrix |
| 45 | + run: | |
| 46 | + set -euo pipefail |
| 47 | + # Each directory name under tests/integration/expected/ is a nightly |
| 48 | + # date string like "nightly-2025-07-15". |
| 49 | + nightlies=$( |
| 50 | + ls -1 tests/integration/expected/ \ |
| 51 | + | sort \ |
| 52 | + | jq -Rnc '[inputs | select(length > 0)]' |
| 53 | + ) |
| 54 | + echo "matrix={\"nightly\":${nightlies}}" >> "$GITHUB_OUTPUT" |
| 55 | + echo "Discovered nightlies: ${nightlies}" |
| 56 | +
|
| 57 | + # --------------------------------------------------------------------------- |
| 58 | + # For each nightly: install the toolchain, build, run integration + UI tests. |
| 59 | + # --------------------------------------------------------------------------- |
| 60 | + test-nightly: |
| 61 | + name: '${{ matrix.nightly }}' |
| 62 | + needs: enumerate-nightlies |
| 63 | + runs-on: [self-hosted, linux, normal] |
| 64 | + strategy: |
| 65 | + fail-fast: false |
| 66 | + matrix: ${{ fromJson(needs.enumerate-nightlies.outputs.matrix) }} |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v4 |
| 69 | + |
| 70 | + - name: 'Install nightly toolchain' |
| 71 | + uses: dtolnay/rust-toolchain@master |
| 72 | + with: |
| 73 | + toolchain: ${{ matrix.nightly }} |
| 74 | + components: rustc-dev,llvm-tools,rust-src |
| 75 | + |
| 76 | + - name: 'Build stable-mir-json' |
| 77 | + run: | |
| 78 | + RUSTUP_TOOLCHAIN=${{ matrix.nightly }} cargo build -vv |
| 79 | +
|
| 80 | + - name: 'Install jq' |
| 81 | + uses: dcarbone/install-jq-action@v3 |
| 82 | + with: |
| 83 | + version: 1.7.1 |
| 84 | + force: true |
| 85 | + |
| 86 | + - name: 'Run integration tests' |
| 87 | + run: | |
| 88 | + RUSTUP_TOOLCHAIN=${{ matrix.nightly }} make integration-test |
| 89 | +
|
| 90 | + - name: 'Derive rustc commit for UI tests' |
| 91 | + id: rustc-meta |
| 92 | + run: | |
| 93 | + set -euo pipefail |
| 94 | + COMMIT=$(RUSTUP_TOOLCHAIN=${{ matrix.nightly }} rustc -vV | grep 'commit-hash' | cut -d' ' -f2) |
| 95 | + if [ -z "$COMMIT" ]; then |
| 96 | + echo "::error::Could not determine rustc commit-hash for ${{ matrix.nightly }}" |
| 97 | + exit 1 |
| 98 | + fi |
| 99 | + echo "rustc-commit=$COMMIT" >> "$GITHUB_OUTPUT" |
| 100 | +
|
| 101 | + - name: 'Check out Rust repo' |
| 102 | + uses: actions/checkout@v4 |
| 103 | + with: |
| 104 | + repository: rust-lang/rust |
| 105 | + ref: ${{ steps.rustc-meta.outputs.rustc-commit }} |
| 106 | + path: rust |
| 107 | + fetch-depth: 1 |
| 108 | + |
| 109 | + - name: 'Run UI tests' |
| 110 | + run: | |
| 111 | + RUSTUP_TOOLCHAIN=${{ matrix.nightly }} RUST_DIR_ROOT=rust make test-ui |
0 commit comments