Skip to content

Commit dba8f83

Browse files
Parallelize Python and Windows .NET CI tests (#2251)
* Run Python tests in parallel Use two pytest-xdist workers with file-level scheduling so module-scoped E2E clients and proxies remain together while independent modules run concurrently. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Shard Windows .NET tests across processes Run the slow Windows default-transport suite in two isolated jobs while preserving serial xUnit execution within each test host. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 53f3a45 commit dba8f83

3 files changed

Lines changed: 45 additions & 4 deletions

File tree

.github/workflows/dotnet-sdk-tests.yml

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212

1313
jobs:
1414
test:
15-
name: ".NET SDK Tests (${{ matrix.os }}, ${{ matrix.transport }}, ${{ matrix.backend }})"
15+
name: ".NET SDK Tests (${{ matrix.os }}, ${{ matrix.transport }}, ${{ matrix.backend }}, ${{ matrix.shard }})"
1616
if: github.event.repository.fork == false
1717
env:
1818
POWERSHELL_UPDATECHECK: Off
@@ -24,22 +24,39 @@ jobs:
2424
os: [ubuntu-latest, macos-latest, windows-latest]
2525
transport: ["default", "inprocess"]
2626
backend: [capi]
27+
shard: [full]
2728
# TODO: Re-enable after fixing in-process sqlite file locking on shutdown on Windows.
2829
exclude:
2930
- os: windows-latest
3031
transport: "inprocess"
32+
- os: windows-latest
33+
transport: default
34+
shard: full
3135
include:
36+
# Keep xUnit serial within each process, but split the slow Windows
37+
# default-transport suite across two isolated test hosts.
38+
- os: windows-latest
39+
transport: default
40+
backend: capi
41+
shard: "1"
42+
- os: windows-latest
43+
transport: default
44+
backend: capi
45+
shard: "2"
3246
- os: ubuntu-latest
3347
transport: inprocess
3448
backend: anthropic-messages
49+
shard: full
3550
test-filter: "FullyQualifiedName~GitHub.Copilot.Test.E2E&E2EBackend!=SelfConfiguredBackend&E2EBackend!=CapiOnly"
3651
- os: ubuntu-latest
3752
transport: inprocess
3853
backend: openai-responses
54+
shard: full
3955
test-filter: "FullyQualifiedName~GitHub.Copilot.Test.E2E&E2EBackend!=SelfConfiguredBackend&E2EBackend!=CapiOnly"
4056
- os: ubuntu-latest
4157
transport: inprocess
4258
backend: openai-completions
59+
shard: full
4360
test-filter: "FullyQualifiedName~GitHub.Copilot.Test.E2E&E2EBackend!=SelfConfiguredBackend&E2EBackend!=CapiOnly"
4461
runs-on: ${{ matrix.os }}
4562
defaults:
@@ -92,9 +109,30 @@ jobs:
92109
- name: Run .NET SDK tests
93110
env:
94111
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
112+
DOTNET_TEST_SHARD: ${{ matrix.shard }}
95113
run: |
96114
args=(--no-build -v n)
97-
if [[ -n "$DOTNET_TEST_FILTER" ]]; then
98-
args+=(--filter "$DOTNET_TEST_FILTER")
115+
116+
filter="$DOTNET_TEST_FILTER"
117+
if [[ "$DOTNET_TEST_SHARD" != "full" ]]; then
118+
if [[ "$DOTNET_TEST_SHARD" == "1" ]]; then
119+
initials=(A C D H I J K L N Q S U W Y)
120+
shard_filter="FullyQualifiedName~GitHub.Copilot.Test.ConnectionToken"
121+
else
122+
initials=(B E F G M O P R T V X Z)
123+
shard_filter=""
124+
fi
125+
126+
for namespace in E2E Unit; do
127+
for initial in "${initials[@]}"; do
128+
clause="FullyQualifiedName~GitHub.Copilot.Test.${namespace}.${initial}"
129+
shard_filter="${shard_filter:+${shard_filter}|}${clause}"
130+
done
131+
done
132+
filter="${filter:+(${filter})&}(${shard_filter})"
133+
fi
134+
135+
if [[ -n "$filter" ]]; then
136+
args+=(--filter "$filter")
99137
fi
100138
dotnet test "${args[@]}"

.github/workflows/python-sdk-tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,6 @@ jobs:
7979
- name: Run Python SDK tests
8080
env:
8181
COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }}
82-
run: uv run pytest -v -s
82+
# Keep each module's shared E2E client and proxy on one process while
83+
# running independent modules concurrently in isolated workers.
84+
run: uv run pytest -v -s -n 2 --dist=loadfile

python/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dev = [
4646
"pytest>=7.0.0",
4747
"pytest-asyncio>=0.21.0",
4848
"pytest-timeout>=2.0.0",
49+
"pytest-xdist>=3.6.0",
4950
"websockets>=12.0",
5051
"opentelemetry-sdk>=1.0.0",
5152
]

0 commit comments

Comments
 (0)