Mutation Testing #7
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 Testing | |
| # Minimal permissions for security | |
| permissions: | |
| contents: read | |
| on: | |
| # Run weekly on Sundays at 2 AM UTC | |
| schedule: | |
| - cron: "0 2 * * 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-kem | |
| - module-lattice | |
| - dhkem | |
| #- frodo-kem | |
| - x-wing | |
| env: | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_TERM_COLOR: always | |
| # 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-kem | |
| - module-lattice | |
| - dhkem | |
| #- frodo-kem | |
| - x-wing | |
| # Only filter if a specific package was requested via workflow_dispatch | |
| # For push/pull_request events, inputs.package is undefined, so default to 'all' | |
| exclude: | |
| - package: ${{ (github.event.inputs.package || 'all') != 'all' && (github.event.inputs.package || 'all') != 'ml-kem' && 'ml-kem' || 'NONE' }} | |
| - package: ${{ (github.event.inputs.package || 'all') != 'all' && (github.event.inputs.package || 'all') != 'module-lattice' && 'module-lattice' || 'NONE' }} | |
| - package: ${{ (github.event.inputs.package || 'all') != 'all' && (github.event.inputs.package || 'all') != 'dhkem' && 'dhkem' || 'NONE' }} | |
| #- package: ${{ (github.event.inputs.package || 'all') != 'all' && (github.event.inputs.package || 'all') != 'frodo-kem' && 'frodo-kem' || 'NONE' }} | |
| - package: ${{ (github.event.inputs.package || 'all') != 'all' && (github.event.inputs.package || 'all') != 'x-wing' && 'x-wing' || 'NONE' }} | |
| steps: | |
| - uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.2.2 | |
| with: | |
| persist-credentials: false | |
| submodules: recursive | |
| - uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # stable | |
| with: | |
| toolchain: stable | |
| - uses: Swatinem/rust-cache@v2.8.2 | |
| 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 -5 mutants-output.txt | |
| echo '```' | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload mutation results | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| if: always() | |
| with: | |
| name: mutants-${{ matrix.package }} | |
| path: | | |
| mutants.out/ | |
| mutants-output.txt | |
| retention-days: 30 |