microsoft/TypeAgent

Public

mirrored from https://github.com/microsoft/TypeAgentAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
4d2dfc6aafd65d8a6a64a32bd8daef366db48eea

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

pipelines/include-install-pnpm.yml

52lines · modecode

1# Copyright (c) Microsoft Corporation.
2# Licensed under the MIT License.
3
4# include-install-pnpm
5#
6# This template can be included in pipelines to install pnpm with store caching enabled.
7
8parameters:
9 # The path containing the project(s) to build.
10 - name: buildDirectory
11 type: string
12
13 # If set to false, the pnpm store will not be cached or restored from cache.
14 - name: enableCache
15 type: boolean
16 default: true
17
18 # The path to the pnpm store. The contents here will be cached and restored when using pnpm in a pipeline.
19 - name: pnpmStorePath
20 type: string
21 default: $(Pipeline.Workspace)/.pnpm-store
22
23steps:
24 - ${{ if eq(parameters.enableCache, true) }}:
25 - task: Cache@2
26 displayName: Cache pnpm store
27 timeoutInMinutes: 3
28 continueOnError: true
29 inputs:
30 # Caches are already scoped to individual pipelines, so no need to include the release group name or tag
31 # in the cache key
32 key: 'pnpm-store | "$(Agent.OS)" | ${{ parameters.buildDirectory }}/pnpm-lock.yaml'
33 path: ${{ parameters.pnpmStorePath }}
34 restoreKeys: |
35 pnpm-store | "$(Agent.OS)"
36
37 - task: Bash@3
38 displayName: Install and configure pnpm
39 inputs:
40 targetType: "inline"
41 workingDirectory: ${{ parameters.buildDirectory }}
42 # The previous task (cache restoration) can timeout, which is classified as canceled, but since it's just cache
43 # restoration, we want to continue even if it timed out.
44 condition: or(succeeded(), canceled())
45 # workspace-concurrency 0 means use use the CPU core count. This is better than the default (4) for larger agents.
46 script: |
47 echo "Using node $(node --version)"
48 npm install -g corepack@0.31.0
49 sudo corepack enable
50 echo "Using pnpm $(pnpm -v)"
51 pnpm config set store-dir ${{ parameters.pnpmStorePath }}
52 pnpm config set -g workspace-concurrency 0
53