Skip to content

feat(python): require full sharded mutation on pull requests #1088

feat(python): require full sharded mutation on pull requests

feat(python): require full sharded mutation on pull requests #1088

Workflow file for this run

name: CI
on:
workflow_call:
pull_request:
merge_group:
branches:
- main
push:
branches:
- main
permissions: {}
defaults:
run:
shell: bash
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- run: bash .github/scripts/actionlint.sh
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
version: "0.12.17"
- run: uv sync --locked
- name: Run SDK quality checks
run: uv run --locked poe checks
- name: Preserve runtime coverage
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-for-python-${{ matrix.python-version }}
path: reports/coverage.json
if-no-files-found: error
- name: Preserve test failures and property seeds
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: property-failures-python-${{ matrix.python-version }}
path: |
reports/unit.xml
reports/coverage-unit.xml
reports/hypothesis/seed.txt
if-no-files-found: ignore
mutation:
name: Mutation Gate (${{ matrix.shard }})
runs-on: ubuntu-latest
timeout-minutes: 90
permissions:
contents: read
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
version: "0.12.17"
- run: uv sync --locked
- name: Mutate all handwritten runtime modules in this shard
env:
MUTATION_SHARD_INDEX: ${{ matrix.shard }}
MUTATION_SHARD_COUNT: 23
run: uv run --locked poe mutation-full
- name: Preserve mutation outcomes
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: mutation-outcomes-${{ matrix.shard }}
path: reports/mutation.json
if-no-files-found: error
quality:
name: Quality Gate
if: ${{ always() }}
needs: [test, mutation]
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.12"
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
pattern: mutation-outcomes-*
path: reports/shards
- name: Require every runtime module in one mutation shard
run: |
git ls-files -z 'src/volcano_sdk/*.py' > reports/shards/source.bin
python -m scripts.check_mutation_shards reports/shards reports/shards/source.bin 23
- name: Require every mandatory job to succeed
env:
RESULTS: ${{ toJSON(needs.*.result) }}
run: jq -e 'length == 2 and all(. == "success")' <<< "$RESULTS"