From cf48303b02eca694a46622907769656ab1354046 Mon Sep 17 00:00:00 2001 From: Manfred Riem <15701806+mnriem@users.noreply.github.com> Date: Fri, 6 Nov 2026 13:28:23 -0600 Subject: [PATCH] ci: focus default Python matrix on minimum and maintained releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep full Python 3.11–3.15 coverage for scheduled and manual runs. Assisted-by: GitHub Copilot (model: GPT-6.1 Sol, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/test.yml | 7 +++---- CONTRIBUTING.md | 3 ++- SUPPORT.md | 15 +++++++------- tests/test_github_workflows.py | 36 +++++++++++++++++++++------------- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 70860da239..097de4a559 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,6 +8,8 @@ on: branches: ["main"] pull_request: workflow_dispatch: + schedule: + - cron: "17 4 * * 1" jobs: ruff: @@ -32,10 +34,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ${{ fromJSON(github.event_name == 'workflow_dispatch' && '["3.11", "3.12", "3.13", "3.14", "3.15"]' || '["3.13", "3.14", "3.15"]') }} - include: - - os: ubuntu-latest - python-version: "3.11" + python-version: ${{ fromJSON((github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && '["3.11", "3.12", "3.13", "3.14", "3.15"]' || '["3.11", "3.14", "3.15"]') }} steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 64d59b3637..2e7fabe9f1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -292,7 +292,8 @@ editable install. Start with the affected test files; run the full suite when the change requires broader regression coverage. See [Python version support](SUPPORT.md#python-version-support) for the routine -and manual CI matrices, compatibility policy, and minimum-version lifecycle. +and full scheduled/manual CI matrices, compatibility policy, and minimum-version +lifecycle. #### Security checks diff --git a/SUPPORT.md b/SUPPORT.md index 72f210bdf2..17b25b773a 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -23,15 +23,16 @@ Spec Kit's minimum Python version is declared by `requires-python` in [`pyproject.toml`](./pyproject.toml). Support does not mean every supported Python and operating system combination is tested on every change: -| Python version | Routine CI (pull requests and pushes to `main`) | Manual CI (`workflow_dispatch`) | +| Python version | Routine CI (pull requests and pushes to `main`) | Weekly scheduled and manual CI (`workflow_dispatch`) | | --- | --- | --- | -| Minimum supported version | Linux | Linux, Windows, macOS | -| Three newest stable versions | Linux, Windows, macOS | Linux, Windows, macOS | +| Minimum supported version (3.11) | Linux, Windows, macOS | Linux, Windows, macOS | +| Bugfix-supported stable versions (3.14, 3.15) | Linux, Windows, macOS | Linux, Windows, macOS | | Other supported stable versions | Not run | Linux, Windows, macOS | This balances CI cost with compatibility coverage. The minimum supported -version on Linux is our touchstone; newer versions receive broader routine coverage. -The full matrix runs only when manually triggered. Regressions on older +version is our touchstone across all three platforms alongside bugfix-supported +stable releases. The full Python 3.11 through 3.15 matrix runs weekly and when +manually triggered. Regressions on older supported versions are addressed as needed when discovered through CI or user reports, rather than through proactive fixes for hypothetical problems. The exact versions tested are configured in the @@ -45,8 +46,8 @@ This does not make those versions unsupported or mean that third-party distributors cannot provide binaries. When the minimum supported Python version reaches upstream end of life, -advance both the Linux touchstone and the minimum requirement to the next -supported version, removing the end-of-life version from the manual matrix. +advance both the touchstone and the minimum requirement to the next +supported version, removing the end-of-life version from the full matrix. ## GitHub Support Policy diff --git a/tests/test_github_workflows.py b/tests/test_github_workflows.py index cac53806c6..11262597a0 100644 --- a/tests/test_github_workflows.py +++ b/tests/test_github_workflows.py @@ -335,46 +335,41 @@ def test_github_actions_are_pinned_to_full_commit_shas(): assert unpinned_refs == [] -@pytest.mark.parametrize("event_name", ["push", "pull_request", "workflow_dispatch"]) +@pytest.mark.parametrize("event_name", ["push", "pull_request", "schedule", "workflow_dispatch"]) def test_pytest_matrix_covers_supported_python_versions_on_all_platforms(event_name): workflow = yaml.safe_load( (WORKFLOWS_DIR / "test.yml").read_text(encoding="utf-8") ) triggers = workflow.get("on", workflow.get(True)) - assert set(triggers) == {"push", "pull_request", "workflow_dispatch"} + assert set(triggers) == {"push", "pull_request", "schedule", "workflow_dispatch"} assert triggers["push"]["branches"] == ["main"] job = workflow["jobs"]["pytest"] matrix = job["strategy"]["matrix"] + assert set(matrix) == {"os", "python-version"} assert matrix["os"] == ["ubuntu-latest", "windows-latest", "macos-latest"] expression = re.fullmatch( - r"\$\{\{ fromJSON\(github\.event_name == 'workflow_dispatch' " + r"\$\{\{ fromJSON\(\(github\.event_name == 'schedule' \|\| " + r"github\.event_name == 'workflow_dispatch'\) " r"&& '([^']+)' \|\| '([^']+)'\) \}\}", matrix["python-version"], ) assert expression is not None versions = json.loads( - expression.group(1 if event_name == "workflow_dispatch" else 2) + expression.group(1 if event_name in {"schedule", "workflow_dispatch"} else 2) ) combinations = [(os_name, version) for os_name in matrix["os"] for version in versions] - assert matrix["include"] == [{"os": "ubuntu-latest", "python-version": "3.11"}] - for entry in matrix["include"]: - combination = (entry["os"], entry["python-version"]) - if combination not in combinations: - combinations.append(combination) - expected_versions = ( ["3.11", "3.12", "3.13", "3.14", "3.15"] - if event_name == "workflow_dispatch" - else ["3.13", "3.14", "3.15"] + if event_name in {"schedule", "workflow_dispatch"} + else ["3.11", "3.14", "3.15"] ) expected = { (os_name, version) for os_name in ["ubuntu-latest", "windows-latest", "macos-latest"] for version in expected_versions } - expected.add(("ubuntu-latest", "3.11")) assert set(combinations) == expected - assert len(combinations) == (15 if event_name == "workflow_dispatch" else 10) + assert len(combinations) == (15 if event_name in {"schedule", "workflow_dispatch"} else 9) assert job["runs-on"] == "${{ matrix.os }}" setup_python = next( step for step in job["steps"] @@ -383,6 +378,19 @@ def test_pytest_matrix_covers_supported_python_versions_on_all_platforms(event_n assert setup_python["with"]["python-version"] == "${{ matrix.python-version }}" +def test_pytest_workflow_keeps_push_and_pr_checks_with_weekly_and_manual_coverage(): + workflow = yaml.safe_load( + (WORKFLOWS_DIR / "test.yml").read_text(encoding="utf-8") + ) + triggers = workflow.get("on", workflow.get(True)) + assert triggers == { + "push": {"branches": ["main"]}, + "pull_request": None, + "workflow_dispatch": None, + "schedule": [{"cron": "17 4 * * 1"}], + } + + def test_publish_tag_validation_uses_environment_variable(): steps = _publish_workflow_steps()