Skip to content

Commit d0dec68

Browse files
committed
build: add Copilot build and test job to product pipeline
1 parent 3e42574 commit d0dec68

2 files changed

Lines changed: 148 additions & 0 deletions

File tree

build/azure-pipelines/product-build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ extends:
202202
jobs:
203203
- template: build/azure-pipelines/product-quality-checks.yml@self
204204

205+
- stage: Copilot
206+
dependsOn: []
207+
pool:
208+
name: 1es-ubuntu-22.04-x64
209+
os: linux
210+
jobs:
211+
- template: build/azure-pipelines/product-copilot.yml@self
212+
205213
- ${{ if eq(variables['VSCODE_BUILD_STAGE_WINDOWS'], true) }}:
206214
- stage: Windows
207215
dependsOn: []
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
jobs:
2+
- job: Copilot
3+
displayName: Copilot
4+
timeoutInMinutes: 60
5+
variables:
6+
- name: skipComponentGovernanceDetection
7+
value: true
8+
- name: Codeql.SkipTaskAutoInjection
9+
value: true
10+
steps:
11+
- checkout: self
12+
lfs: true
13+
fetchDepth: 1
14+
fetchTags: false
15+
displayName: Checkout microsoft/vscode
16+
17+
- script: |
18+
set -e
19+
git submodule update --init extensions/copilot
20+
displayName: Initialize copilot submodule
21+
22+
- task: NodeTool@0
23+
inputs:
24+
versionSpec: "22.21.x"
25+
26+
- task: AzureKeyVault@2
27+
displayName: "Azure Key Vault: Get Secrets"
28+
inputs:
29+
azureSubscription: vscode
30+
KeyVaultName: vscode-build-secrets
31+
SecretsFilter: "github-distro-mixin-password"
32+
33+
- script: |
34+
mkdir -p .build
35+
cat << EOF | tee ~/.netrc .build/.netrc > /dev/null
36+
machine github.com
37+
login vscode
38+
password $(github-distro-mixin-password)
39+
EOF
40+
displayName: Setup distro auth
41+
42+
- task: Cache@2
43+
inputs:
44+
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'
45+
path: $(Build.SourcesDirectory)/extensions/copilot/.build/build_cache
46+
cacheHitVar: BUILD_CACHE_RESTORED
47+
displayName: Restore copilot build cache
48+
49+
- script: $(Build.SourcesDirectory)/extensions/copilot/build/setup-emsdk.sh
50+
displayName: Setup emsdk
51+
condition: and(succeeded(), ne(variables.BUILD_CACHE_RESTORED, 'true'))
52+
- script: echo '##vso[task.prependpath]/opt/dev/emsdk/upstream/emscripten'
53+
displayName: Setup emsdk path 1
54+
condition: and(succeeded(), ne(variables.BUILD_CACHE_RESTORED, 'true'))
55+
- script: echo '##vso[task.prependpath]/opt/dev/emsdk'
56+
displayName: Setup emsdk path 2
57+
condition: and(succeeded(), ne(variables.BUILD_CACHE_RESTORED, 'true'))
58+
59+
- script: tar -xzf .build/build_cache/cache.tgz
60+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
61+
condition: and(succeeded(), eq(variables.BUILD_CACHE_RESTORED, 'true'))
62+
displayName: Extract copilot build cache
63+
64+
- script: npm ci
65+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
66+
displayName: Install copilot dependencies
67+
condition: and(succeeded(), ne(variables.BUILD_CACHE_RESTORED, 'true'))
68+
69+
- script: |
70+
set -e
71+
mkdir -p .build
72+
node build/listBuildCacheFiles.js .build/build_cache_list.txt
73+
mkdir -p .build/build_cache
74+
tar -czf .build/build_cache/cache.tgz --files-from .build/build_cache_list.txt
75+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
76+
condition: and(succeeded(), ne(variables.BUILD_CACHE_RESTORED, 'true'))
77+
displayName: Create copilot build cache archive
78+
79+
# Build
80+
- script: |
81+
set -e
82+
git clone https://github.com/microsoft/vscode-capi.git --depth 1 $(Agent.BuildDirectory)/vscode-capi
83+
cd $(Agent.BuildDirectory)/vscode-capi
84+
npm ci && BUILD_SOURCESDIRECTORY=$(Build.SourcesDirectory)/extensions/copilot npm run mixin
85+
rm -rf $(Agent.BuildDirectory)/vscode-capi
86+
displayName: Mixin vscode-capi
87+
88+
- script: npm run build
89+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
90+
displayName: Build copilot extension
91+
92+
# Test
93+
- task: AzureCLI@2
94+
inputs:
95+
azureSubscription: 'VS Code Development WIF'
96+
scriptType: 'bash'
97+
scriptLocation: 'inlineScript'
98+
inlineScript: npm run setup
99+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
100+
displayName: Setup copilot test environment
101+
102+
- script: npm run setup:dotnet
103+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
104+
displayName: Install dotnet cli
105+
106+
- script: npm run typecheck
107+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
108+
displayName: Typecheck
109+
110+
- script: npm run lint
111+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
112+
displayName: Lint
113+
114+
- script: npm run compile
115+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
116+
displayName: Compile
117+
118+
- script: npm run test:unit
119+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
120+
displayName: Run vitest unit tests
121+
122+
- script: npm run simulate-ci
123+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
124+
displayName: Run simulation tests
125+
126+
- script: xvfb-run -a npm run test:extension
127+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
128+
displayName: Run extension tests
129+
130+
- script: npm run test:prompt
131+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
132+
displayName: Run prompt tests
133+
134+
- script: xvfb-run -a npm run test:completions-core
135+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
136+
displayName: Run completions core tests
137+
138+
- script: xvfb-run -a npm run test:sanity
139+
workingDirectory: $(Build.SourcesDirectory)/extensions/copilot
140+
displayName: Run sanity tests

0 commit comments

Comments
 (0)