Path: blob/main/build/azure-pipelines/win32/product-build-win32-compile.yml
3520 views
parameters:1- name: VSCODE_ARCH2type: string3- name: VSCODE_CIBUILD4type: boolean5- name: VSCODE_QUALITY6type: string7- name: VSCODE_RUN_ELECTRON_TESTS8type: boolean9default: false10- name: VSCODE_RUN_BROWSER_TESTS11type: boolean12default: false13- name: VSCODE_RUN_REMOTE_TESTS14type: boolean15default: false1617steps:18- template: ../common/checkout.yml@self1920- task: NodeTool@021inputs:22versionSource: fromFile23versionFilePath: .nvmrc2425- task: UsePythonVersion@026inputs:27versionSpec: "3.x"28addToPath: true2930- template: ../distro/download-distro.yml@self3132- task: AzureKeyVault@233displayName: "Azure Key Vault: Get Secrets"34inputs:35azureSubscription: vscode36KeyVaultName: vscode-build-secrets37SecretsFilter: "github-distro-mixin-password"3839- task: DownloadPipelineArtifact@240inputs:41artifact: Compilation42path: $(Build.ArtifactStagingDirectory)43displayName: Download compilation output4445- task: ExtractFiles@146displayName: Extract compilation output47inputs:48archiveFilePatterns: "$(Build.ArtifactStagingDirectory)/compilation.tar.gz"49cleanDestinationFolder: false5051- powershell: node build/setup-npm-registry.js $env:NPM_REGISTRY52condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))53displayName: Setup NPM Registry5455- pwsh: |56mkdir .build -ea 057node build/azure-pipelines/common/computeNodeModulesCacheKey.js win32 $(VSCODE_ARCH) $(node -p process.arch) > .build/packagelockhash58displayName: Prepare node_modules cache key5960- task: Cache@261inputs:62key: '"node_modules" | .build/packagelockhash'63path: .build/node_modules_cache64cacheHitVar: NODE_MODULES_RESTORED65displayName: Restore node_modules cache6667- powershell: 7z.exe x .build/node_modules_cache/cache.7z -aoa68condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))69displayName: Extract node_modules cache7071- powershell: |72. build/azure-pipelines/win32/exec.ps173$ErrorActionPreference = "Stop"74# Set the private NPM registry to the global npmrc file75# so that authentication works for subfolders like build/, remote/, extensions/ etc76# which does not have their own .npmrc file77exec { npm config set registry "$env:NPM_REGISTRY" }78$NpmrcPath = (npm config get userconfig)79echo "##vso[task.setvariable variable=NPMRC_PATH]$NpmrcPath"80condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))81displayName: Setup NPM8283- task: npmAuthenticate@084inputs:85workingFile: $(NPMRC_PATH)86condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))87displayName: Setup NPM Authentication8889# Remove once https://github.com/parcel-bundler/watcher/pull/202 is merged.90- pwsh: |91$includes = @'92{93'target_defaults': {94'conditions': [95['OS=="win"', {96"msvs_settings": {97"VCCLCompilerTool": {98"AdditionalOptions": [99"/guard:cf",100"/w34244",101"/w34267",102]103},104"VCLinkerTool": {105"AdditionalOptions": [106"/guard:cf",107]108}109}110}]111]112}113}114'@115116if (!(Test-Path "~/.gyp")) {117mkdir "~/.gyp"118}119echo $includes > "~/.gyp/include.gypi"120displayName: Create include.gypi121condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))122123- powershell: |124. build/azure-pipelines/win32/exec.ps1125$ErrorActionPreference = "Stop"126exec { npm ci }127env:128npm_config_arch: $(VSCODE_ARCH)129npm_config_foreground_scripts: "true"130ELECTRON_SKIP_BINARY_DOWNLOAD: 1131PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1132GITHUB_TOKEN: "$(github-distro-mixin-password)"133retryCountOnTaskFailure: 5134displayName: Install dependencies135condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))136137- powershell: node build/azure-pipelines/distro/mixin-npm138condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))139displayName: Mixin distro node modules140141- powershell: |142. build/azure-pipelines/win32/exec.ps1143$ErrorActionPreference = "Stop"144exec { node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt }145exec { mkdir -Force .build/node_modules_cache }146exec { 7z.exe a .build/node_modules_cache/cache.7z -mx3 `@.build/node_modules_list.txt }147condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))148displayName: Create node_modules archive149150- powershell: node build/azure-pipelines/distro/mixin-quality151displayName: Mixin distro quality152153- template: ../common/install-builtin-extensions.yml@self154155- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:156- powershell: node build\lib\policies win32157displayName: Generate Group Policy definitions158retryCountOnTaskFailure: 3159160- ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'exploration')) }}:161- powershell: node build/win32/explorer-dll-fetcher .build/win32/appx162displayName: Download Explorer dll163164- powershell: |165. build/azure-pipelines/win32/exec.ps1166$ErrorActionPreference = "Stop"167exec { npm run gulp "vscode-win32-$(VSCODE_ARCH)-min-ci" }168exec { npm run gulp "vscode-win32-$(VSCODE_ARCH)-inno-updater" }169echo "##vso[task.setvariable variable=BUILT_CLIENT]true"170echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)"171env:172GITHUB_TOKEN: "$(github-distro-mixin-password)"173displayName: Build client174175# Note: the appx prepare step has to follow Build client step since build step replaces the template176# strings in the raw manifest file at resources/win32/appx/AppxManifest.xml and places it under177# <build-out-dir>/appx/manifest, we need a separate step to prepare the appx package with the178# final contents. In our case only the manifest file is bundled into the appx package.179- ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'exploration')) }}:180- powershell: |181. build/azure-pipelines/win32/exec.ps1182$ErrorActionPreference = "Stop"183# Add Windows SDK to path184$sdk = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64"185$env:PATH = "$sdk;$env:PATH"186$AppxName = if ('$(VSCODE_QUALITY)' -eq 'stable') { 'code' } else { 'code_insider' }187makeappx pack /d "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/appx/manifest" /p "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/appx/${AppxName}_$(VSCODE_ARCH).appx" /nv188# Remove the raw manifest folder189Remove-Item -Path "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/appx/manifest" -Recurse -Force190displayName: Prepare appx package191192- powershell: |193. build/azure-pipelines/win32/exec.ps1194$ErrorActionPreference = "Stop"195exec { npm run gulp "vscode-reh-win32-$(VSCODE_ARCH)-min-ci" }196mv ..\vscode-reh-win32-$(VSCODE_ARCH) ..\vscode-server-win32-$(VSCODE_ARCH) # TODO@joaomoreno197echo "##vso[task.setvariable variable=BUILT_SERVER]true"198echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(CodeSigningFolderPath),$(Agent.BuildDirectory)/vscode-server-win32-$(VSCODE_ARCH)"199env:200GITHUB_TOKEN: "$(github-distro-mixin-password)"201displayName: Build server202203- powershell: |204. build/azure-pipelines/win32/exec.ps1205$ErrorActionPreference = "Stop"206exec { npm run gulp "vscode-reh-web-win32-$(VSCODE_ARCH)-min-ci" }207mv ..\vscode-reh-web-win32-$(VSCODE_ARCH) ..\vscode-server-win32-$(VSCODE_ARCH)-web # TODO@joaomoreno208echo "##vso[task.setvariable variable=BUILT_WEB]true"209env:210GITHUB_TOKEN: "$(github-distro-mixin-password)"211displayName: Build server (web)212213- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:214- task: DownloadPipelineArtifact@2215inputs:216artifact: unsigned_vscode_cli_win32_$(VSCODE_ARCH)_cli217patterns: "**"218path: $(Build.ArtifactStagingDirectory)/cli219displayName: Download VS Code CLI220221- powershell: |222. build/azure-pipelines/win32/exec.ps1223$ErrorActionPreference = "Stop"224$ArtifactName = (gci -Path "$(Build.ArtifactStagingDirectory)/cli" | Select-Object -last 1).FullName225Expand-Archive -Path $ArtifactName -DestinationPath "$(Build.ArtifactStagingDirectory)/cli"226$AppProductJson = Get-Content -Raw -Path "$(Agent.BuildDirectory)\VSCode-win32-$(VSCODE_ARCH)\resources\app\product.json" | ConvertFrom-Json227$CliAppName = $AppProductJson.tunnelApplicationName228$AppName = $AppProductJson.applicationName229Move-Item -Path "$(Build.ArtifactStagingDirectory)/cli/$AppName.exe" -Destination "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/bin/$CliAppName.exe"230displayName: Move VS Code CLI231232- task: UseDotNet@2233inputs:234version: 6.x235236- task: EsrpCodeSigning@5237inputs:238UseMSIAuthentication: true239ConnectedServiceName: vscode-esrp240AppRegistrationClientId: $(ESRP_CLIENT_ID)241AppRegistrationTenantId: $(ESRP_TENANT_ID)242AuthAKVName: vscode-esrp243AuthSignCertName: esrp-sign244FolderPath: .245Pattern: noop246displayName: 'Install ESRP Tooling'247248- powershell: |249. build/azure-pipelines/win32/exec.ps1250$ErrorActionPreference = "Stop"251$EsrpCodeSigningTool = (gci -directory -filter EsrpCodeSigning_* $(Agent.RootDirectory)\_tasks | Select-Object -last 1).FullName252$Version = (gci -directory $EsrpCodeSigningTool | Select-Object -last 1).FullName253echo "##vso[task.setvariable variable=EsrpCliDllPath]$Version\net6.0\esrpcli.dll"254displayName: Find ESRP CLI255256- powershell: |257. build/azure-pipelines/win32/exec.ps1258$ErrorActionPreference = "Stop"259mkdir -Force .build/node-cpuprofile260exec { npx deemon --detach --wait -- npx zx build/azure-pipelines/win32/codesign.js }261env:262SYSTEM_ACCESSTOKEN: $(System.AccessToken)263NODE_DEBUG: "net,child_process"264NODE_OPTIONS: "--report-filename=stdout --report-uncaught-exception --report-on-fatalerror --cpu-prof --cpu-prof-dir=.build/node-cpuprofile"265displayName: ✍️ Codesign266267- ${{ if or(eq(parameters.VSCODE_RUN_ELECTRON_TESTS, true), eq(parameters.VSCODE_RUN_BROWSER_TESTS, true), eq(parameters.VSCODE_RUN_REMOTE_TESTS, true)) }}:268- template: product-build-win32-test.yml@self269parameters:270VSCODE_ARCH: ${{ parameters.VSCODE_ARCH }}271VSCODE_RUN_ELECTRON_TESTS: ${{ parameters.VSCODE_RUN_ELECTRON_TESTS }}272VSCODE_RUN_BROWSER_TESTS: ${{ parameters.VSCODE_RUN_BROWSER_TESTS }}273VSCODE_RUN_REMOTE_TESTS: ${{ parameters.VSCODE_RUN_REMOTE_TESTS }}274275- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:276- powershell: |277. build/azure-pipelines/win32/exec.ps1278$ErrorActionPreference = "Stop"279exec { npx deemon --attach -- npx zx build/azure-pipelines/win32/codesign.js }280condition: succeededOrFailed()281env:282NODE_DEBUG: "net,child_process"283NODE_OPTIONS: "--report-filename=stdout --report-uncaught-exception --report-on-fatalerror --cpu-prof --cpu-prof-dir=.build/node-cpuprofile"284displayName: "✍️ Post-job: Codesign"285286- powershell: |287$ErrorActionPreference = "Stop"288289$PackageJson = Get-Content -Raw -Path ..\VSCode-win32-$(VSCODE_ARCH)\resources\app\package.json | ConvertFrom-Json290$Version = $PackageJson.version291292$ClientArchivePath = ".build\win32-$(VSCODE_ARCH)\VSCode-win32-$(VSCODE_ARCH)-$Version.zip"293$ServerArchivePath = ".build\win32-$(VSCODE_ARCH)\vscode-server-win32-$(VSCODE_ARCH).zip"294$WebArchivePath = ".build\win32-$(VSCODE_ARCH)\vscode-server-win32-$(VSCODE_ARCH)-web.zip"295296$SystemSetupPath = ".build\win32-$(VSCODE_ARCH)\system-setup\VSCodeSetup-$(VSCODE_ARCH)-$Version.exe"297$UserSetupPath = ".build\win32-$(VSCODE_ARCH)\user-setup\VSCodeUserSetup-$(VSCODE_ARCH)-$Version.exe"298299mv .build\win32-$(VSCODE_ARCH)\system-setup\VSCodeSetup.exe $SystemSetupPath300mv .build\win32-$(VSCODE_ARCH)\user-setup\VSCodeSetup.exe $UserSetupPath301302echo "##vso[task.setvariable variable=CLIENT_PATH]$ClientArchivePath"303echo "##vso[task.setvariable variable=SERVER_PATH]$ServerArchivePath"304echo "##vso[task.setvariable variable=WEB_PATH]$WebArchivePath"305306echo "##vso[task.setvariable variable=SYSTEM_SETUP_PATH]$SystemSetupPath"307echo "##vso[task.setvariable variable=USER_SETUP_PATH]$UserSetupPath"308condition: succeededOrFailed()309displayName: Move setup packages310311- powershell: echo "##vso[task.setvariable variable=ARTIFACT_PREFIX]attempt$(System.JobAttempt)_"312condition: and(succeededOrFailed(), notIn(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues'))313displayName: Generate artifact prefix314315316