---
name: Mutants
"on":
pull_request:
push:
branches:
- main
permissions:
contents: read
concurrency:
group: mutants-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
mutants:
name: Mutation testing
runs-on: ubuntu-latest
timeout-minutes: 45
if: >-
github.event_name == 'push' ||
(github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.user.login != 'dependabot[bot]')
steps:
- uses: actions/checkout@v4
- name: Cache cargo downloads
uses: actions/cache@v6
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: dl-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
dl-${{ runner.os }}-
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-mutants
run: cargo install cargo-mutants --locked
- name: Run mutants
run: >-
cargo mutants --cap-lints true --timeout 180
-E 'delete match arm (syn::)?(ImplItem|TraitItem|ForeignItem)::Macro\(m\) in (impl_assoc_name|trait_assoc_name|foreign_name|assoc_attrs|trait_assoc_attrs|foreign_attrs)'
-E 'replace match guard mac\.path\.is_ident\("concat"\) with true'
-E 'replace \|\| with && in single_segment_type_name'
-E 'replace \+ with [-*] in merge_parts'
-E 'replace > with >= in block_star_strip'
-E 'delete ! in block_star_strip'
-E 'replace == with != in block_star_strip'
-E 'replace \+ with - in flat_literal'