Skip to content

Commit 7b1e624

Browse files
committed
Update GitHub workflow.
- Stop using ATiltedTree/setup-rust@v1 because it apparently no longer exists. The runners have rustup installed by default, so use that. - Remove the separate `cargo check` job, since `cargo test` should be a superset of it. - Add a test on nightly with default features. - Add a test on MSRV (1.46) with default features. - Add `-Dwarnings` to all jobs so that the presence of any warnings causes the job to fail. For the MSRV job, this requires allowlisting an `unknown_lints` warning that's known to occur there. Note that newer Rust versions may cause existing code to start producing warnings, so there is no guarantee in general that this crate compiles without warnings. But it still makes sense to have this check in CI. If someone is making changes to this crate, they should fix any warnings that have cropped up. - Add a run of `cargo clippy` to the stable, stable-no-default-features, and nightly jobs. Probably not useful for MSRV. - Add a build of all fuzz targets to the stable and nightly jobs. Running them would probably be too expensive. - Fix a warning in one of the fuzz targets. - Update `fuzz/ Cargo.lock` (this happened automatically when I built the fuzz targets).
1 parent 233303e commit 7b1e624

File tree

3 files changed

+43
-23
lines changed

3 files changed

+43
-23
lines changed

.github/workflows/test.yml

+39-19
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,52 @@ on:
55
push:
66

77
jobs:
8-
check:
9-
name: Check
8+
stable:
9+
name: Test + Clippy (stable)
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v2
13-
- uses: ATiltedTree/setup-rust@v1
14-
with:
15-
rust-version: stable
16-
- run: cargo check
13+
- run: rustup toolchain install stable --no-self-update
14+
- run: rustup default stable
15+
- run: rustup component add clippy
16+
- run: RUSTFLAGS=-Dwarnings cargo test
17+
- run: cargo clippy -- -Dwarnings
18+
- run: RUSTFLAGS=-Dwarnings cargo build --manifest-path fuzz/Cargo.toml --all
1719

18-
test:
19-
name: Test
20+
nightly:
21+
name: Test + Clippy (nightly)
2022
runs-on: ubuntu-latest
2123
steps:
2224
- uses: actions/checkout@v2
23-
- uses: ATiltedTree/setup-rust@v1
24-
with:
25-
rust-version: stable
26-
- run: cargo test
27-
28-
test_no_default_features:
29-
name: Test (no default features)
25+
- run: rustup toolchain install nightly --no-self-update
26+
- run: rustup default nightly
27+
- run: rustup component add clippy
28+
- run: RUSTFLAGS=-Dwarnings cargo test
29+
- run: cargo clippy -- -Dwarnings
30+
- run: RUSTFLAGS=-Dwarnings cargo build --manifest-path fuzz/Cargo.toml --all
31+
32+
stable-no-default-features:
33+
name: Test + Clippy (stable, no default features)
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v2
37+
- run: rustup toolchain install stable --no-self-update
38+
- run: rustup default stable
39+
- run: rustup component add clippy
40+
- run: RUSTFLAGS=-Dwarnings cargo test --no-default-features && cargo clippy --no-default-features -- -Dwarnings
41+
42+
msrv:
43+
name: Test (MSRV)
3044
runs-on: ubuntu-latest
3145
steps:
3246
- uses: actions/checkout@v2
33-
- uses: ATiltedTree/setup-rust@v1
34-
with:
35-
rust-version: stable
36-
- run: cargo test --no-default-features
47+
- run: rustup toolchain install 1.46 --no-self-update
48+
- run: rustup default 1.46
49+
- run: # We expect an unknown_lints warning on 1.46.
50+
- run: # Any new warnings added should be flagged because they might indicate
51+
- run: # a bug, but feel free to add them to -A below if they are harmless and
52+
- run: # don't happen on newer Rust versions.
53+
- run: # Also, no Clippy because we probably don't care what old Clippy
54+
- run: # thinks.
55+
- run: RUSTFLAGS='-Dwarnings -Aunknown_lints' cargo test
56+

fuzz/Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fuzz/fuzz_targets/fuzz_quote.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#![no_main]
22
#[macro_use] extern crate libfuzzer_sys;
3-
use shlex::quote;
3+
use shlex::try_quote;
44

55
fuzz_target!(|data: &[u8]| {
66
if let Ok(s) = std::str::from_utf8(data) {
7-
quote(s);
7+
let _ = try_quote(s);
88
}
99
});

0 commit comments

Comments
 (0)