product-build-win32.yml 13.6 KB
Newer Older
J
Joao Moreno 已提交
1
steps:
J
João Moreno 已提交
2 3
  - task: NodeTool@0
    inputs:
R
Robo 已提交
4
      versionSpec: "12.18.3"
J
Joao Moreno 已提交
5

J
João Moreno 已提交
6 7 8
  - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
    inputs:
      versionSpec: "1.x"
J
Joao Moreno 已提交
9

J
João Moreno 已提交
10 11 12 13
  - task: UsePythonVersion@0
    inputs:
      versionSpec: "2.x"
      addToPath: true
J
Joao Moreno 已提交
14

J
João Moreno 已提交
15 16 17 18 19
  - task: AzureKeyVault@1
    displayName: "Azure Key Vault: Get Secrets"
    inputs:
      azureSubscription: "vscode-builds-subscription"
      KeyVaultName: vscode
J
build  
Joao Moreno 已提交
20

J
João Moreno 已提交
21 22
  - task: DownloadPipelineArtifact@2
    inputs:
23 24
      artifact: Compilation
      path: $(Build.ArtifactStagingDirectory)
J
João Moreno 已提交
25 26
    displayName: Download compilation output

27 28 29
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
J
fix tar  
João Moreno 已提交
30
      exec { tar --force-local -xzf $(Build.ArtifactStagingDirectory)/compilation.tar.gz }
31 32
    displayName: Extract compilation output

J
João Moreno 已提交
33 34 35 36
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      "machine github.com`nlogin vscode`npassword $(github-distro-mixin-password)" | Out-File "$env:USERPROFILE\_netrc" -Encoding ASCII
J
Joao Moreno 已提交
37

J
João Moreno 已提交
38 39 40
      exec { git config user.email "vscode@microsoft.com" }
      exec { git config user.name "VSCode" }
    displayName: Prepare tooling
J
Joao Moreno 已提交
41

J
João Moreno 已提交
42 43 44
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
J
João Moreno 已提交
45
      exec { git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro") }
J
João Moreno 已提交
46
    displayName: Merge distro
J
Joao Moreno 已提交
47

J
João Moreno 已提交
48
  - powershell: |
49 50
      "$(VSCODE_ARCH)" | Out-File -Encoding ascii -NoNewLine .build\arch
      "$env:ENABLE_TERRAPIN" | Out-File -Encoding ascii -NoNewLine .build\terrapin
A
Alexandru Dima 已提交
51
      node build/azure-pipelines/common/computeNodeModulesCacheKey.js > .build/yarnlockhash
J
João Moreno 已提交
52 53
    displayName: Prepare yarn cache flags

54
  - task: Cache@2
J
João Moreno 已提交
55
    inputs:
56 57 58
      key: 'nodeModules | $(Agent.OS) | .build/arch, .build/terrapin, .build/yarnlockhash'
      path: .build/node_modules_cache
      cacheHitVar: NODE_MODULES_RESTORED
J
rename  
João Moreno 已提交
59
    displayName: Restore node_modules cache
60 61 62 63 64 65

  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      exec { 7z.exe x .build/node_modules_cache/cache.7z -aos }
    condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
J
rename  
João Moreno 已提交
66
    displayName: Extract node_modules cache
J
Joao Moreno 已提交
67

J
João Moreno 已提交
68 69 70 71 72 73
  - script: |
      npx https://aka.ms/enablesecurefeed standAlone
    timeoutInMinutes: 5
    condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), eq(variables['ENABLE_TERRAPIN'], 'true'))
    displayName: Switch to Terrapin packages

J
João Moreno 已提交
74 75
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
J
João Moreno 已提交
76
      . build/azure-pipelines/win32/retry.ps1
J
João Moreno 已提交
77
      $ErrorActionPreference = "Stop"
J
João Moreno 已提交
78 79
      $env:npm_config_arch="$(VSCODE_ARCH)"
      $env:CHILD_CONCURRENCY="1"
J
João Moreno 已提交
80
      retry { exec { yarn --frozen-lockfile } }
81 82
    env:
      ELECTRON_SKIP_BINARY_DOWNLOAD: 1
83
      PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
J
João Moreno 已提交
84
    displayName: Install dependencies
85
    condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
J
Joao Moreno 已提交
86

87 88 89 90 91
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      exec { node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt }
      exec { mkdir -Force .build/node_modules_cache }
A
Alexandru Dima 已提交
92
      exec { 7z.exe a .build/node_modules_cache/cache.7z -mx3 `@.build/node_modules_list.txt }
93 94
    condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
    displayName: Create node_modules archive
J
Joao Moreno 已提交
95

J
João Moreno 已提交
96 97 98 99 100
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      exec { node build/azure-pipelines/mixin }
    displayName: Mix in quality
J
Joao Moreno 已提交
101

J
João Moreno 已提交
102 103 104 105
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      $env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
J
João Moreno 已提交
106
      exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-min-ci" }
J
João Moreno 已提交
107
      echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(agent.builddirectory)/VSCode-win32-$(VSCODE_ARCH)"
J
João Moreno 已提交
108
    displayName: Build
J
Joao Moreno 已提交
109

J
João Moreno 已提交
110 111 112 113 114 115 116 117 118
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      $env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
      exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-code-helper" }
      exec { yarn gulp "vscode-win32-$(VSCODE_ARCH)-inno-updater" }
    displayName: Prepare Package
    condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))

J
João Moreno 已提交
119 120 121 122
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      $env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
J
João Moreno 已提交
123 124
      exec { yarn gulp "vscode-reh-win32-$(VSCODE_ARCH)-min-ci" }
      exec { yarn gulp "vscode-reh-web-win32-$(VSCODE_ARCH)-min-ci" }
J
João Moreno 已提交
125
      echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(CodeSigningFolderPath),$(agent.builddirectory)/vscode-reh-win32-$(VSCODE_ARCH)"
J
João Moreno 已提交
126 127 128
    displayName: Build Server
    condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'arm64'))

129 130 131 132 133 134 135
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      exec { yarn npm-run-all -lp "electron $(VSCODE_ARCH)" "playwright-install" }
    displayName: Download Electron and Playwright
    condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))

J
João Moreno 已提交
136 137 138 139 140 141
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      exec { yarn electron $(VSCODE_ARCH) }
      exec { .\scripts\test.bat --build --tfs "Unit Tests" }
    displayName: Run unit tests (Electron)
J
João Moreno 已提交
142
    timeoutInMinutes: 7
J
João Moreno 已提交
143
    condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
D
Daniel Imms 已提交
144

J
João Moreno 已提交
145 146 147 148 149
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      exec { yarn test-browser --build --browser chromium --browser firefox --tfs "Browser Unit Tests" }
    displayName: Run unit tests (Browser)
J
João Moreno 已提交
150
    timeoutInMinutes: 7
J
João Moreno 已提交
151
    condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
152

J
João Moreno 已提交
153 154 155 156 157
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      exec { yarn --cwd test/integration/browser compile }
    displayName: Compile integration tests
158
    condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
J
João Moreno 已提交
159

J
João Moreno 已提交
160 161 162 163 164 165 166 167 168 169 170
  - powershell: |
      # Figure out the full absolute path of the product we just built
      # including the remote server and configure the integration tests
      # to run with these builds instead of running out of sources.
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      $AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
      $AppProductJson = Get-Content -Raw -Path "$AppRoot\resources\app\product.json" | ConvertFrom-Json
      $AppNameShort = $AppProductJson.nameShort
      exec { $env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"; $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"; .\scripts\test-integration.bat --build --tfs "Integration Tests" }
    displayName: Run integration tests (Electron)
J
João Moreno 已提交
171
    timeoutInMinutes: 10
J
João Moreno 已提交
172
    condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
173

J
João Moreno 已提交
174 175 176 177 178
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      exec { $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-web-win32-$(VSCODE_ARCH)"; .\resources\server\test\test-web-integration.bat --browser firefox }
    displayName: Run integration tests (Browser)
J
João Moreno 已提交
179
    timeoutInMinutes: 7
J
João Moreno 已提交
180
    condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
B
Benjamin Pasero 已提交
181

J
João Moreno 已提交
182 183 184 185 186 187 188 189
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      $AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
      $AppProductJson = Get-Content -Raw -Path "$AppRoot\resources\app\product.json" | ConvertFrom-Json
      $AppNameShort = $AppProductJson.nameShort
      exec { $env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"; $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"; .\resources\server\test\test-remote-integration.bat }
    displayName: Run remote integration tests (Electron)
J
João Moreno 已提交
190
    timeoutInMinutes: 7
J
João Moreno 已提交
191
    condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
J
Joao Moreno 已提交
192

J
João Moreno 已提交
193 194 195 196 197 198 199
  - task: PublishPipelineArtifact@0
    inputs:
      artifactName: crash-dump-windows-$(VSCODE_ARCH)
      targetPath: .build\crashes
    displayName: "Publish Crash Reports"
    continueOnError: true
    condition: failed()
200

J
João Moreno 已提交
201 202 203 204 205
  - task: PublishTestResults@2
    displayName: Publish Tests Results
    inputs:
      testResultsFiles: "*-results.xml"
      searchFolder: "$(Build.ArtifactStagingDirectory)/test-results"
206
    condition: and(succeededOrFailed(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
207

J
João Moreno 已提交
208 209 210
  - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
    inputs:
      ConnectedServiceName: "ESRP CodeSign"
J
João Moreno 已提交
211
      FolderPath: "$(CodeSigningFolderPath)"
J
João Moreno 已提交
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
      Pattern: "*.dll,*.exe,*.node"
      signConfigType: inlineSignParams
      inlineOperation: |
        [
          {
            "keyCode": "CP-230012",
            "operationSetCode": "SigntoolSign",
            "parameters": [
              {
                "parameterName": "OpusName",
                "parameterValue": "VS Code"
              },
              {
                "parameterName": "OpusInfo",
                "parameterValue": "https://code.visualstudio.com/"
              },
              {
                "parameterName": "Append",
                "parameterValue": "/as"
              },
              {
                "parameterName": "FileDigest",
                "parameterValue": "/fd \"SHA256\""
              },
              {
                "parameterName": "PageHash",
                "parameterValue": "/NPH"
              },
              {
                "parameterName": "TimeStamp",
                "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
              }
            ],
            "toolName": "sign",
            "toolVersion": "1.0"
          },
          {
            "keyCode": "CP-230012",
            "operationSetCode": "SigntoolVerify",
            "parameters": [
              {
                "parameterName": "VerifyAll",
                "parameterValue": "/all"
              }
            ],
            "toolName": "sign",
            "toolVersion": "1.0"
          }
        ]
      SessionTimeout: 120
J
João Moreno 已提交
262
    condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
J
Joao Moreno 已提交
263

J
João Moreno 已提交
264 265 266 267 268 269 270 271
  - task: NuGetCommand@2
    displayName: Install ESRPClient.exe
    inputs:
      restoreSolution: 'build\azure-pipelines\win32\ESRPClient\packages.config'
      feedsToUse: config
      nugetConfigPath: 'build\azure-pipelines\win32\ESRPClient\NuGet.config'
      externalFeedCredentials: "ESRP Nuget"
      restoreDirectory: packages
J
João Moreno 已提交
272
    condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
J
Joao Moreno 已提交
273

J
João Moreno 已提交
274 275 276 277
  - task: ESRPImportCertTask@1
    displayName: Import ESRP Request Signing Certificate
    inputs:
      ESRP: "ESRP CodeSign"
J
João Moreno 已提交
278
    condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
J
Joao Moreno 已提交
279

J
João Moreno 已提交
280 281 282 283 284 285
  - task: PowerShell@2
    inputs:
      targetType: filePath
      filePath: .\build\azure-pipelines\win32\import-esrp-auth-cert.ps1
      arguments: "$(ESRP-SSL-AADAuth)"
    displayName: Import ESRP Auth Certificate
J
João Moreno 已提交
286
    condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
J
Joao Moreno 已提交
287

J
João Moreno 已提交
288 289 290 291 292 293 294 295
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      $env:AZURE_STORAGE_ACCESS_KEY_2 = "$(vscode-storage-key)"
      $env:AZURE_DOCUMENTDB_MASTERKEY = "$(builds-docdb-key-readwrite)"
      $env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
      .\build\azure-pipelines\win32\publish.ps1
    displayName: Publish
J
João Moreno 已提交
296
    condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
J
Joao Moreno 已提交
297

298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
  - publish: $(System.DefaultWorkingDirectory)\.build\win32-$(VSCODE_ARCH)\archive\VSCode-win32-$(VSCODE_ARCH).zip
    artifact: VSCode-win32-$(VSCODE_ARCH).zip
    displayName: Publish archive
    condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))

  - publish: $(System.DefaultWorkingDirectory)\.build\win32-$(VSCODE_ARCH)\system-setup\VSCodeSetup.exe
    artifact: VSCodeSetup-$(VSCODE_ARCH).exe
    displayName: Publish system setup
    condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))

  - publish: $(System.DefaultWorkingDirectory)\.build\win32-$(VSCODE_ARCH)\user-setup\VSCodeSetup.exe
    artifact: VSCodeUserSetup-$(VSCODE_ARCH).exe
    displayName: Publish user setup
    condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))

  - publish: $(System.DefaultWorkingDirectory)\.build\vscode-server-win32-$(VSCODE_ARCH).zip
    artifact: vscode-server-win32-$(VSCODE_ARCH).zip
    displayName: Publish server
    condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))

  - publish: $(System.DefaultWorkingDirectory)\.build\vscode-server-win32-$(VSCODE_ARCH)-web.zip
    artifact: vscode-server-win32-$(VSCODE_ARCH)-web.zip
    displayName: Publish web server
    condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))

J
João Moreno 已提交
323 324 325
  - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
    displayName: "Component Detection"
    continueOnError: true