Skip to content

Commit

Permalink
✅ Run cargo-mutants
Browse files Browse the repository at this point in the history
  • Loading branch information
leon0399 committed Apr 19, 2024
1 parent 0bb44d6 commit b8eda8d
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 28 deletions.
110 changes: 83 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,60 @@ jobs:
with:
command: check

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features

coverage:
name: Test Coverage
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin
options: --security-opt seccomp=unconfined
needs: [ test ]
strategy:
matrix:
flags:
Expand All @@ -47,7 +95,10 @@ jobs:
toolchain: nightly
override: true
- uses: Swatinem/rust-cache@v2
# - run: cargo install tarpaulin
- uses: taiki-e/install-action@v2
name: Install cargo-tarpaulin using install-action
with:
tool: cargo-tarpaulin
- uses: actions-rs/cargo@v1
with:
command: tarpaulin
Expand All @@ -66,36 +117,41 @@ jobs:
flags: ${{ matrix.flags }}
fail_ci_if_error: true

fmt:
name: Rustfmt
cargo-mutants:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
# Often you'll want to only run this after the build is known to pass its basic tests,
# to avoid wasting time, and to allow using --baseline=skip.
needs: [ test ]
strategy:
fail-fast: false # Collect all mutants even if some are missed
matrix:
shard: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
fetch-depth: 0
- name: Relative diff
run: |
git branch -av
git diff origin/${{ github.base_ref }}.. | tee git.diff
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
- uses: taiki-e/install-action@v2
name: Install cargo-mutants using install-action
with:
command: clippy
args: -- -D warnings
tool: cargo-mutants
# Set an appropriate timeout for your tree here.
# The denominator of the shard count must be the number of shards.
- name: Mutants
run: |
cargo mutants --no-shuffle -vV --shard ${{ matrix.shard }}/8 --baseline=skip --timeout 300 --in-place --in-diff git.diff
- name: Archive mutants.out
uses: actions/upload-artifact@v4
if: always()
with:
path: mutants.out
name: mutants-shard${{matrix.shard}}.out
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/target
/target/
/mutants.out/
/mutants.out.old/
/.cargo/config.toml
/Cargo.lock

0 comments on commit b8eda8d

Please sign in to comment.