Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

ci: trim the per-PR matrix and run the full matrix on main twice a day (#4841)

Dmytro Mishkin1be99a598856
diff --git a/.github/workflows/pr_test_cpu.yml b/.github/workflows/pr_test_cpu.yml
index 19872dcdf..a8c53afe9 100644
--- a/.github/workflows/pr_test_cpu.yml
+++ b/.github/workflows/pr_test_cpu.yml
@@ -84,45 +84,48 @@ jobs:
needs: [pre-tests]
strategy:
fail-fast: false
+ # Each PR leg is here for failures the others do not catch; the full os x dtype x python x
+ # torch matrix runs on main twice a day in scheduled_test_cpu.yml. Measured over the PR
+ # runs from 2026-09-03 to 2026-09-24, these six legs plus the half-precision, MPS and
+ # dynamo jobs caught every test failure that the previous 27-leg matrix caught, apart from
+ # one environment-specific `test_check_torch_env` failure.
+ # - ubuntu 3.13 / torch 2.5.1 (float32, float64): the only place Python 3.13 meets the
+ # oldest torch -- 2.5.1 has no 3.13 wheels on Windows or macOS -- and the leg that
+ # caught the most failures nothing else caught.
+ # - ubuntu 3.11 / torch 2.14.0 (float32, float64): the oldest Python on the newest torch,
+ # so every Python and torch pin still gets a full-suite run in both dtypes on Linux.
+ # - windows-latest float64: Windows-only failures (path handling, the eager RNG audit)
+ # showed up on every Windows leg, and this one caught all of them.
+ # - macos-latest float32: the one macOS-only failure showed up on all five macOS legs.
+ # torch 2.5.1 on Windows runs only in the scheduled matrix, on windows-2022: its wheels
+ # crash with STATUS_ILLEGAL_INSTRUCTION (0xc000001d) in affine_grid on the windows-2025
+ # image that windows-latest now resolves to.
matrix:
- os: ["ubuntu-latest", "windows-latest", "macos-latest"]
- pytorch-dtype: ["float32", "float64"]
- python-version: ["3.11", "3.12", "3.13"]
- pytorch-version: ["2.5.1", "2.14.0"]
- exclude:
- # PyTorch 2.5.1 doesn't have wheels for Python 3.13 on Windows
- - os: windows-latest
- python-version: "3.13"
- pytorch-version: "2.5.1"
- # PyTorch 2.5.1 doesn't have wheels for Python 3.13 on macOS
- - os: macos-latest
+ include:
+ - os: ubuntu-latest
+ pytorch-dtype: "float32"
python-version: "3.13"
pytorch-version: "2.5.1"
- # macOS only runs float32 tests
- - os: macos-latest
+ - os: ubuntu-latest
pytorch-dtype: "float64"
- # torch 2.5.1 wheels crash with STATUS_ILLEGAL_INSTRUCTION (0xc000001d) in
- # affine_grid on the windows-2025 runner image (now rolling out as
- # windows-latest); run those legs on windows-2022 via `include` below.
- - os: windows-latest
+ python-version: "3.13"
pytorch-version: "2.5.1"
- include:
- - os: windows-2022
+ - os: ubuntu-latest
pytorch-dtype: "float32"
python-version: "3.11"
- pytorch-version: "2.5.1"
- - os: windows-2022
+ pytorch-version: "2.14.0"
+ - os: ubuntu-latest
pytorch-dtype: "float64"
python-version: "3.11"
- pytorch-version: "2.5.1"
- - os: windows-2022
- pytorch-dtype: "float32"
- python-version: "3.12"
- pytorch-version: "2.5.1"
- - os: windows-2022
+ pytorch-version: "2.14.0"
+ - os: windows-latest
pytorch-dtype: "float64"
- python-version: "3.12"
- pytorch-version: "2.5.1"
+ python-version: "3.13"
+ pytorch-version: "2.14.0"
+ - os: macos-latest
+ pytorch-dtype: "float32"
+ python-version: "3.13"
+ pytorch-version: "2.14.0"
uses: ./.github/workflows/tests.yml
with:
@@ -162,7 +165,7 @@ jobs:
# The directory list has to name every tree whose compile tests should gate a PR: one it
# omits is still collected, but with the `torch_optimizer` fixture deselected, so its
# `test_dynamo` cases pass as identity no-ops and a compile regression there reaches
- # `main` before the post-merge `coverage.yml` dynamo job is the first to compile it.
+ # `main` before the scheduled `coverage.yml` dynamo job is the first to compile it.
dynamo:
needs: [pre-tests]
uses: ./.github/workflows/tests.yml
@@ -222,9 +225,8 @@ jobs:
needs: [pre-tests]
uses: ./.github/workflows/typecheck.yml
- tutorials:
- needs: [pre-tests]
- uses: ./.github/workflows/tutorials.yml
+ # Tutorials run only in scheduled_test_cpu.yml. The job is continue-on-error and
+ # `collector` does not wait for it, so at PR time it cost ~12 runner-minutes without gating.
collector:
needs: [changes, pre-tests, tests, tests-mps, half-precision, dynamo, typecheck]
diff --git a/.github/workflows/scheduled_test_cpu.yml b/.github/workflows/scheduled_test_cpu.yml
index 545feb4f5..3e43c79ce 100644
--- a/.github/workflows/scheduled_test_cpu.yml
+++ b/.github/workflows/scheduled_test_cpu.yml
@@ -1,15 +1,13 @@
name: Tests on CPU (scheduled)
+# Runs on main twice a day rather than on every push. With a push trigger each merge started the
+# full matrix and the next merge cancelled it: from 2026-09-03 to 2026-09-24, 262 of 352 runs
+# were cancelled, about 43,000 runner-minutes, in an org limited to 20 concurrent jobs.
on:
- push:
- branches: [main]
- paths-ignore:
- - 'docs/**'
- - '*.md'
- - 'LICENSE'
- - 'COPYRIGHT'
schedule:
- - cron: '0 4 * * *'
+ # Off the hour: GitHub may drop queued scheduled jobs at the start of an hour, when load peaks.
+ - cron: '23 0 * * *'
+ - cron: '23 12 * * *'
workflow_dispatch:
workflow_call:
@@ -46,39 +44,64 @@ jobs:
run: echo "windows-2022 runner is available"
check-skip:
- # For scheduled runs, check if only documentation files changed
- # If so, skip the expensive test runs
+ # A scheduled run tests everything that reached main since the previous successful scheduled
+ # run. It skips when main has not moved since then, or when every file changed since then is
+ # documentation.
runs-on: ubuntu-latest
timeout-minutes: 5
+ permissions:
+ contents: read
+ actions: read
outputs:
should-skip: ${{ steps.check.outputs.should-skip }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
- fetch-depth: 2 # Need at least 2 commits to compare
+ fetch-depth: 0 # The previous scheduled run's commit can be any number of commits back
- - name: Check if only docs changed
+ - name: Check what changed since the previous scheduled run
id: check
+ env:
+ GH_TOKEN: ${{ github.token }}
run: |
- # For non-schedule events, always run tests
+ # Manual and called runs always test.
if [[ "${{ github.event_name }}" != "schedule" ]]; then
echo "should-skip=false" >> "$GITHUB_OUTPUT"
echo "Not a scheduled run, will proceed with tests"
exit 0
fi
- # For scheduled runs, check if only documentation files changed
- # Get the last commit on main
- LAST_COMMIT=$(git rev-parse HEAD)
+ # Compare against the newest successful scheduled run. A failed run may have tested
+ # nothing (a pre-tests failure skips every test job), and skipping on top of a real
+ # failure would turn the workflow green while main is still red; a cancelled run tested
+ # nothing either. A run that skipped its tests concludes as success; its commit is still
+ # a valid base, because everything before it was tested or was documentation.
+ # Filtering the runs endpoint by status or branch returns an incomplete, unordered
+ # page, so ask for a bounded created= window and sort here.
+ SINCE=$(date -u -d '7 days ago' +%Y-%m-%d)
+ PREV_SHA=$(gh api \
+ "repos/${{ github.repository }}/actions/workflows/scheduled_test_cpu.yml/runs?event=schedule&created=>=${SINCE}&per_page=100" \
+ --jq '[.workflow_runs[] | select(.head_branch == "main" and .conclusion == "success")]
+ | sort_by(.created_at) | last | .head_sha // empty') || PREV_SHA=""
- # Get list of changed files in the last commit
- CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r $LAST_COMMIT)
+ if [[ -z "$PREV_SHA" ]] || ! git cat-file -e "${PREV_SHA}^{commit}" 2>/dev/null; then
+ echo "should-skip=false" >> "$GITHUB_OUTPUT"
+ echo "No usable previous scheduled run (got '${PREV_SHA}'), will proceed with tests"
+ exit 0
+ fi
+
+ if [[ "$PREV_SHA" == "$(git rev-parse HEAD)" ]]; then
+ echo "should-skip=true" >> "$GITHUB_OUTPUT"
+ echo "main has not moved since the previous scheduled run at ${PREV_SHA}"
+ exit 0
+ fi
+
+ CHANGED_FILES=$(git diff --name-only "$PREV_SHA" HEAD)
- # Check if all changed files are in paths-ignore patterns
+ # Skip only if every changed file is documentation
SHOULD_SKIP="true"
for file in $CHANGED_FILES; do
- # Check if file matches any ignore pattern
if [[ ! "$file" =~ ^docs/ ]] && \
[[ ! "$file" =~ \.md$ ]] && \
[[ "$file" != "LICENSE" ]] && \
@@ -89,7 +112,7 @@ jobs:
done
echo "should-skip=$SHOULD_SKIP" >> "$GITHUB_OUTPUT"
- echo "Changed files: $CHANGED_FILES"
+ echo "Changed since ${PREV_SHA}: $CHANGED_FILES"
echo "Should skip: $SHOULD_SKIP"
pre-tests:
@@ -269,7 +292,7 @@ jobs:
uses: ./.github/workflows/docs.yml
with:
python-version: '["3.11"]'
- # Post-merge run: the model doctests download on a cache miss instead of
+ # Scheduled run on main: the model doctests download on a cache miss instead of
# skipping, so main always exercises them for real.
download-weights: true
cache-path: weights/
diff --git a/AGENTS.md b/AGENTS.md
index 8e5cf6eda..b5c2c0db1 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -57,7 +57,7 @@ Supported fixtures include CPU, CUDA, MPS, and TPU when available, and `float16`
`test-module` forwards its arguments to `pytest`, so a node ID or a `-k` expression narrows a run to a single test.
-Use `KORNIA_TEST_RUNSLOW=true` to include slow tests. `KORNIA_TEST_OPTIMIZER=inductor` enables the dynamo and compile tests, which are deselected when the variable is unset. `pixi run doctest` skips docstring examples that would download an uncached model checkpoint, so it stays fast and works offline; use `pixi run doctest-weights` (or `KORNIA_DOCTEST_DOWNLOAD=1`) to run those examples for real, which costs ~838 MB on a cold cache. Pull-request CI relies on the restored weights cache and skips whatever it misses; the post-merge run on `main` downloads, so the model examples are always exercised somewhere. Before presenting a code change as finished, run the full pre-commit command above together with focused tests and other relevant checks; `pixi run lint` runs only the Ruff hooks.
+Use `KORNIA_TEST_RUNSLOW=true` to include slow tests. `KORNIA_TEST_OPTIMIZER=inductor` enables the dynamo and compile tests, which are deselected when the variable is unset. `pixi run doctest` skips docstring examples that would download an uncached model checkpoint, so it stays fast and works offline; use `pixi run doctest-weights` (or `KORNIA_DOCTEST_DOWNLOAD=1`) to run those examples for real, which costs ~838 MB on a cold cache. Pull-request CI relies on the restored weights cache and skips whatever it misses; the scheduled run on `main` (00:23 and 12:23 UTC) downloads, so the model examples are always exercised somewhere. Before presenting a code change as finished, run the full pre-commit command above together with focused tests and other relevant checks; `pixi run lint` runs only the Ruff hooks.
### Comparing a branch against another revision
diff --git a/README.md b/README.md
index 574b5ada8..81181d4ef 100644
--- a/README.md
+++ b/README.md
@@ -128,7 +128,7 @@ covers CUDA or MPS half precision.
| CUDA float16 | 11738 | 451 | 3983 | **96.3%** | `f8449854`, 2026-09-23 |
| CUDA bfloat16 | 11736 | 500 | 3936 | **95.9%** | `f8449854`, 2026-09-23 |
-Pass% = passed ÷ (passed + failed). The CPU rows are the nightly `main` CI jobs (Linux x86_64, Python 3.11,
+Pass% = passed ÷ (passed + failed). The CPU rows are the scheduled `main` CI jobs (Linux x86_64, Python 3.11,
PyTorch 2.9.1, no `--runslow`). In the half jobs, *Failed* is the manifest's entry count: CI reports those tests as
strict xfails, and it fails if any of them passes or fails differently. Tests marked `xfail` in the source are
excluded from every row. Reproduce a CPU half row in that environment with
diff --git a/docs/source/get-started/precision.rst b/docs/source/get-started/precision.rst
index 477ca94f6..f30eb4cfd 100644
--- a/docs/source/get-started/precision.rst
+++ b/docs/source/get-started/precision.rst
@@ -166,7 +166,7 @@ Test Results
------------
Full test suite (no ``--runslow``). Pass% = passed ÷ (passed + failed); skipped tests and tests marked ``xfail`` in
-the source are excluded. The CPU rows come from the nightly ``main`` CI jobs at commit ``ca5021eb``
+the source are excluded. The CPU rows come from the scheduled ``main`` CI jobs at commit ``ca5021eb``
(2026-09-14; Linux x86_64, Python 3.11, PyTorch 2.9.1). In the half-precision jobs, *Failed* is the manifest's entry
count: CI reports those tests as strict xfails and turns red if any of them passes or fails differently. The CUDA
rows are a local run at commit ``f8449854`` (2026-09-23; RTX 4090, Python 3.11, PyTorch 2.14.0+cu130), not CI. Every
diff --git a/tests/test_half_precision_ci.py b/tests/test_half_precision_ci.py
index e8e05de54..d4ad03eb5 100644
--- a/tests/test_half_precision_ci.py
+++ b/tests/test_half_precision_ci.py
@@ -956,7 +956,8 @@ def test_pinned_runner_images_have_availability_guards() -> None:
assert separator, "missing tests-mps job"
tests_mps = re.split(r"\n(?= [\w-]+:\n)", tests_mps_tail, maxsplit=1)[0]
assert "\n os: macos-15\n" in tests_mps
- assert " - os: windows-2022\n" in pr_workflow
+ # torch 2.5.1 on Windows runs only in the scheduled matrix, so windows-2022 is pinned in the
+ # scheduled workflow alone.
assert " - os: windows-2022\n" in scheduled_workflow
for label in ("macos-15", "windows-2022"):