Skip to content

Fix active Node and Rust replay E2E flakes (#2186) #3287

Fix active Node and Rust replay E2E flakes (#2186)

Fix active Node and Rust replay E2E flakes (#2186) #3287

name: ".NET SDK Tests"
on:
push:
branches:
- main
workflow_dispatch:
workflow_call:
permissions:
contents: read
jobs:
test:
name: ".NET SDK Tests (${{ matrix.os }}, ${{ matrix.transport }}, ${{ matrix.backend }}, ${{ matrix.shard }})"
if: github.event.repository.fork == false
env:
POWERSHELL_UPDATECHECK: Off
COPILOT_SDK_E2E_BACKEND: ${{ matrix.backend }}
DOTNET_TEST_FILTER: ${{ matrix.test-filter }}
strategy:
fail-fast: false
matrix:
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. Keep both
# target frameworks in each shard: separate framework jobs did not
# shorten the critical path and doubled the Windows job count.
- 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:
run:
shell: bash
working-directory: ./dotnet
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0.x"
- uses: actions/setup-node@v6
with:
node-version: "22"
cache: "npm"
cache-dependency-path: "./nodejs/package-lock.json"
- name: Install Node.js dependencies (for CLI version extraction)
working-directory: ./nodejs
run: npm ci --ignore-scripts
- name: Restore .NET dependencies
run: dotnet restore
- name: Run dotnet format check
if: runner.os == 'Linux'
run: |
dotnet format --verify-no-changes
if [ $? -ne 0 ]; then
echo "❌ dotnet format produced changes. Please run 'dotnet format' in dotnet"
exit 1
fi
echo "✅ dotnet format produced no changes"
- name: Build SDK
run: dotnet build --no-restore
- name: Install test harness dependencies
working-directory: ./test/harness
run: npm ci --ignore-scripts
- name: Warm up PowerShell
if: runner.os == 'Windows'
run: pwsh.exe -Command "Write-Host 'PowerShell ready'"
- name: Select inprocess transport
if: matrix.transport == 'inprocess'
run: echo "COPILOT_SDK_DEFAULT_CONNECTION=inprocess" >> "$GITHUB_ENV"
- 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)
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[@]}"