Skip to content

Commit 3f87c49

Browse files
authored
Change how warnings are denied in CI (#14299)
* Change how warnings are denied in CI Use `CARGO_BUILD_WARNINGS=deny` instead of `RUSTFLAGS=-Dwarnings` because this'll eventually handle Cargo's lints and it additionally enables printing more errors if the build doesn't actually fail (e.g. rustc generates a warning and then Cargo promotes it to an error and keeps going with the rest of the build). prtest:full * Move env vars to test matrix configuration Enables more easily specifying per-job env vars
1 parent 8c84ad0 commit 3f87c49

4 files changed

Lines changed: 55 additions & 35 deletions

File tree

.github/actions/install-rust/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ runs:
6464
EOF
6565
6666
# Deny warnings on CI to keep our code warning-free as it lands in-tree.
67-
echo RUSTFLAGS="-D warnings $RUSTFLAGS" >> "$GITHUB_ENV"
67+
echo CARGO_BUILD_WARNINGS=deny >> "$GITHUB_ENV"
6868
6969
if [[ "${{ runner.os }}" = "macOS" ]]; then
7070
cat >> "$GITHUB_ENV" <<EOF

.github/workflows/main.yml

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ jobs:
285285
name: Doc build
286286
runs-on: ubuntu-latest
287287
env:
288-
RUSTDOCFLAGS: -Dwarnings --cfg docsrs
288+
RUSTDOCFLAGS: --cfg docsrs
289289
OPENVINO_SKIP_LINKING: 1
290290
steps:
291291
- uses: actions/checkout@v6
@@ -650,6 +650,8 @@ jobs:
650650
os: ubuntu-latest
651651
cross: true
652652
test: cross build
653+
env:
654+
RUSTFLAGS: -Alinker-messages
653655
- target: wasm32-wasip1
654656
os: ubuntu-latest
655657
test: cargo build --no-default-features --features compile,cranelift,all-arch
@@ -858,9 +860,7 @@ jobs:
858860
needs: determine
859861
name: ${{ matrix.name }}
860862
runs-on: ${{ matrix.os }}
861-
env:
862-
QEMU_BUILD_VERSION: 10.0.3
863-
SDE_BUILD_VERSION: 9.58.0-2025-06-16
863+
env: ${{ matrix.env || fromJSON('{}') }}
864864
strategy:
865865
fail-fast: ${{ github.event_name != 'pull_request' }}
866866
matrix: ${{ fromJson(needs.determine.outputs.test-matrix) }}
@@ -926,14 +926,6 @@ jobs:
926926
upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g')
927927
echo CARGO_TARGET_${upcase}_RUNNER=${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} >> $GITHUB_ENV
928928
929-
# QEMU emulation is not always the speediest, so total testing time
930-
# goes down if we build the libs in release mode when running tests.
931-
echo CARGO_PROFILE_DEV_OPT_LEVEL=2 >> $GITHUB_ENV
932-
933-
# See comments in the source for why we enable this during QEMU
934-
# emulation.
935-
echo WASMTIME_TEST_NO_HOG_MEMORY=1 >> $GITHUB_ENV
936-
937929
# See if qemu is already in the cache
938930
if [ -f ${{ runner.tool_cache }}/qemu/built ]; then
939931
exit 0
@@ -962,18 +954,6 @@ jobs:
962954
# Set up SDE as runner for x86_64 targets
963955
echo "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER=${{ runner.tool_cache }}/sde/sde64 -future --" >> $GITHUB_ENV
964956
965-
# SDE emulation is very slow, so use release mode for better performance
966-
echo CARGO_PROFILE_DEV_OPT_LEVEL=2 >> $GITHUB_ENV
967-
968-
# Enable environment variable to indicate SDE is being used
969-
echo WASMTIME_TEST_SDE=1 >> $GITHUB_ENV
970-
971-
# Generic variable for skipping tests that are problematic under SDE (performance, compatibility, etc.)
972-
echo WASMTIME_TEST_NO_SDE=1 >> $GITHUB_ENV
973-
974-
# Similar to QEMU, reduce memory usage during SDE emulation
975-
echo WASMTIME_TEST_NO_HOG_MEMORY=1 >> $GITHUB_ENV
976-
977957
# See if SDE is already in the cache
978958
if [ -f ${{ runner.tool_cache }}/sde/sde64 ]; then
979959
exit 0
@@ -989,14 +969,6 @@ jobs:
989969
chmod +x ${{ runner.tool_cache }}/sde/sde64
990970
if: matrix.sde != ''
991971

992-
- name: Configure ASAN
993-
run: |
994-
echo CARGO_PROFILE_DEV_OPT_LEVEL=2 >> $GITHUB_ENV
995-
echo CARGO_PROFILE_TEST_OPT_LEVEL=2 >> $GITHUB_ENV
996-
echo RUSTFLAGS=-Zsanitizer=address >> $GITHUB_ENV
997-
echo RUSTDOCFLAGS="-Zsanitizer=address -Copt-level=2 -Ccodegen-units=16" >> $GITHUB_ENV
998-
if: ${{ contains(matrix.name, 'ASAN') }}
999-
1000972
# Record some CPU details; this is helpful information if tests fail due
1001973
# to CPU-specific features.
1002974
- name: CPU information

ci/build-build-matrix.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,19 @@ const array = [
8282
"build": "x86_64-musl",
8383
"os": ubuntu,
8484
"target": "x86_64-unknown-linux-musl",
85-
"env": { "DOCKER_IMAGE": "./ci/docker/x86_64-musl/Dockerfile" },
85+
"env": {
86+
"DOCKER_IMAGE": "./ci/docker/x86_64-musl/Dockerfile",
87+
"RUSTFLAGS": "-Alinker-messages",
88+
},
8689
},
8790
{
8891
"build": "aarch64-musl",
8992
"os": ubuntu,
9093
"target": "aarch64-unknown-linux-musl",
91-
"env": { "DOCKER_IMAGE": "./ci/docker/aarch64-musl/Dockerfile" },
94+
"env": {
95+
"DOCKER_IMAGE": "./ci/docker/aarch64-musl/Dockerfile",
96+
"RUSTFLAGS": "-Alinker-messages",
97+
},
9298
},
9399
{
94100
"build": "aarch64-windows",

ci/build-test-matrix.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ const FAST_MATRIX = [
9494
//
9595
// * `rust` - the Rust version to install, and if unset this'll be set to
9696
// `default`
97+
//
98+
// * `env` - environment variables to set for this job.
9799
const FULL_MATRIX = [
98100
...FAST_MATRIX,
99101
{
@@ -115,6 +117,12 @@ const FULL_MATRIX = [
115117
"filter": "asan",
116118
"rust": "wasmtime-ci-pinned-nightly",
117119
"target": "x86_64-unknown-linux-gnu",
120+
"env": {
121+
"CARGO_PROFILE_DEV_OPT_LEVEL": 2,
122+
"CARGO_PROFILE_TEST_OPT_LEVEL": 2,
123+
"RUSTFLAGS": "-Zsanitizer=address",
124+
"RUSTDOCFLAGS": "-Zsanitizer=address -Copt-level=2 -Ccodegen-units=16",
125+
},
118126
},
119127
{
120128
"name": "Test Intel SDE",
@@ -135,6 +143,9 @@ const FULL_MATRIX = [
135143
"os": macos,
136144
"filter": "macos-arm64",
137145
"target": "aarch64-apple-darwin",
146+
"env": {
147+
"RUSTFLAGS": "-Alinker-messages",
148+
},
138149
},
139150
{
140151
"name": "Test MSVC x86_64",
@@ -352,6 +363,37 @@ async function main() {
352363
if (config.rust === undefined) {
353364
config.rust = 'default';
354365
}
366+
367+
if (config.qemu !== undefined) {
368+
if (config.env === undefined)
369+
config.env = {};
370+
config.env.QEMU_BUILD_VERSION = "10.0.3";
371+
372+
// QEMU emulation is not always the speediest, so total testing time
373+
// goes down if we build the libs in release mode when running tests.
374+
config.env.CARGO_PROFILE_DEV_OPT_LEVEL = 2;
375+
// See comments in the source for why we enable this during QEMU
376+
// emulation.
377+
config.env.WASMTIME_TEST_NO_HOG_MEMORY = 1;
378+
}
379+
380+
if (config.sde !== undefined) {
381+
if (config.env === undefined)
382+
config.env = {};
383+
config.env.SDE_BUILD_VERSION = "9.58.0-2025-06-16";
384+
385+
// SDE emulation is very slow, so use release mode for better performance
386+
config.env.CARGO_PROFILE_DEV_OPT_LEVEL = 2;
387+
388+
// Enable environment variable to indicate SDE is being used
389+
config.env.WASMTIME_TEST_SDE = 1;
390+
391+
// Generic variable for skipping tests that are problematic under SDE (performance, compatibility, etc.)
392+
config.env.WASMTIME_TEST_NO_SDE = 1;
393+
394+
// Similar to QEMU, reduce memory usage during SDE emulation
395+
config.env.WASMTIME_TEST_NO_HOG_MEMORY = 1;
396+
}
355397
}
356398

357399
// If the optional third argument to this script is `true` then that means all

0 commit comments

Comments
 (0)