Skip to content

Commit e8f13f8

Browse files
committed
Merge #241: Replaced mutagen with cargo-mutants
43b48a5 Replaced mutagen with cargo-mutants (HrushikeshAnandSarangi) Pull request description: Replaced mutagen with cargo-mutants #238 Overview: - removed all dependencies of `mutagen`. - Integrated `cargo mutants` and a workflow for raising issues weekly for top 10 mutations found. Please let me know if any additional changes are required. ACKs for top commit: tcharding: ACK 43b48a5 apoelstra: ACK 43b48a5; successfully ran local tests Tree-SHA512: 832c71cfc8b1831f57bb21ac583055604507b1b4825d988a6bcf707c09cd1cea3ad21d8a96a5f25e5657d4a8d03bfdc8250cf4c16c44a9a1dca3bd756f2cf521
2 parents a274493 + 43b48a5 commit e8f13f8

5 files changed

Lines changed: 62 additions & 7 deletions

File tree

.cargo/mutants.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
additional_cargo_args = ["--all-features"]
2+
examine_globs = ["src/**/*.rs"]
3+
exclude_globs = []
4+
exclude_re = [
5+
#benchmarks
6+
"benches::",
7+
]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Weekly cargo-mutants
2+
on:
3+
schedule:
4+
- cron: "0 0 * * 0" # runs weekly on Sunday at 00:00
5+
workflow_dispatch: # allows manual triggering
6+
permissions: {}
7+
jobs:
8+
cargo-mutants:
9+
runs-on: ubuntu-24.04
10+
permissions:
11+
contents: read
12+
issues: write
13+
steps:
14+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
15+
with:
16+
persist-credentials: false
17+
- uses: taiki-e/install-action@81ee1d48d9194cdcab880cbdc7d36e87d39874cb # v2.62.45
18+
with:
19+
tool: cargo-mutants
20+
- name: Generate Cargo.lock
21+
run: cargo generate-lockfile
22+
- run: cargo mutants --in-place --no-shuffle
23+
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
24+
if: always()
25+
with:
26+
name: mutants.out
27+
path: mutants.out
28+
- name: Check for new mutants
29+
if: always()
30+
run: |
31+
if [ -s mutants.out/missed.txt ]; then
32+
echo "New missed mutants found"
33+
MUTANTS_VERSION=$(cargo mutants --version)
34+
gh issue create \
35+
--title "New Mutants Found" \
36+
--body "$(cat <<EOF
37+
Displaying up to the first 10 mutants:
38+
\`\`\`
39+
$(head -n 10 mutants.out/missed.txt)
40+
\`\`\`
41+
Running cargo mutants version: ${MUTANTS_VERSION}
42+
For the complete list, please check the [mutants.out artifact](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
43+
EOF
44+
)"
45+
echo "create_issue=true" >> $GITHUB_ENV
46+
else
47+
echo "No new mutants found"
48+
echo "create_issue=false" >> $GITHUB_ENV
49+
fi
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
**/target
22
*.o
33
/Cargo.lock
4+
**/mutants.out
5+
**/mutants.out.old
46

57
/embedded/no-allocator/Cargo.lock
68
/embedded/no-allocator/.cargo

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,5 @@ default = ["std"]
1616
std = ["alloc"]
1717
alloc = []
1818

19-
[target.'cfg(mutate)'.dev-dependencies]
20-
mutagen = { git = "https://github.com/llogiq/mutagen" }
21-
2219
[lints.rust]
23-
unexpected_cfgs = { level = "deny", check-cfg = [ 'cfg(bench)', 'cfg(kani)', 'cfg(mutate)' ] }
20+
unexpected_cfgs = { level = "deny", check-cfg = [ 'cfg(bench)', 'cfg(kani)' ] }

src/primitives/gf32.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
use core::convert::{Infallible, TryFrom};
1616
use core::{fmt, num};
1717

18-
#[cfg(all(test, mutate))]
19-
use mutagen::mutate;
20-
2118
use super::{Bech32Field, Field};
2219
use crate::error::write_err;
2320

0 commit comments

Comments
 (0)