Skip to content

Commit 4565ea4

Browse files
committed
CI: Add mutation testing workflow
1 parent c266bfa commit 4565ea4

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/mutants.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Mutation testing
2+
3+
env:
4+
CARGO_TERM_COLOR: always
5+
6+
on:
7+
# Run weekly on Sundays at 2 AM UTC
8+
schedule:
9+
- cron: "0 2 * * 0"
10+
# Allow manual triggering
11+
workflow_dispatch:
12+
inputs:
13+
package:
14+
description: "Package to test (select 'all' for all packages)"
15+
required: false
16+
default: "all"
17+
type: choice
18+
options:
19+
- all
20+
- age
21+
- age-core
22+
- age-plugin
23+
- rage
24+
25+
permissions:
26+
contents: read
27+
28+
# Only run one mutation test at a time
29+
concurrency:
30+
group: mutation-testing
31+
cancel-in-progress: false
32+
33+
jobs:
34+
mutants:
35+
name: Mutation testing of ${{ matrix.package }}
36+
runs-on: ubuntu-latest
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
package:
41+
- age
42+
- age-core
43+
- age-plugin
44+
- rage
45+
# Only filter if a specific package was requested via workflow_dispatch
46+
# For push/pull_request events, inputs.package is undefined, so default to 'all'
47+
exclude:
48+
- package: ${{ case((github.event.inputs.package || 'all') != 'all' && (github.event.inputs.package || 'all') != 'age', 'age', 'NONE') }}
49+
- package: ${{ case((github.event.inputs.package || 'all') != 'all' && (github.event.inputs.package || 'all') != 'age-core', 'age-core', 'NONE') }}
50+
- package: ${{ case((github.event.inputs.package || 'all') != 'all' && (github.event.inputs.package || 'all') != 'age-plugin', 'age-plugin', 'NONE') }}
51+
- package: ${{ case((github.event.inputs.package || 'all') != 'all' && (github.event.inputs.package || 'all') != 'rage', 'rage', 'NONE') }}
52+
53+
steps:
54+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
55+
with:
56+
persist-credentials: false
57+
- uses: dtolnay/rust-toolchain@stable
58+
id: toolchain
59+
- run: rustup override set "${TOOLCHAIN}"
60+
shell: sh
61+
env:
62+
TOOLCHAIN: ${{steps.toolchain.outputs.name}}
63+
- uses: taiki-e/install-action@650c5ca14212efbbf3e580844b04bdccf68dac31 # v2.67.18
64+
with:
65+
tool: cargo-mutants
66+
- run: cargo mutants --package "${{ matrix.package }}" --all-features -vV --in-place
67+
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
68+
if: always()
69+
with:
70+
name: mutants-${{ matrix.package }}
71+
path: |
72+
mutants.out/
73+
retention-days: 30

0 commit comments

Comments
 (0)