|
| 1 | +name: Nightly Toolchain Check |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Every day at 03:00 UTC. |
| 6 | + - cron: "0 3 * * *" |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + issues: write # Used by the failure alert step below |
| 12 | + |
| 13 | +env: |
| 14 | + CARGO_INCREMENTAL: 0 |
| 15 | + CARGO_NET_RETRY: 10 |
| 16 | + RUST_BACKTRACE: short |
| 17 | + |
| 18 | +jobs: |
| 19 | + check: |
| 20 | + name: ${{ matrix.toolchain }} / ${{ matrix.scope }} / ${{ matrix.os }} |
| 21 | + runs-on: ${{ matrix.os }} |
| 22 | + # Nightly may break - allow failure. Beta must pass. |
| 23 | + continue-on-error: ${{ matrix.toolchain == 'nightly' }} |
| 24 | + timeout-minutes: 30 |
| 25 | + strategy: |
| 26 | + fail-fast: false |
| 27 | + matrix: |
| 28 | + include: |
| 29 | + - toolchain: beta |
| 30 | + os: macos-latest |
| 31 | + scope: workspace |
| 32 | + cargo_args: "--workspace --all-features" |
| 33 | + - toolchain: nightly |
| 34 | + os: macos-latest |
| 35 | + scope: workspace |
| 36 | + cargo_args: "--workspace --all-features" |
| 37 | + - toolchain: beta |
| 38 | + os: ubuntu-latest |
| 39 | + scope: pure-crates |
| 40 | + cargo_args: "-p dunst-core -p dunst-graph -p dunst-vision" |
| 41 | + - toolchain: nightly |
| 42 | + os: ubuntu-latest |
| 43 | + scope: pure-crates |
| 44 | + cargo_args: "-p dunst-core -p dunst-graph -p dunst-vision" |
| 45 | + steps: |
| 46 | + - uses: step-security/harden-runner@v2 |
| 47 | + with: |
| 48 | + egress-policy: audit |
| 49 | + - uses: actions/checkout@v6 |
| 50 | + with: |
| 51 | + ref: main |
| 52 | + - uses: dtolnay/rust-toolchain@master |
| 53 | + with: |
| 54 | + toolchain: ${{ matrix.toolchain }} |
| 55 | + components: clippy |
| 56 | + - uses: Swatinem/rust-cache@v2 |
| 57 | + with: |
| 58 | + shared-key: nightly-${{ matrix.toolchain }}-${{ matrix.scope }}-${{ matrix.os }} |
| 59 | + save-if: true |
| 60 | + - name: Clippy |
| 61 | + run: cargo clippy ${{ matrix.cargo_args }} --all-targets --locked -- -D warnings |
| 62 | + - name: Tests |
| 63 | + run: cargo test ${{ matrix.cargo_args }} --all-targets --locked |
| 64 | + - name: Doc tests |
| 65 | + run: cargo test ${{ matrix.cargo_args }} --doc --locked |
| 66 | + |
| 67 | + # Open (or reuse) a tracking issue when the BETA matrix fails. Nightly |
| 68 | + # failures stay silent (they are allowed to break). Avoids spamming: the |
| 69 | + # step searches for an open "nightly-toolchain" labeled issue and comments |
| 70 | + # on it instead of creating duplicates. |
| 71 | + alert: |
| 72 | + name: Alert on beta regression |
| 73 | + needs: [check] |
| 74 | + if: always() && contains(needs.check.result, 'failure') && github.event_name == 'schedule' |
| 75 | + runs-on: ubuntu-latest |
| 76 | + timeout-minutes: 5 |
| 77 | + steps: |
| 78 | + - uses: step-security/harden-runner@v2 |
| 79 | + with: |
| 80 | + egress-policy: audit |
| 81 | + - name: Open or update tracking issue |
| 82 | + uses: actions/github-script@v7 |
| 83 | + with: |
| 84 | + script: | |
| 85 | + const label = 'nightly-toolchain'; |
| 86 | + const title = `Beta/nightly toolchain regression (${new Date().toISOString().slice(0,10)})`; |
| 87 | + const body = [ |
| 88 | + `Nightly run ${context.runId} observed a failure on the \`beta\` or \`nightly\` toolchain.`, |
| 89 | + ``, |
| 90 | + `Run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, |
| 91 | + ``, |
| 92 | + `If this is a nightly-only soft failure, close the issue. If beta is broken, this is a release blocker.`, |
| 93 | + ].join('\n'); |
| 94 | + const { data: issues } = await github.rest.issues.listForRepo({ |
| 95 | + owner: context.repo.owner, |
| 96 | + repo: context.repo.repo, |
| 97 | + state: 'open', |
| 98 | + labels: label, |
| 99 | + per_page: 1, |
| 100 | + }); |
| 101 | + if (issues.length > 0) { |
| 102 | + await github.rest.issues.createComment({ |
| 103 | + owner: context.repo.owner, |
| 104 | + repo: context.repo.repo, |
| 105 | + issue_number: issues[0].number, |
| 106 | + body, |
| 107 | + }); |
| 108 | + } else { |
| 109 | + await github.rest.issues.create({ |
| 110 | + owner: context.repo.owner, |
| 111 | + repo: context.repo.repo, |
| 112 | + title, |
| 113 | + body, |
| 114 | + labels: [label], |
| 115 | + }); |
| 116 | + } |
0 commit comments