-
Notifications
You must be signed in to change notification settings - Fork 195
100 lines (89 loc) · 2.84 KB
/
Copy pathmutation-testing.yml
File metadata and controls
100 lines (89 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Mutation Testing
# Minimal permissions for security
permissions:
contents: read
on:
# Run weekly on Sundays at 3 AM UTC (offset from KEMs to avoid resource contention)
schedule:
- cron: "0 3 * * 0"
# Allow manual triggering
workflow_dispatch:
inputs:
package:
description: "Package to test (select 'all' for all packages)"
required: false
default: "all"
type: choice
options:
- all
- ml-dsa
- slh-dsa
- ecdsa
- dsa
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_MIN_STACK: 6291456
# Only run one mutation test at a time
concurrency:
group: mutation-testing
cancel-in-progress: false
jobs:
mutants:
name: ${{ matrix.package }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
- ml-dsa
- slh-dsa
# Only filter if a specific package was requested via workflow_dispatch
exclude:
- package: ${{ github.event.inputs.package != 'all' && github.event.inputs.package != 'ml-dsa' && 'ml-dsa' || 'NONE' }}
- package: ${{ github.event.inputs.package != 'all' && github.event.inputs.package != 'slh-dsa' && 'slh-dsa' || 'NONE' }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4.2.2
with:
persist-credentials: false
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
prefix-key: mutants-${{ matrix.package }}
- name: Install cargo-mutants
run: cargo install cargo-mutants@26.1.2 --locked
- name: Run mutation testing
run: |
cargo mutants --package "${{ matrix.package }}" --all-features -j 2 --timeout 300 2>&1 | tee mutants-output.txt
# Extract summary for job summary
{
echo "## Mutation Testing Results: ${{ matrix.package }}"
echo ""
echo '```'
tail -20 mutants-output.txt
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload mutation results
uses: actions/upload-artifact@v7
if: always()
with:
name: mutants-${{ matrix.package }}
path: |
mutants.out/
mutants-output.txt
retention-days: 30
- name: Check for missed mutants
if: always()
run: |
if [ -f mutants.out/missed.txt ] && [ -s mutants.out/missed.txt ]; then
echo "::warning::Some mutations were not caught by tests"
{
echo "### Missed Mutations"
echo '```'
cat mutants.out/missed.txt
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
fi