Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Run Windows tests on code pull requests (#5408)

Jeremiah Lowind79c8e8fa9ba
diff --git a/.github/scripts/test-ci-workflows.mjs b/.github/scripts/test-ci-workflows.mjs
index 09835d4d7..8d280849e 100644
--- a/.github/scripts/test-ci-workflows.mjs
+++ b/.github/scripts/test-ci-workflows.mjs
@@ -225,7 +225,7 @@ test("required matrix checks retain names even when editorial steps skip", () =>
);
}
});
-test("Windows retains matrix check names while skipping PR test steps", () => {
+test("Windows runs code PRs and retains check names for editorial PRs", () => {
const windows = workflow.jobs.run_windows_tests;
assert.equal(
windows.name,
@@ -236,7 +236,7 @@ test("Windows retains matrix check names while skipping PR test steps", () => {
});
assert.equal(windows.if, "${{ !cancelled() }}");
assert.equal(windows["runs-on"], "windows-latest");
- assert.equal(windows.needs, undefined);
+ assert.equal(windows.needs, "changes");
assert.deepEqual(windows.steps[1].with, {
"python-version": "${{ matrix.python-version }}",
resolution: "locked",
@@ -246,7 +246,7 @@ test("Windows retains matrix check names while skipping PR test steps", () => {
assert.equal(windows.steps[3].with["test-type"], "client_process");
assert.equal(windows.steps[0].if, undefined);
assert.ok(
- windows.steps.slice(1).every((step) => step.if === "github.event_name != 'pull_request'"),
+ windows.steps.slice(1).every((step) => step.if === "needs.changes.outputs.run-tests != 'false'"),
);
});
test("PR cancellation cannot supersede main or manual runs", () => {
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index ebf7c3b59..b8ef63696 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -112,8 +112,9 @@ jobs:
run: uv run pytest tests/docs -n 0
run_windows_tests:
- # Expand the matrix on PRs to preserve required check names.
- # Skip the steps instead of the job so matrix expressions are resolved.
+ needs: changes
+ # Run Windows tests for code changes, preserving required check names
+ # when editorial-only PRs skip the expensive steps.
if: ${{ !cancelled() }}
name: "Tests: Python ${{ matrix.python-version }} on windows-latest"
strategy:
@@ -125,16 +126,16 @@ jobs:
steps:
- uses: actions/checkout@v7
- name: Setup uv
- if: github.event_name != 'pull_request'
+ if: needs.changes.outputs.run-tests != 'false'
uses: ./.github/actions/setup-uv
with:
python-version: ${{ matrix.python-version }}
resolution: locked
- name: Run unit tests
- if: github.event_name != 'pull_request'
+ if: needs.changes.outputs.run-tests != 'false'
uses: ./.github/actions/run-pytest
- name: Run serial subprocess tests
- if: github.event_name != 'pull_request'
+ if: needs.changes.outputs.run-tests != 'false'
uses: ./.github/actions/run-pytest
with:
test-type: client_process