diff --git a/.github/workflows/dotnet-sdk-tests.yml b/.github/workflows/dotnet-sdk-tests.yml index 37cdc07f7c..b5871897f6 100644 --- a/.github/workflows/dotnet-sdk-tests.yml +++ b/.github/workflows/dotnet-sdk-tests.yml @@ -12,7 +12,7 @@ permissions: jobs: test: - name: ".NET SDK Tests (${{ matrix.os }}, ${{ matrix.transport }}, ${{ matrix.backend }})" + name: ".NET SDK Tests (${{ matrix.os }}, ${{ matrix.transport }}, ${{ matrix.backend }}, ${{ matrix.shard }})" if: github.event.repository.fork == false env: POWERSHELL_UPDATECHECK: Off @@ -24,22 +24,39 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] transport: ["default", "inprocess"] backend: [capi] + shard: [full] # TODO: Re-enable after fixing in-process sqlite file locking on shutdown on Windows. exclude: - os: windows-latest transport: "inprocess" + - os: windows-latest + transport: default + shard: full include: + # Keep xUnit serial within each process, but split the slow Windows + # default-transport suite across two isolated test hosts. + - os: windows-latest + transport: default + backend: capi + shard: "1" + - os: windows-latest + transport: default + backend: capi + shard: "2" - os: ubuntu-latest transport: inprocess backend: anthropic-messages + shard: full test-filter: "FullyQualifiedName~GitHub.Copilot.Test.E2E&E2EBackend!=SelfConfiguredBackend&E2EBackend!=CapiOnly" - os: ubuntu-latest transport: inprocess backend: openai-responses + shard: full test-filter: "FullyQualifiedName~GitHub.Copilot.Test.E2E&E2EBackend!=SelfConfiguredBackend&E2EBackend!=CapiOnly" - os: ubuntu-latest transport: inprocess backend: openai-completions + shard: full test-filter: "FullyQualifiedName~GitHub.Copilot.Test.E2E&E2EBackend!=SelfConfiguredBackend&E2EBackend!=CapiOnly" runs-on: ${{ matrix.os }} defaults: @@ -92,9 +109,30 @@ jobs: - name: Run .NET SDK tests env: COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }} + DOTNET_TEST_SHARD: ${{ matrix.shard }} run: | args=(--no-build -v n) - if [[ -n "$DOTNET_TEST_FILTER" ]]; then - args+=(--filter "$DOTNET_TEST_FILTER") + + filter="$DOTNET_TEST_FILTER" + if [[ "$DOTNET_TEST_SHARD" != "full" ]]; then + if [[ "$DOTNET_TEST_SHARD" == "1" ]]; then + initials=(A C D H I J K L N Q S U W Y) + shard_filter="FullyQualifiedName~GitHub.Copilot.Test.ConnectionToken" + else + initials=(B E F G M O P R T V X Z) + shard_filter="" + fi + + for namespace in E2E Unit; do + for initial in "${initials[@]}"; do + clause="FullyQualifiedName~GitHub.Copilot.Test.${namespace}.${initial}" + shard_filter="${shard_filter:+${shard_filter}|}${clause}" + done + done + filter="${filter:+(${filter})&}(${shard_filter})" + fi + + if [[ -n "$filter" ]]; then + args+=(--filter "$filter") fi dotnet test "${args[@]}" diff --git a/.github/workflows/python-sdk-tests.yml b/.github/workflows/python-sdk-tests.yml index 8c4d5806db..1ea9739756 100644 --- a/.github/workflows/python-sdk-tests.yml +++ b/.github/workflows/python-sdk-tests.yml @@ -79,4 +79,6 @@ jobs: - name: Run Python SDK tests env: COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }} - run: uv run pytest -v -s + # Keep each module's shared E2E client and proxy on one process while + # running independent modules concurrently in isolated workers. + run: uv run pytest -v -s -n 2 --dist=loadfile diff --git a/python/pyproject.toml b/python/pyproject.toml index 7e6274d9c0..e96c587a64 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -46,6 +46,7 @@ dev = [ "pytest>=7.0.0", "pytest-asyncio>=0.21.0", "pytest-timeout>=2.0.0", + "pytest-xdist>=3.6.0", "websockets>=12.0", "opentelemetry-sdk>=1.0.0", ]