diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2f4a237c2..2984427f6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,9 +1,18 @@ name: tests on: + # A pull request is tested once (not again for its branch push); main and release tags are tested on push. push: + branches: [main] + tags: ["v*"] pull_request: workflow_dispatch: + schedule: + - cron: "17 4 * * 1" # weekly: the full matrix, including every macOS Python version + +concurrency: + group: tests-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: contents: read @@ -16,6 +25,7 @@ jobs: # The first two job names are required status checks of the branch ruleset; keep them # exactly as they are. The others are informational. name: ${{ matrix.job }} + timeout-minutes: 30 strategy: fail-fast: false matrix: @@ -53,14 +63,6 @@ jobs: os: windows-latest python: "3.15" pytest_args: "-q" - - job: "pytest-extra (macos-latest, python 3.11)" - os: macos-latest - python: "3.11" - pytest_args: "-n auto -q" - - job: "pytest-extra (macos-latest, python 3.15)" - os: macos-latest - python: "3.15" - pytest_args: "-n auto -q" - job: "pytest-extra (ubuntu-latest, python 3.13)" os: ubuntu-latest python: "3.13" @@ -100,10 +102,30 @@ jobs: if: steps.pytest.outcome == 'failure' run: exit 1 + pytest-macos-weekly: + # The macOS runners are the scarce ones: a pull request runs one macOS Python version (pytest-extra, python 3.12 above) + # and the core coverage job; the other macOS versions run here, in the weekly scheduled run or on demand. + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + name: pytest-extra (macos-latest, python ${{ matrix.python }}) + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + python: ["3.11", "3.15"] + runs-on: macos-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + - run: uv sync --extra dev --python ${{ matrix.python }} + - run: uv run protocolith doctor + - run: uv run protocolith validate-all + - run: uv run --extra dev pytest -n auto -q + core-coverage: # The core is held at 100% line and branch coverage on every platform; the other platform's lock module is # excluded by its own pragma. name: core coverage (${{ matrix.os }}) + timeout-minutes: 30 strategy: fail-fast: false matrix: