diff --git a/.github/workflows/cron_cargo_mutants.yml b/.github/workflows/cron_cargo_mutants.yml new file mode 100644 index 00000000..b9da738a --- /dev/null +++ b/.github/workflows/cron_cargo_mutants.yml @@ -0,0 +1,49 @@ +name: Weekly cargo-mutants + +permissions: {} + +on: + schedule: + - cron: "0 0 * * 0" # runs weekly on Sunday at 00:00 + workflow_dispatch: # allows manual triggering + +jobs: + cargo-mutants: + name: Cargo Mutants + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: taiki-e/install-action@2383334cf567d78771fc7d89b6b3802ef1412cf6 + with: + tool: cargo-mutants + - run: cargo mutants --in-place --no-shuffle + - uses: actions/upload-artifact@v4 + with: + name: mutants.out + path: mutants.out + - name: Check for new mutants + if: always() + run: | + if [ -s mutants.out/missed.txt ]; then + echo "New missed mutants found" + MUTANTS_VERSION=$(cargo mutants --version) + gh issue create \ + --title "cargo-mutants: new mutants found" \ + --body "$(cat <> $GITHUB_ENV + else + echo "No new mutants found" + echo "create_issue=false" >> $GITHUB_ENV + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/justfile b/justfile index e7501ea3..58325c00 100644 --- a/justfile +++ b/justfile @@ -3,6 +3,7 @@ alias c := check alias f := fmt alias t := test alias p := pre-push +alias m := mutants # Build the project build: @@ -26,4 +27,8 @@ test: cargo test --workspace --exclude 'example_*' --all-features # Run pre-push suite: format, check, and test -pre-push: fmt check test \ No newline at end of file +pre-push: fmt check test + +# Run `cargo-mutants` for mutation testing +mutants: + cargo mutants --in-place --no-shuffle \ No newline at end of file