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