Repository navigation
Mutation #5
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: | |
| schedule: | |
| - cron: "0 4 * * 1" # weekly, Monday 04:00 UTC | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: true | |
| jobs: | |
| mutation: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| module: [base, numeric, string, contains, collection, dict, date, matchers, helpers, _compare, dataframe, json_mixin, snapshot, bytes_mixin, dynamic, extracting, warning, exception, async_assertions, file, behave_matchers] | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | |
| with: | |
| python-version: "3.14" | |
| - name: Install dependencies | |
| run: uv sync --extra json --extra behave --group mutation | |
| - name: Run mutation testing | |
| env: | |
| MODULE: ${{ matrix.module }} | |
| run: | | |
| cat > cosmic-ray.toml <<EOF | |
| [cosmic-ray] | |
| module-path = "assertpy2/${MODULE}.py" | |
| # Bounds each test run, including the baseline that runs the whole suite once. | |
| # Must exceed the full-suite runtime under 21-way matrix contention, or the baseline | |
| # spuriously times out and the module's job dies before mutating anything. | |
| timeout = 120.0 | |
| excluded-modules = [] | |
| test-command = ".venv/bin/python -m pytest tests/ -x -q -p no:cacheprovider" | |
| [cosmic-ray.distributor] | |
| name = "local" | |
| EOF | |
| uv run cosmic-ray baseline cosmic-ray.toml | |
| uv run cosmic-ray init cosmic-ray.toml session.sqlite | |
| uv run cosmic-ray exec cosmic-ray.toml session.sqlite | |
| { | |
| echo "### Mutation: ${MODULE}.py" | |
| echo "" | |
| echo "Surviving mutants: $(uv run cr-rate session.sqlite)%" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| echo "::group::Surviving mutants (${MODULE}.py)" | |
| uv run cr-report session.sqlite | |
| echo "::endgroup::" |