diff --git a/.cargo/mutants.toml b/.cargo/mutants.toml new file mode 100644 index 0000000..3ed309f --- /dev/null +++ b/.cargo/mutants.toml @@ -0,0 +1 @@ +profile = "mutants" diff --git a/.github/workflows/mutations.yml b/.github/workflows/mutations.yml new file mode 100644 index 0000000..e1a59d8 --- /dev/null +++ b/.github/workflows/mutations.yml @@ -0,0 +1,42 @@ +name: Test mutants + +permissions: + contents: read + +env: + CARGO_TERM_COLOR: always + +on: + push: + branches: + - main + pull_request: + +jobs: + incremental-mutants: + name: Incremental mutants test + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Relative diff + run: | + git branch -av + git diff origin/${{ github.base_ref }}.. | tee git.diff + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + - name: Install Rust toolchain + uses: taiki-e/install-action@v2 + with: + tool: cargo-mutants + - name: Mutants + run: | + cargo mutants --no-shuffle -vV --exclude "example-crates/**" --in-diff git.diff -- --all-targets + - name: Archive mutants.out + uses: actions/upload-artifact@v4 + if: always() + with: + name: mutants-incremental.out + path: mutants.out diff --git a/.gitignore b/.gitignore index 5348570..f8ac0d2 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ Cargo.lock # Ignore media (should go into media branch) *.gif + +# Ignore cargo-mutants generated output +/mutants.out* diff --git a/Cargo.toml b/Cargo.toml index 076aadb..6832a68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,3 +14,8 @@ print_stderr = "deny" [workspace.lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage,coverage_nightly)'] } + +[profile.mutants] +inherits = "test" +debug = "none" +opt-level = 3