Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Run clippy; update versions; add overall success #447

Merged
merged 7 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release-book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ jobs:
with:
tool: mdbook, mdbook-linkcheck
- name: Setup Pages
uses: actions/configure-pages@v2
uses: actions/configure-pages@v5
- name: Build book
run: |
mdbook build book
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: "book/book/html"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
104 changes: 81 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,51 @@ env:
CARGO_MUTANTS_MINIMUM_TEST_TIMEOUT: 60

jobs:
# Before anything else, run a quick test on just stable: this is significantly
# faster than Windows or macOS and should catch most issues, and lets us get
# started on the longer-running mutants and other tests.
#
# Also, build a Linux binary that we can use for the later mutants runs.
quick-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@master
with:
toolchain: beta
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Show Cargo and rustc version
run: |
cargo --version
rustc --version
# TODO: Maybe also check clippy and rustfmt here.
- name: Build
run: cargo build --all-targets
- uses: taiki-e/install-action@v2
name: Install nextest using install-action
with:
tool: nextest
- name: Test
run: cargo test --workspace
- name: Check rustfmt
run: cargo fmt --all --check
- name: Check clippy
# TODO: -- -D warnings
run: cargo clippy --all-targets --all-features
- name: Build release binary
run: cargo build --release
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: cargo-mutants-linux
path: |
target/release/cargo-mutants

test:
needs: [quick-test]
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
Expand All @@ -50,7 +94,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.version }}
components: rustfmt
components: rustfmt, clippy
- name: Show Cargo and rustc version
run: |
cargo --version
Expand All @@ -66,8 +110,14 @@ jobs:
run: cargo build --all-targets
- name: Test
run: cargo test --workspace
- name: Check rustfmt
run: cargo fmt --all --check
- name: Check clippy
# TODO: Deny warnings
run: cargo clippy --all-targets --all-features

minimal-versions:
needs: [quick-test]
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
Expand All @@ -86,6 +136,7 @@ jobs:

# Run `cargo update` and check the tests still pass
maximal-versions:
needs: [quick-test]
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
Expand All @@ -102,6 +153,7 @@ jobs:
- run: cargo test

tests-from-tarball:
needs: [quick-test]
strategy:
matrix:
os: [ubuntu-latest]
Expand Down Expand Up @@ -136,6 +188,7 @@ jobs:
# their MSRV, and on every platform because there are platform-specific
# dependencies.
install:
needs: [quick-test]
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
Expand All @@ -154,29 +207,10 @@ jobs:
- run: cargo install --locked --path .
- run: cargo install --path .

release-binary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@master
with:
toolchain: beta
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: cargo-mutants-linux
path: |
target/release/cargo-mutants

pr-mutants:
runs-on: ubuntu-latest
needs: [release-binary]
if: github.event_name == 'pull_request'
needs: [quick-test]
strategy:
matrix:
test_tool: [cargo, nextest]
Expand Down Expand Up @@ -206,7 +240,8 @@ jobs:
- name: Mutants in-diff
# Normally this would have --in-place, but for the sake of exercising more cases, it does not.
run: >
cargo mutants --no-shuffle -vV --in-diff git.diff --test-tool=${{matrix.test_tool}} --timeout=500 --build-timeout=500
cargo mutants --no-shuffle -vV --in-diff git.diff
--test-tool=${{matrix.test_tool}} --timeout=500 --build-timeout=500
- name: Archive mutants.out
uses: actions/upload-artifact@v4
if: always()
Expand All @@ -216,7 +251,7 @@ jobs:

cargo-mutants:
runs-on: ubuntu-latest
needs: [test, release-binary]
needs: [quick-test]
strategy:
fail-fast: false # We want to get all the mutant failures
matrix:
Expand Down Expand Up @@ -261,3 +296,26 @@ jobs:

- name: Check spelling
uses: crate-ci/typos@master

overall-result:
needs:
[
quick-test,
test,
minimal-versions,
maximal-versions,
tests-from-tarball,
install,
pr-mutants,
cargo-mutants,
typos,
]
runs-on: ubuntu-latest
if: always()
steps:
- name: Successful workflow
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Failing workflow
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1