diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7f29991..839c073 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,32 +5,60 @@ on: push: jobs: - check: - name: Check + stable: + name: Test + Clippy (stable) runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: ATiltedTree/setup-rust@v1 - with: - rust-version: stable - - run: cargo check + - run: | + set -e + rustup toolchain install stable --no-self-update + rustup default stable + rustup component add clippy + RUSTFLAGS=-Dwarnings cargo test + cargo clippy -- -Dwarnings + RUSTFLAGS=-Dwarnings cargo build --manifest-path fuzz/Cargo.toml --all - test: - name: Test + nightly: + name: Test + Clippy (nightly) runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: ATiltedTree/setup-rust@v1 - with: - rust-version: stable - - run: cargo test - - test_no_default_features: - name: Test (no default features) + - run: | + set -e + rustup toolchain install nightly --no-self-update + rustup default nightly + rustup component add clippy + RUSTFLAGS=-Dwarnings cargo test + cargo clippy -- -Dwarnings + RUSTFLAGS=-Dwarnings cargo build --manifest-path fuzz/Cargo.toml --all + + stable-no-default-features: + name: Test + Clippy (stable, no default features) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: | + set -e + rustup toolchain install stable --no-self-update + rustup default stable + rustup component add clippy + RUSTFLAGS=-Dwarnings cargo test --no-default-features && cargo clippy --no-default-features -- -Dwarnings + + msrv: + name: Test (MSRV) runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: ATiltedTree/setup-rust@v1 - with: - rust-version: stable - - run: cargo test --no-default-features + - run: | + set -e + rustup toolchain install 1.46 --no-self-update + rustup default 1.46 + # We expect an unknown_lints warning on 1.46. + # Any new warnings added should be flagged because they might indicate + # a bug, but feel free to add them to -A below if they are harmless and + # don't happen on newer Rust versions. + # Also, no Clippy because we probably don't care what old Clippy + # thinks. + RUSTFLAGS='-Dwarnings -Aunknown_lints' cargo test + diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index c7802cb..2bf5bc1 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "arbitrary" @@ -358,7 +358,7 @@ dependencies = [ [[package]] name = "shlex" -version = "1.3.0" +version = "1.3.1" [[package]] name = "shlex-fuzz" diff --git a/fuzz/fuzz_targets/fuzz_quote.rs b/fuzz/fuzz_targets/fuzz_quote.rs index 2178dde..b640159 100644 --- a/fuzz/fuzz_targets/fuzz_quote.rs +++ b/fuzz/fuzz_targets/fuzz_quote.rs @@ -1,9 +1,9 @@ #![no_main] #[macro_use] extern crate libfuzzer_sys; -use shlex::quote; +use shlex::try_quote; fuzz_target!(|data: &[u8]| { if let Ok(s) = std::str::from_utf8(data) { - quote(s); + let _ = try_quote(s); } });