|
| 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 |
0 commit comments