Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/win32/product-build-win32-node-modules.yml
4772 views
1
parameters:
2
- name: VSCODE_ARCH
3
type: string
4
5
jobs:
6
- job: WindowsNodeModules_${{ parameters.VSCODE_ARCH }}
7
displayName: Windows (${{ upper(parameters.VSCODE_ARCH) }})
8
pool:
9
name: 1es-windows-2022-x64
10
os: windows
11
timeoutInMinutes: 60
12
variables:
13
VSCODE_ARCH: ${{ parameters.VSCODE_ARCH }}
14
steps:
15
- template: ../common/checkout.yml@self
16
17
- task: NodeTool@0
18
inputs:
19
versionSource: fromFile
20
versionFilePath: .nvmrc
21
22
- task: UsePythonVersion@0
23
inputs:
24
versionSpec: "3.x"
25
addToPath: true
26
27
- template: ../distro/download-distro.yml@self
28
29
- task: AzureKeyVault@2
30
displayName: "Azure Key Vault: Get Secrets"
31
inputs:
32
azureSubscription: vscode
33
KeyVaultName: vscode-build-secrets
34
SecretsFilter: "github-distro-mixin-password"
35
36
- powershell: node build/setup-npm-registry.ts $env:NPM_REGISTRY
37
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
38
displayName: Setup NPM Registry
39
40
- pwsh: |
41
mkdir .build -ea 0
42
node build/azure-pipelines/common/computeNodeModulesCacheKey.ts win32 $(VSCODE_ARCH) $(node -p process.arch) > .build/packagelockhash
43
displayName: Prepare node_modules cache key
44
45
- task: Cache@2
46
inputs:
47
key: '"node_modules" | .build/packagelockhash'
48
path: .build/node_modules_cache
49
cacheHitVar: NODE_MODULES_RESTORED
50
displayName: Restore node_modules cache
51
52
- powershell: |
53
. build/azure-pipelines/win32/exec.ps1
54
$ErrorActionPreference = "Stop"
55
# Set the private NPM registry to the global npmrc file
56
# so that authentication works for subfolders like build/, remote/, extensions/ etc
57
# which does not have their own .npmrc file
58
exec { npm config set registry "$env:NPM_REGISTRY" }
59
$NpmrcPath = (npm config get userconfig)
60
echo "##vso[task.setvariable variable=NPMRC_PATH]$NpmrcPath"
61
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
62
displayName: Setup NPM
63
64
- task: npmAuthenticate@0
65
inputs:
66
workingFile: $(NPMRC_PATH)
67
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
68
displayName: Setup NPM Authentication
69
70
- powershell: |
71
. build/azure-pipelines/win32/exec.ps1
72
$ErrorActionPreference = "Stop"
73
exec { npm ci }
74
env:
75
npm_config_arch: $(VSCODE_ARCH)
76
npm_config_foreground_scripts: "true"
77
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
78
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
79
GITHUB_TOKEN: "$(github-distro-mixin-password)"
80
retryCountOnTaskFailure: 5
81
displayName: Install dependencies
82
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
83
84
- powershell: node build/azure-pipelines/distro/mixin-npm.ts
85
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
86
displayName: Mixin distro node modules
87
88
- powershell: |
89
. build/azure-pipelines/win32/exec.ps1
90
$ErrorActionPreference = "Stop"
91
exec { node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt }
92
exec { mkdir -Force .build/node_modules_cache }
93
exec { 7z.exe a .build/node_modules_cache/cache.7z -mx3 `@.build/node_modules_list.txt }
94
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
95
displayName: Create node_modules archive
96
97