Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
branches: ["main"]
pull_request:
workflow_dispatch:
schedule:
- cron: "17 4 * * 1"

jobs:
ruff:
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 8 additions & 7 deletions SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
36 changes: 22 additions & 14 deletions tests/test_github_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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()

Expand Down
Loading