Skip to content

Commit

Permalink
Reduce CI space requirements (#685)
Browse files Browse the repository at this point in the history
Introduce `smol` profile for smaller, faster builds. The new profile
reduces the size of the `target` directory from ~12GB to ~1GB.

Fixes recent CI breakages due to "no space left on device" errors.
  • Loading branch information
aaronmondal authored Mar 2, 2024
1 parent 6491fc7 commit b9029bb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test --output_groups=+clippy_checks
build:nightly --@rules_rust//rust/toolchain/channel=nightly

# AddressSanitizer to detect memory leaks.
build:asan --config=nightly -c dbg
build:asan --config=nightly
build:asan --@rules_rust//:extra_rustc_flags=-Zsanitizer=address

# ThreadSanitizer to detect data races. Tests under tsan shouldn't be cached
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/native-cargo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
shell: bash

- name: Build on ${{ runner.os }}
run: cargo build --all
run: cargo build --all --profile=smol

- name: Test on ${{ runner.os }}
run: cargo test --all
run: cargo test --all --profile=smol
2 changes: 1 addition & 1 deletion .github/workflows/nix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ jobs:
- name: Invoke Cargo build in Nix shell
run: >
nix develop --impure --command
bash -c "cargo test --all"
bash -c "cargo test --all --profile=smol"
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ edition = "2021"
lto = true
opt-level = 3

# Prefer this profile in CI, for instance via `cargo test --all --profile=smol`.
# It reduces the size of the `target` directory from ~12GB to ~1GB.
[profile.smol]
inherits = "release"
lto = "thin"
opt-level = "z"
strip = true

[[bin]]
name = "nativelink"

Expand Down

0 comments on commit b9029bb

Please sign in to comment.