Skip to content

Commit d40d265

Browse files
committed
build: move Copilot integration tests to platform test jobs
Move the 3 VS Code-dependent Copilot test steps (extension tests, completions core tests, sanity tests) from the standalone Copilot job into the Windows, Linux, and macOS platform test jobs. - Parameterize copilot/test-steps.yml with runIntegrationTests flag - Create copilot/test-integration-steps.yml for platform-specific setup - Add Copilot integration tests after core tests in each platform - product-copilot-release.yml is unaffected (uses default=true)
1 parent 5b97a78 commit d40d265

6 files changed

Lines changed: 152 additions & 9 deletions

File tree

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
parameters:
2+
- name: OS
3+
type: string # linux, darwin, win32
4+
5+
steps:
6+
# Initialize copilot submodule (auth is already set up in the platform compile steps)
7+
- ${{ if ne(parameters.OS, 'win32') }}:
8+
- script: |
9+
set -e
10+
git submodule update --init extensions/copilot
11+
displayName: Initialize copilot submodule
12+
13+
- ${{ if eq(parameters.OS, 'win32') }}:
14+
- powershell: |
15+
git submodule update --init extensions/copilot
16+
displayName: Initialize copilot submodule
17+
18+
# Restore the copilot build cache (node_modules + dist with WASM files)
19+
- task: Cache@2
20+
inputs:
21+
key: '"copilot_build_cache" | $(Build.SourcesDirectory)/extensions/copilot/build/.cachesalt | $(Build.SourcesDirectory)/extensions/copilot/build/setup-emsdk.sh | $(Build.SourcesDirectory)/extensions/copilot/package-lock.json'
22+
path: $(Build.SourcesDirectory)/extensions/copilot/.build/build_cache
23+
cacheHitVar: COPILOT_BUILD_CACHE_RESTORED
24+
displayName: Restore copilot build cache
25+
26+
- ${{ if ne(parameters.OS, 'win32') }}:
27+
- script: tar -xzf .build/build_cache/cache.tgz
28+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
29+
condition: and(succeeded(), eq(variables.COPILOT_BUILD_CACHE_RESTORED, 'true'))
30+
displayName: Extract copilot build cache
31+
32+
- script: npm ci --userconfig /dev/null
33+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
34+
condition: and(succeeded(), ne(variables.COPILOT_BUILD_CACHE_RESTORED, 'true'))
35+
displayName: Install copilot dependencies
36+
37+
- ${{ if eq(parameters.OS, 'win32') }}:
38+
- powershell: tar -xzf .build/build_cache/cache.tgz
39+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
40+
condition: and(succeeded(), eq(variables.COPILOT_BUILD_CACHE_RESTORED, 'true'))
41+
displayName: Extract copilot build cache
42+
43+
- powershell: |
44+
$tmprc = Join-Path $env:TEMP '.copilot-npmrc'
45+
Set-Content -Path $tmprc -Value ''
46+
npm ci --userconfig $tmprc
47+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
48+
condition: and(succeeded(), ne(variables.COPILOT_BUILD_CACHE_RESTORED, 'true'))
49+
displayName: Install copilot dependencies
50+
51+
# Setup copilot test environment (tokens, env vars)
52+
- task: AzureCLI@2
53+
inputs:
54+
azureSubscription: 'VS Code Development WIF'
55+
${{ if eq(parameters.OS, 'win32') }}:
56+
scriptType: 'pscore'
57+
${{ else }}:
58+
scriptType: 'bash'
59+
scriptLocation: 'inlineScript'
60+
inlineScript: npm run setup
61+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
62+
displayName: Setup copilot test environment
63+
64+
# Compile copilot extension for tests
65+
- ${{ if ne(parameters.OS, 'win32') }}:
66+
- script: npm run compile
67+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
68+
displayName: Compile copilot
69+
70+
- ${{ if eq(parameters.OS, 'win32') }}:
71+
- powershell: npm run compile
72+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
73+
displayName: Compile copilot
74+
75+
# Run Copilot integration tests
76+
- ${{ if eq(parameters.OS, 'linux') }}:
77+
- script: xvfb-run -a npm run test:extension
78+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
79+
displayName: 🧪 Run Copilot extension tests
80+
timeoutInMinutes: 15
81+
82+
- script: xvfb-run -a npm run test:completions-core
83+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
84+
displayName: 🧪 Run Copilot completions core tests
85+
timeoutInMinutes: 15
86+
87+
- script: xvfb-run -a npm run test:sanity
88+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
89+
displayName: 🧪 Run Copilot sanity tests
90+
timeoutInMinutes: 15
91+
92+
- ${{ if eq(parameters.OS, 'darwin') }}:
93+
- script: npm run test:extension
94+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
95+
displayName: 🧪 Run Copilot extension tests
96+
timeoutInMinutes: 15
97+
98+
- script: npm run test:completions-core
99+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
100+
displayName: 🧪 Run Copilot completions core tests
101+
timeoutInMinutes: 15
102+
103+
- script: npm run test:sanity
104+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
105+
displayName: 🧪 Run Copilot sanity tests
106+
timeoutInMinutes: 15
107+
108+
- ${{ if eq(parameters.OS, 'win32') }}:
109+
- powershell: npm run test:extension
110+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
111+
displayName: 🧪 Run Copilot extension tests
112+
timeoutInMinutes: 15
113+
114+
- powershell: npm run test:completions-core
115+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
116+
displayName: 🧪 Run Copilot completions core tests
117+
timeoutInMinutes: 15
118+
119+
- powershell: npm run test:sanity
120+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
121+
displayName: 🧪 Run Copilot sanity tests
122+
timeoutInMinutes: 15

build/azure-pipelines/copilot/test-steps.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
parameters:
2+
- name: runIntegrationTests
3+
type: boolean
4+
default: true
5+
16
steps:
27
- task: AzureCLI@2
38
inputs:
@@ -32,18 +37,20 @@ steps:
3237
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
3338
displayName: Run simulation tests
3439

35-
- script: xvfb-run -a npm run test:extension
36-
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
37-
displayName: Run extension tests
40+
- ${{ if eq(parameters.runIntegrationTests, true) }}:
41+
- script: xvfb-run -a npm run test:extension
42+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
43+
displayName: Run extension tests
3844

3945
- script: npm run test:prompt
4046
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
4147
displayName: Run prompt tests
4248

43-
- script: xvfb-run -a npm run test:completions-core
44-
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
45-
displayName: Run completions core tests
49+
- ${{ if eq(parameters.runIntegrationTests, true) }}:
50+
- script: xvfb-run -a npm run test:completions-core
51+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
52+
displayName: Run completions core tests
4653

47-
- script: xvfb-run -a npm run test:sanity
48-
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
49-
displayName: Run sanity tests
54+
- script: xvfb-run -a npm run test:sanity
55+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
56+
displayName: Run sanity tests

build/azure-pipelines/darwin/steps/product-build-darwin-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ steps:
130130
continueOnError: true
131131
condition: succeededOrFailed()
132132

133+
- template: ../../copilot/test-integration-steps.yml@self
134+
parameters:
135+
OS: darwin
136+
133137
- task: PublishTestResults@2
134138
displayName: Publish Tests Results
135139
inputs:

build/azure-pipelines/linux/steps/product-build-linux-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ steps:
141141
continueOnError: true
142142
condition: succeededOrFailed()
143143
144+
- template: ../../copilot/test-integration-steps.yml@self
145+
parameters:
146+
OS: linux
147+
144148
- task: PublishTestResults@2
145149
displayName: Publish Tests Results
146150
inputs:

build/azure-pipelines/product-copilot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ jobs:
3131
- template: copilot/build-steps.yml
3232
- template: copilot/l10n-steps.yml
3333
- template: copilot/test-steps.yml
34+
parameters:
35+
runIntegrationTests: false
3436

3537
- task: notice@0
3638
inputs:

build/azure-pipelines/win32/steps/product-build-win32-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ steps:
148148
continueOnError: true
149149
condition: succeededOrFailed()
150150

151+
- template: ../../copilot/test-integration-steps.yml@self
152+
parameters:
153+
OS: win32
154+
151155
- task: PublishTestResults@2
152156
displayName: Publish Tests Results
153157
inputs:

0 commit comments

Comments
 (0)