product-build-win32.yml 10.4 KB
Newer Older
J
Joao Moreno 已提交
1
steps:
J
João Moreno 已提交
2 3 4 5
  - powershell: |
      mkdir .build -ea 0
      "$env:BUILD_SOURCEVERSION" | Out-File -Encoding ascii -NoNewLine .build\commit
      "$env:VSCODE_QUALITY" | Out-File -Encoding ascii -NoNewLine .build\quality
J
build:  
João Moreno 已提交
6
      "$env:ENABLE_TERRAPIN" | Out-File -Encoding ascii -NoNewLine .build\terrapin
J
João Moreno 已提交
7
    displayName: Prepare cache flag
J
Joao Moreno 已提交
8

J
João Moreno 已提交
9 10
  - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
    inputs:
J
build:  
João Moreno 已提交
11
      keyfile: "build/.cachesalt, .build/commit, .build/quality, .build/terrapin"
J
João Moreno 已提交
12 13 14 15
      targetfolder: ".build, out-build, out-vscode-min, out-vscode-reh-min, out-vscode-reh-web-min"
      vstsFeed: "npm-vscode"
      platformIndependent: true
      alias: "Compilation"
J
Joao Moreno 已提交
16

J
João Moreno 已提交
17 18 19 20 21
  - powershell: |
      $ErrorActionPreference = "Stop"
      exit 1
    displayName: Check RestoreCache
    condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true'))
J
Joao Moreno 已提交
22

J
João Moreno 已提交
23 24 25
  - task: NodeTool@0
    inputs:
      versionSpec: "12.18.3"
J
Joao Moreno 已提交
26

J
João Moreno 已提交
27 28 29
  - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
    inputs:
      versionSpec: "1.x"
J
Joao Moreno 已提交
30

J
João Moreno 已提交
31 32 33 34
  - task: UsePythonVersion@0
    inputs:
      versionSpec: "2.x"
      addToPath: true
J
Joao Moreno 已提交
35

J
João Moreno 已提交
36 37 38 39 40
  - task: AzureKeyVault@1
    displayName: "Azure Key Vault: Get Secrets"
    inputs:
      azureSubscription: "vscode-builds-subscription"
      KeyVaultName: vscode
J
build  
Joao Moreno 已提交
41

J
João Moreno 已提交
42 43 44 45
  - 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 已提交
46

J
João Moreno 已提交
47 48
      exec { git config user.email "vscode@microsoft.com" }
      exec { git config user.name "VSCode" }
J
Joao Moreno 已提交
49

J
João Moreno 已提交
50 51 52
      mkdir .build -ea 0
      "$(VSCODE_ARCH)" | Out-File -Encoding ascii -NoNewLine .build\arch
    displayName: Prepare tooling
J
Joao Moreno 已提交
53

J
João Moreno 已提交
54 55 56 57 58 59 60
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      exec { git remote add distro "https://github.com/$(VSCODE_MIXIN_REPO).git" }
      exec { git fetch distro }
      exec { git merge $(node -p "require('./package.json').distro") }
    displayName: Merge distro
J
Joao Moreno 已提交
61

J
João Moreno 已提交
62 63
  - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
    inputs:
J
build:  
João Moreno 已提交
64
      keyfile: ".build/arch, .build/terrapin, build/.cachesalt, .yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock"
J
João Moreno 已提交
65 66
      targetfolder: "**/node_modules, !**/node_modules/**/node_modules"
      vstsFeed: "npm-vscode"
J
Joao Moreno 已提交
67

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

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 80 81
      retry { exec { yarn --frozen-lockfile } }
    env:
      npm_config_arch: $(VSCODE_ARCH)
      CHILD_CONCURRENCY: 1
J
João Moreno 已提交
82 83
    displayName: Install dependencies
    condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
J
Joao Moreno 已提交
84

J
João Moreno 已提交
85 86
  - task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
    inputs:
J
build:  
João Moreno 已提交
87
      keyfile: ".build/arch, .build/terrapin, build/.cachesalt, .yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock"
J
João Moreno 已提交
88 89 90
      targetfolder: "**/node_modules, !**/node_modules/**/node_modules"
      vstsFeed: "npm-vscode"
    condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
J
Joao Moreno 已提交
91

J
João Moreno 已提交
92 93 94 95 96 97
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      exec { yarn postinstall }
    displayName: Run postinstall scripts
    condition: and(succeeded(), eq(variables['CacheRestored'], 'true'))
J
Joao Moreno 已提交
98

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

J
João Moreno 已提交
105 106 107 108 109 110 111 112 113 114
  - powershell: |
      . build/azure-pipelines/win32/exec.ps1
      $ErrorActionPreference = "Stop"
      $env:VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)"
      exec { yarn gulp "vscode-win32-$env:VSCODE_ARCH-min-ci" }
      exec { yarn gulp "vscode-reh-win32-$env:VSCODE_ARCH-min-ci" }
      exec { yarn gulp "vscode-reh-web-win32-$env:VSCODE_ARCH-min-ci" }
      exec { yarn gulp "vscode-win32-$env:VSCODE_ARCH-code-helper" }
      exec { yarn gulp "vscode-win32-$env:VSCODE_ARCH-inno-updater" }
    displayName: Build
J
Joao Moreno 已提交
115

J
João Moreno 已提交
116 117 118 119 120 121 122
  - 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)
    condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
D
Daniel Imms 已提交
123

J
João Moreno 已提交
124 125 126 127 128 129
  - 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)
    condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
130

J
João Moreno 已提交
131 132 133 134 135 136 137 138 139 140 141 142
  - 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)
    condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
143

J
João Moreno 已提交
144 145 146 147 148 149
  - 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)
    condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
B
Benjamin Pasero 已提交
150

J
João Moreno 已提交
151 152 153 154 155 156 157 158 159
  - 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)
    condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
J
Joao Moreno 已提交
160

J
João Moreno 已提交
161 162 163 164 165 166 167
  - task: PublishPipelineArtifact@0
    inputs:
      artifactName: crash-dump-windows-$(VSCODE_ARCH)
      targetPath: .build\crashes
    displayName: "Publish Crash Reports"
    continueOnError: true
    condition: failed()
168

J
João Moreno 已提交
169 170 171 172 173 174
  - task: PublishTestResults@2
    displayName: Publish Tests Results
    inputs:
      testResultsFiles: "*-results.xml"
      searchFolder: "$(Build.ArtifactStagingDirectory)/test-results"
    condition: succeededOrFailed()
175

J
João Moreno 已提交
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
  - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
    inputs:
      ConnectedServiceName: "ESRP CodeSign"
      FolderPath: "$(agent.builddirectory)/VSCode-win32-$(VSCODE_ARCH),$(agent.builddirectory)/vscode-reh-win32-$(VSCODE_ARCH)"
      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
Joao Moreno 已提交
230

J
João Moreno 已提交
231 232 233 234 235 236 237 238
  - 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
Joao Moreno 已提交
239

J
João Moreno 已提交
240 241 242 243
  - task: ESRPImportCertTask@1
    displayName: Import ESRP Request Signing Certificate
    inputs:
      ESRP: "ESRP CodeSign"
J
Joao Moreno 已提交
244

J
João Moreno 已提交
245 246 247 248 249 250
  - 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
Joao Moreno 已提交
251

J
João Moreno 已提交
252 253 254 255 256 257 258 259
  - 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
Joao Moreno 已提交
260

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