Check CI against Rust beta each week (#12763)

# Objective

Get an early warning if any new rust lints will break CI. Closes #12625

## Solution

Test the main branch against the Rust beta every week.

## Additional Possibilities
The action currently creates an issue if anything fails. The issue could
use a label like `C-Weekly` but somebody with the ability to create
issue labels would have to add it.

Another possibility would be to use discord webhooks. That would need
somebody with the access to create webhooks on discord and somebody with
the rights to connect that webhook to this repo,
This commit is contained in:
Brezak 2024-03-31 04:09:28 +02:00 committed by GitHub
parent 70c69cdd51
commit ec7755dcce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

108
.github/workflows/weekly.yml vendored Normal file
View file

@ -0,0 +1,108 @@
name: Weekly beta compile test
on:
schedule:
# New versions of rust release on Thursdays. We test on Mondays to get at least 3 days of warning before all our CI breaks again.
# https://forge.rust-lang.org/release/process.html#release-day-thursday
- cron: '0 12 * * 1'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
NIGHTLY_TOOLCHAIN: nightly
jobs:
test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@beta
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
if: runner.os == 'linux'
- name: Build & run tests
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- test
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
lint:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@beta
with:
components: rustfmt, clippy
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
- name: Run lints
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- lints
check-compiles:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: ci
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@beta
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Check compile test
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- compile
check-doc:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@beta
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
- name: Build and check docs
# See tools/ci/src/main.rs for the commands this runs
run: cargo run -p ci -- doc
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0"
open-issue:
name: Warn that weekly CI fails
runs-on: ubuntu-latest
needs: [test, lint, check-compiles, check-doc]
permissions:
issues: write
# Use always() so the job doesn't get canceled if any other jobs fail
if: ${{ always() && contains(needs.*.result, 'failure') }}
steps:
- name: Create issue
run: |
previous_issue_number=$(gh issue list \
--search "$TITLE in:title" \
--json number \
--jq '.[0].number')
if [[ -n $previous_issue_number ]]; then
gh issue comment $previous_issue_number \
--body "Weekly pipeline still fails: $FAILED_RUN"
else
gh issue create \
--title "$TITLE" \
--label "$LABELS" \
--body "$BODY"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
TITLE: Main branch fails to compile on Rust beta.
LABELS: C-Bug,S-Needs-Triage
FAILED_RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
BODY: |
## Weekly CI run has failed.
[The offending run.]($FAILED_RUN)