From 0d9fb9a68214d13b20b4d9ad21d6fe3ce28ccc73 Mon Sep 17 00:00:00 2001 From: Leonardo Lima Date: Tue, 8 Jul 2025 15:02:14 -0300 Subject: [PATCH 1/2] ci: add new cargo-mutants weekly job - following the rust-bitcoin's weekly job, it adds a new one to `bdk_wallet` that runs the `cargo mutants` and open a new issue reporting the found mutants, if any. --- .github/workflows/cron_cargo_mutants.yml | 49 ++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/cron_cargo_mutants.yml 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 }} From 5bf19491acaa6ba3fa96039e1ae2c7435d3657b6 Mon Sep 17 00:00:00 2001 From: Leonardo Lima Date: Tue, 8 Jul 2025 15:32:57 -0300 Subject: [PATCH 2/2] chore(justfile): add `cargo mutants` to justfile --- justfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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