Skip to content

Commit 34cc7e8

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 34cc7e8

6 files changed

Lines changed: 149 additions & 9 deletions

File tree

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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 --registry https://registry.npmjs.org/
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: npm ci --registry https://registry.npmjs.org/
44+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
45+
condition: and(succeeded(), ne(variables.COPILOT_BUILD_CACHE_RESTORED, 'true'))
46+
displayName: Install copilot dependencies
47+
48+
# Setup copilot test environment (tokens, env vars)
49+
- task: AzureCLI@2
50+
inputs:
51+
azureSubscription: 'VS Code Development WIF'
52+
${{ if eq(parameters.OS, 'win32') }}:
53+
scriptType: 'pscore'
54+
${{ else }}:
55+
scriptType: 'bash'
56+
scriptLocation: 'inlineScript'
57+
inlineScript: npm run setup
58+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
59+
displayName: Setup copilot test environment
60+
61+
# Compile copilot extension for tests
62+
- ${{ if ne(parameters.OS, 'win32') }}:
63+
- script: npm run compile
64+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
65+
displayName: Compile copilot
66+
67+
- ${{ if eq(parameters.OS, 'win32') }}:
68+
- powershell: npm run compile
69+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
70+
displayName: Compile copilot
71+
72+
# Run Copilot integration tests
73+
- ${{ if eq(parameters.OS, 'linux') }}:
74+
- script: xvfb-run -a npm run test:extension
75+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
76+
displayName: 🧪 Run Copilot extension tests
77+
timeoutInMinutes: 15
78+
79+
- script: xvfb-run -a npm run test:completions-core
80+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
81+
displayName: 🧪 Run Copilot completions core tests
82+
timeoutInMinutes: 15
83+
84+
- script: xvfb-run -a npm run test:sanity
85+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
86+
displayName: 🧪 Run Copilot sanity tests
87+
timeoutInMinutes: 15
88+
89+
- ${{ if eq(parameters.OS, 'darwin') }}:
90+
- script: npm run test:extension
91+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
92+
displayName: 🧪 Run Copilot extension tests
93+
timeoutInMinutes: 15
94+
95+
- script: npm run test:completions-core
96+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
97+
displayName: 🧪 Run Copilot completions core tests
98+
timeoutInMinutes: 15
99+
100+
- script: npm run test:sanity
101+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
102+
displayName: 🧪 Run Copilot sanity tests
103+
timeoutInMinutes: 15
104+
105+
- ${{ if eq(parameters.OS, 'win32') }}:
106+
- powershell: npm run test:extension
107+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
108+
displayName: 🧪 Run Copilot extension tests
109+
timeoutInMinutes: 15
110+
111+
- powershell: npm run test:completions-core
112+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
113+
displayName: 🧪 Run Copilot completions core tests
114+
timeoutInMinutes: 15
115+
116+
- powershell: npm run test:sanity
117+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
118+
displayName: 🧪 Run Copilot sanity tests
119+
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)