Skip to content

Commit

Permalink
Update GitHub workflow.
Browse files Browse the repository at this point in the history
- 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).
  • Loading branch information
comex committed Dec 27, 2024
1 parent 233303e commit 7b1e624
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 23 deletions.
58 changes: 39 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,52 @@ 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: rustup toolchain install stable --no-self-update
- run: rustup default stable
- run: rustup component add clippy
- run: RUSTFLAGS=-Dwarnings cargo test
- run: cargo clippy -- -Dwarnings
- run: 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: rustup toolchain install nightly --no-self-update
- run: rustup default nightly
- run: rustup component add clippy
- run: RUSTFLAGS=-Dwarnings cargo test
- run: cargo clippy -- -Dwarnings
- run: 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: rustup toolchain install stable --no-self-update
- run: rustup default stable
- run: rustup component add clippy
- run: 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: rustup toolchain install 1.46 --no-self-update
- run: rustup default 1.46
- run: # We expect an unknown_lints warning on 1.46.
- run: # Any new warnings added should be flagged because they might indicate
- run: # a bug, but feel free to add them to -A below if they are harmless and
- run: # don't happen on newer Rust versions.
- run: # Also, no Clippy because we probably don't care what old Clippy
- run: # thinks.
- run: RUSTFLAGS='-Dwarnings -Aunknown_lints' cargo test

4 changes: 2 additions & 2 deletions fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions fuzz/fuzz_targets/fuzz_quote.rs
Original file line number Diff line number Diff line change
@@ -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);
}
});

0 comments on commit 7b1e624

Please sign in to comment.