Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/darwin/product-build-darwin-node-modules.yml
5362 views
1
parameters:
2
- name: VSCODE_ARCH
3
type: string
4
5
jobs:
6
- job: macOSNodeModules_${{ parameters.VSCODE_ARCH }}
7
displayName: macOS (${{ upper(parameters.VSCODE_ARCH) }})
8
pool:
9
name: AcesShared
10
os: macOS
11
demands:
12
- ImageOverride -equals ACES_VM_SharedPool_Sequoia
13
timeoutInMinutes: 60
14
variables:
15
VSCODE_ARCH: ${{ parameters.VSCODE_ARCH }}
16
steps:
17
- template: ../common/checkout.yml@self
18
19
- task: NodeTool@0
20
inputs:
21
versionSource: fromFile
22
versionFilePath: .nvmrc
23
24
- template: ../distro/download-distro.yml@self
25
26
- task: AzureKeyVault@2
27
displayName: "Azure Key Vault: Get Secrets"
28
inputs:
29
azureSubscription: vscode
30
KeyVaultName: vscode-build-secrets
31
SecretsFilter: "github-distro-mixin-password,macos-developer-certificate,macos-developer-certificate-key"
32
33
- script: node build/setup-npm-registry.ts $NPM_REGISTRY
34
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
35
displayName: Setup NPM Registry
36
37
- script: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts darwin $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash
38
displayName: Prepare node_modules cache key
39
40
- task: Cache@2
41
inputs:
42
key: '"node_modules" | .build/packagelockhash'
43
path: .build/node_modules_cache
44
cacheHitVar: NODE_MODULES_RESTORED
45
displayName: Restore node_modules cache
46
47
- script: |
48
set -e
49
# Set the private NPM registry to the global npmrc file
50
# so that authentication works for subfolders like build/, remote/, extensions/ etc
51
# which does not have their own .npmrc file
52
npm config set registry "$NPM_REGISTRY"
53
echo "##vso[task.setvariable variable=NPMRC_PATH]$(npm config get userconfig)"
54
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
55
displayName: Setup NPM
56
57
- task: npmAuthenticate@0
58
inputs:
59
workingFile: $(NPMRC_PATH)
60
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
61
displayName: Setup NPM Authentication
62
63
- script: |
64
set -e
65
c++ --version
66
xcode-select -print-path
67
python3 -m pip install setuptools
68
69
for i in {1..5}; do # try 5 times
70
npm ci && break
71
if [ $i -eq 5 ]; then
72
echo "Npm install failed too many times" >&2
73
exit 1
74
fi
75
echo "Npm install failed $i, trying again..."
76
done
77
env:
78
npm_config_arch: $(VSCODE_ARCH)
79
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
80
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
81
GITHUB_TOKEN: "$(github-distro-mixin-password)"
82
# Avoid using dlopen to load Kerberos on macOS which can cause missing libraries
83
# https://github.com/mongodb-js/kerberos/commit/04044d2814ad1d01e77f1ce87f26b03d86692cf2
84
# flipped the default to support legacy linux distros which shouldn't happen
85
# on macOS.
86
GYP_DEFINES: "kerberos_use_rtld=false"
87
displayName: Install dependencies
88
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
89
90
- script: node build/azure-pipelines/distro/mixin-npm.ts
91
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
92
displayName: Mixin distro node modules
93
94
- script: |
95
set -e
96
node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt
97
mkdir -p .build/node_modules_cache
98
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
99
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
100
displayName: Create node_modules archive
101
102