fix: prefer cargo check to cargo build to save time and space (#2466)

The `ubuntu-24.04 - x86_64-unknown-linux-gnu` build is failing with `No
space left on device` on #2465, so let's get this in first, which should
help.

Note that `cargo check` should be faster and use less disk than `cargo
build` because it does not write out the object files.
This commit is contained in:
Michael Bolin
2025-08-19 12:57:31 -07:00
committed by GitHub
parent 1f5638b0f3
commit aafa00dbe0

View File

@@ -130,7 +130,7 @@ jobs:
- if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl'}} - if: ${{ matrix.target == 'x86_64-unknown-linux-musl' || matrix.target == 'aarch64-unknown-linux-musl'}}
name: Install musl build tools name: Install musl build tools
run: | run: |
sudo apt install -y musl-tools pkg-config sudo apt install -y musl-tools pkg-config && sudo rm -rf /var/lib/apt/lists/*
- name: cargo clippy - name: cargo clippy
id: clippy id: clippy
@@ -139,15 +139,15 @@ jobs:
# Running `cargo build` from the workspace root builds the workspace using # Running `cargo build` from the workspace root builds the workspace using
# the union of all features from third-party crates. This can mask errors # the union of all features from third-party crates. This can mask errors
# where individual crates have underspecified features. To avoid this, we # where individual crates have underspecified features. To avoid this, we
# run `cargo build` for each crate individually, though because this is # run `cargo check` for each crate individually, though because this is
# slower, we only do this for the x86_64-unknown-linux-gnu target. # slower, we only do this for the x86_64-unknown-linux-gnu target.
- name: cargo build individual crates - name: cargo check individual crates
id: build id: cargo_check_all_crates
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && matrix.profile != 'release' }} if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && matrix.profile != 'release' }}
continue-on-error: true continue-on-error: true
run: | run: |
find . -name Cargo.toml -mindepth 2 -maxdepth 2 -print0 \ find . -name Cargo.toml -mindepth 2 -maxdepth 2 -print0 \
| xargs -0 -n1 -I{} bash -c 'cd "$(dirname "{}")" && cargo build --profile ${{ matrix.profile }}' | xargs -0 -n1 -I{} bash -c 'cd "$(dirname "{}")" && cargo check --profile ${{ matrix.profile }}'
- name: cargo test - name: cargo test
id: test id: test
@@ -162,10 +162,10 @@ jobs:
- name: verify all steps passed - name: verify all steps passed
if: | if: |
steps.clippy.outcome == 'failure' || steps.clippy.outcome == 'failure' ||
steps.build.outcome == 'failure' || steps.cargo_check_all_crates.outcome == 'failure' ||
steps.test.outcome == 'failure' steps.test.outcome == 'failure'
run: | run: |
echo "One or more checks failed (clippy, build, or test). See logs for details." echo "One or more checks failed (clippy, cargo_check_all_crates, or test). See logs for details."
exit 1 exit 1
# --- Gatherer job that you mark as the ONLY required status ----------------- # --- Gatherer job that you mark as the ONLY required status -----------------