Skip to content

Commit 5582eeb

Browse files
Make -Dwarnings mandatory when running build-and-test
1 parent e599b32 commit 5582eeb

4 files changed

Lines changed: 15 additions & 0 deletions

File tree

.github/workflows/linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ jobs:
3636
rustup target add ${{ matrix.target }}
3737
3838
- name: Build and Test
39+
env: RUSTFLAGS: -D warnings
3940
run: cargo run --bin ci-integration build-and-test

.github/workflows/mac.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ jobs:
3232
rustup target add ${{ matrix.target }}
3333
3434
- name: Build and Test
35+
env: RUSTFLAGS: -D warnings
3536
run: cargo run --bin ci-integration build-and-test

.github/workflows/windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ jobs:
5858
shell: bash
5959

6060
- name: Build and Test
61+
env: RUSTFLAGS: -D warnings
6162
run: cargo run --bin ci-integration build-and-test

ci/build_and_test.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ fn run_tests_in_dir(env: &HashMap<&str, &str>, dir: &str) -> Result<(), String>
88
}
99

1010
pub fn runner() -> Result<(), String> {
11+
let Some(rustflags) = std::env::var("RUSTFLAGS") else {
12+
return Err(
13+
"`RUSTFLAGS` environment variable must be set to run `build-and-test`".to_string(),
14+
);
15+
};
16+
if !rustflags.contains("-D warnings") && !rustflags.contains("-Dwarnings") {
17+
return Err(
18+
"`RUSTFLAGS` environment variable must contain `-Dwarnings` to run `build-and-test`"
19+
.to_string(),
20+
);
21+
}
22+
1123
let env = HashMap::from([("RUSTFLAGS", "-D warnings"), ("RUSTFMT_CI", "1")]);
1224

1325
// Print version information

0 commit comments

Comments
 (0)