Path: blob/main/build/azure-pipelines/darwin/product-build-darwin-node-modules.yml
4772 views
parameters:1- name: VSCODE_ARCH2type: string34jobs:5- job: macOSNodeModules_${{ parameters.VSCODE_ARCH }}6displayName: macOS (${{ upper(parameters.VSCODE_ARCH) }})7pool:8name: AcesShared9os: macOS10timeoutInMinutes: 6011variables:12VSCODE_ARCH: ${{ parameters.VSCODE_ARCH }}13steps:14- template: ../common/checkout.yml@self1516- task: NodeTool@017inputs:18versionSource: fromFile19versionFilePath: .nvmrc2021- template: ../distro/download-distro.yml@self2223- task: AzureKeyVault@224displayName: "Azure Key Vault: Get Secrets"25inputs:26azureSubscription: vscode27KeyVaultName: vscode-build-secrets28SecretsFilter: "github-distro-mixin-password,macos-developer-certificate,macos-developer-certificate-key"2930- script: node build/setup-npm-registry.ts $NPM_REGISTRY31condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))32displayName: Setup NPM Registry3334- script: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts darwin $VSCODE_ARCH $(node -p process.arch) > .build/packagelockhash35displayName: Prepare node_modules cache key3637- task: Cache@238inputs:39key: '"node_modules" | .build/packagelockhash'40path: .build/node_modules_cache41cacheHitVar: NODE_MODULES_RESTORED42displayName: Restore node_modules cache4344- script: |45set -e46# Set the private NPM registry to the global npmrc file47# so that authentication works for subfolders like build/, remote/, extensions/ etc48# which does not have their own .npmrc file49npm config set registry "$NPM_REGISTRY"50echo "##vso[task.setvariable variable=NPMRC_PATH]$(npm config get userconfig)"51condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))52displayName: Setup NPM5354- task: npmAuthenticate@055inputs:56workingFile: $(NPMRC_PATH)57condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))58displayName: Setup NPM Authentication5960- script: |61set -e62c++ --version63xcode-select -print-path64python3 -m pip install setuptools6566for i in {1..5}; do # try 5 times67npm ci && break68if [ $i -eq 5 ]; then69echo "Npm install failed too many times" >&270exit 171fi72echo "Npm install failed $i, trying again..."73done74env:75npm_config_arch: $(VSCODE_ARCH)76ELECTRON_SKIP_BINARY_DOWNLOAD: 177PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 178GITHUB_TOKEN: "$(github-distro-mixin-password)"79# Avoid using dlopen to load Kerberos on macOS which can cause missing libraries80# https://github.com/mongodb-js/kerberos/commit/04044d2814ad1d01e77f1ce87f26b03d86692cf281# flipped the default to support legacy linux distros which shouldn't happen82# on macOS.83GYP_DEFINES: "kerberos_use_rtld=false"84displayName: Install dependencies85condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))8687- script: node build/azure-pipelines/distro/mixin-npm.ts88condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))89displayName: Mixin distro node modules9091- script: |92set -e93node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt94mkdir -p .build/node_modules_cache95tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt96condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))97displayName: Create node_modules archive9899100