Repository navigation
Mutation #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Mutation | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # Weekly, Monday 04:00 UTC. Non-blocking: this workflow is not in the | |
| # required-checks ruleset; a missed mutant is a review finding, not a | |
| # red X on someone's PR. | |
| - cron: "0 4 * * 1" | |
| permissions: | |
| contents: read | |
| jobs: | |
| mutants: | |
| name: cargo-mutants | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| - uses: ./.github/actions/rust-setup | |
| - name: Install Linux dependencies | |
| timeout-minutes: 8 | |
| uses: ./.github/actions/linux-deps | |
| with: | |
| cache-key: apt-webkit-ubuntu-latest-${{ runner.arch }}-v1 | |
| - name: Install cargo-mutants | |
| uses: taiki-e/install-action@7f4eb899022d8fe70b20c4f3de697aa85c309026 # v2.85.11 | |
| with: | |
| tool: cargo-mutants,nextest | |
| - name: Run targeted mutation tests | |
| working-directory: src-tauri | |
| # Scope comes from src-tauri/.cargo/mutants.toml (grants + file/create | |
| # commands). Gate on the report, not the exit code: the clean baseline | |
| # includes a mutant killed by timeout (an infinite-loop mutation), which | |
| # makes cargo-mutants exit 3, and exit 3 also masks misses when both | |
| # occur in one run. Missed mutants are the only failure condition, | |
| # keeping the documented baseline non-decreasing | |
| # (docs/engineering-invariants.md). | |
| run: | | |
| cargo mutants -j 2 --no-shuffle --test-tool=nextest && ec=0 || ec=$? | |
| if [ -s mutants.out/missed.txt ]; then | |
| echo "Missed mutants:" | |
| cat mutants.out/missed.txt | |
| exit 2 | |
| fi | |
| if [ "$ec" -ne 0 ] && [ "$ec" -ne 3 ]; then | |
| exit "$ec" | |
| fi | |
| - name: Upload mutation report | |
| if: always() | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: mutants-report | |
| path: src-tauri/mutants.out/ | |
| retention-days: 30 |