-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Break out lint as a job, and pass
RUSTFLAGS=-Dwarnings
.
This will cause the CI job to actually fail on rustc or clippy warnings, rather than passing and thus requiring us to manually check the output.
- Loading branch information
Showing
2 changed files
with
70 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,17 +173,13 @@ jobs: | |
- run: df -h . | ||
|
||
# Run clippy and docs to get warnings. | ||
- name: Lint | ||
run: cargo xtask --scope=only-normal lint --timings | ||
|
||
# Save timing reports so we can download and view them | ||
# (for understanding build performance in CI) | ||
- name: Save cargo --timings output | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cargo-timings ${{ matrix.os }} ${{ matrix.toolchain }} ${{ matrix.depversions }} | ||
name: cargo-timings build ${{ matrix.os }} ${{ matrix.toolchain }} ${{ matrix.depversions }} | ||
path: | | ||
target/cargo-timings/cargo-timing-*.html | ||
|
@@ -228,9 +224,76 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Run `xtask lint`. | ||
# | ||
# This job is separate from the main "build" job so that: | ||
# * Lint results are delivered quickly by running them in parallel with other jobs. | ||
# * We build with `-Dwarnings` so the failures aren't silent, but don't want this to | ||
# cause *re*building in the main build job and its cache. | ||
lint: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
toolchain: ["stable", "nightly", "beta"] | ||
|
||
runs-on: ubuntu-latest | ||
continue-on-error: false | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set Rust toolchain | ||
# The rust-toolchain.toml file specifies the targets and components we need, | ||
# but we may want to override the toolchain. | ||
if: ${{ matrix.toolchain != 'stable' }} | ||
run: | | ||
sed -i.origstable "s/stable/${{ matrix.toolchain }}/" rust-toolchain.toml | ||
rustup show # triggers installation of selected toolchain | ||
- name: Install native libraries | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
sudo apt update | ||
sudo apt-get -y install libxrandr-dev xorg-dev libx11-xcb-dev libwayland-dev libasound2-dev libudev-dev | ||
- run: df -h . | ||
|
||
- uses: Swatinem/[email protected] | ||
with: | ||
# We cannot reuse the cache from the `build` job, because `RUSTFLAGS=-Dwarnings` | ||
# would invalidate all cached artifacts anyway. | ||
prefix-key: "v1-rust-${{ matrix.toolchain }}" | ||
shared-key: "lint" | ||
|
||
- name: Install tools | ||
run: | | ||
cargo install --locked [email protected] | ||
- run: df -h . | ||
|
||
# Kludge: Avoid dependency on `cargo-about` by making the generated license info file look fresh. | ||
- name: Skip license generation | ||
run: touch all-is-cubes-wasm/static/third-party-licenses.html | ||
|
||
- name: Lint | ||
run: cargo xtask --scope=only-normal lint --timings | ||
env: | ||
RUSTFLAGS: '-Dwarnings' | ||
|
||
- run: df -h . | ||
|
||
- name: Save cargo --timings output | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cargo-timings lint ${{ matrix.toolchain }} | ||
path: | | ||
target/cargo-timings/cargo-timing-*.html | ||
# Run `xtask test-more` to look for broken `features`. | ||
features: | ||
# Don't spend time on this if the normal builds failed. | ||
# Also, we reuse the cache from it. | ||
needs: build | ||
runs-on: ubuntu-latest | ||
continue-on-error: false | ||
|
@@ -249,17 +312,13 @@ jobs: | |
run: | | ||
sudo apt update | ||
sudo apt-get -y install libxrandr-dev xorg-dev libx11-xcb-dev libwayland-dev libasound2-dev libudev-dev | ||
# libxrandr-dev xorg-dev libx11-xcb-dev libwayland-dev: needed for windowing | ||
# Note that `libwayland-dev` provides the library called `wayland-client` | ||
# libasound2-dev: needed for audio via `kira` | ||
# libudev-dev: needed for gamepad input via `gilrs` | ||
# Load cache before doing any Rust builds | ||
- uses: Swatinem/[email protected] | ||
with: | ||
# Reuse the cache from the normal `build` job instead of creating an independent one, | ||
# to reduce redundant work and save disk space — but don't *write* to that cache, so | ||
# we don't bloat it. | ||
# we don't bloat it or conflict. | ||
prefix-key: "v1-rust-ubuntu-stable-locked" | ||
shared-key: "build" | ||
save-if: false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters