Skip to content

Commit 11beae4

Browse files
committed
ci: fail example builds on warnings
Set RUSTFLAGS=-D warnings in the example Build step so a stray lint (e.g. an unused import) fails CI directly. Without it, an undenied warning is replayed onto stdout by "cargo size" during the bloat step and corrupts the size parser, surfacing as an opaque shell error far from the real cause. HEAD keeps -D warnings in the bloat size step too so RUSTFLAGS matches the Build step and cargo reuses the binary; the BASE build keeps the default lint level so a pre-existing warning on main can't fail an unrelated PR.
1 parent e967c31 commit 11beae4

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,14 @@ jobs:
116116
- name: Build
117117
working-directory: ${{ matrix.dir }}
118118
run: |
119+
# Deny warnings so a stray lint (e.g. an unused import) fails CI here
120+
# instead of slipping through. For bloat examples an undenied warning
121+
# gets replayed onto stdout by `cargo size` and corrupts the size parser.
122+
export RUSTFLAGS="-D warnings"
119123
# For bloat examples, remap source paths so the absolute workspace
120124
# prefix doesn't affect binary size (panic messages embed file!() paths).
121125
if [[ "${{ matrix.bloat }}" == "true" ]]; then
122-
export RUSTFLAGS="--remap-path-prefix=$GITHUB_WORKSPACE=/rmk-build"
126+
export RUSTFLAGS="$RUSTFLAGS --remap-path-prefix=$GITHUB_WORKSPACE=/rmk-build"
123127
fi
124128
cargo build --release
125129
@@ -160,7 +164,10 @@ jobs:
160164
# virtual prefix. Without this, absolute paths embedded by panic
161165
# messages (file!() macro) differ in length between $GITHUB_WORKSPACE
162166
# and the temp worktree, producing false size diffs in .rodata/.text.
163-
head_remap="--remap-path-prefix=$GITHUB_WORKSPACE=/rmk-build"
167+
# HEAD also keeps `-D warnings` so RUSTFLAGS matches the Build step
168+
# above and cargo reuses the binary; BASE uses the default lint level
169+
# so a pre-existing warning on main doesn't fail this PR.
170+
head_remap="-D warnings --remap-path-prefix=$GITHUB_WORKSPACE=/rmk-build"
164171
base_remap="--remap-path-prefix=$worktree=/rmk-build"
165172
166173
base_dir="$worktree/${{ matrix.dir }}"

0 commit comments

Comments
 (0)