Skip to content

Commit

Permalink
Merge pull request #928 from rustsec/faster-ci-2
Browse files Browse the repository at this point in the history
Faster CI for `cargo audit` tests
  • Loading branch information
Shnatsel authored Aug 8, 2023
2 parents 03defdb + 2f85f63 commit bcb34ca
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 41 deletions.
34 changes: 5 additions & 29 deletions .github/workflows/cargo-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,71 +37,47 @@ jobs:
strategy:
matrix:
toolchain:
- 1.67.0 # MSRV
- 1.71.0 # sparse index by default for faster CI
- stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
- uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
profile: minimal
override: true
- run: cargo test --all-features --release
- run: cargo test --all-features

test-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
- uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- run: cargo test --all-features --release
- run: cargo test --all-features

test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
- uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- run: cargo test --all-features --release
- run: cargo test --all-features

doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.67.0 # MSRV
toolchain: 1.71.0 # sparse index by default for faster CI
override: true
profile: minimal
- run: cargo doc --all-features
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quitters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
rust:
- 1.56.0
- 1.67.0 # MSRV of `cargo audit`, should be bumped in tandem
- stable
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/rustsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
override: true
profile: minimal
- run: cargo check
- run: cargo test --no-default-features --release
- run: cargo test --release
- run: cargo test --all-features --release
- run: cargo test --no-default-features
- run: cargo test
- run: cargo test --all-features

doc:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.67.0
toolchain: 1.67.0 # MSRV
components: clippy
override: true
profile: minimal
Expand Down
8 changes: 1 addition & 7 deletions cargo-audit/tests/binary_scanning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@ static ADVISORY_DB_DIR: Lazy<TempDir> = Lazy::new(|| TempDir::new().unwrap());
/// be multithreaded invocations as `cargo test` executes tests in
/// parallel by default.
pub static RUNNER: Lazy<CmdRunner> = Lazy::new(|| {
// reimplement CmdRunner::default but with --all-features flag
let mut runner = CmdRunner::new("cargo");
runner.args(["run", "--all-features", "--"]);
runner.exclusive();
runner.capture_stdout();
runner.capture_stderr();
// feed it the command-line arguments specific to the test
let mut runner = CmdRunner::default();
runner
.arg("audit")
.arg("bin")
Expand Down

0 comments on commit bcb34ca

Please sign in to comment.