연속 통합
pnpm은 다양한 ci 시스템들과 함께 사용하기 쉽습니다.
In all the provided configuration files the store is cached. However, this is not required, and it is not guaranteed that caching the store will make installation faster. So feel free to not cache the pnpm store in your job.
Travis
Travis CI에선 다음과 같은 코드를 .travis.yml
에 추가함으로써 pnpm을 dependencies를 설치하는데 사용할 수 있습니다:
cache:
npm: false
directories:
- "~/.pnpm-store"
before_install:
- corepack enable
- corepack prepare pnpm@latest-10 --activate
- pnpm config set store-dir ~/.pnpm-store
install:
- pnpm install
Semaphore
Semaphore에선 다음과 같은 코드를 .semaphore/semaphore.yml
에 추가함으로써 pnpm을 dependencies를 설치하고 캐싱하는데에 사용할 수 있습니다:
version: v1.0
name: Semaphore CI pnpm example
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
blocks:
- name: Install dependencies
task:
jobs:
- name: pnpm install
commands:
- corepack enable
- corepack prepare pnpm@latest-10 --activate
- checkout
- cache restore node-$(checksum pnpm-lock.yaml)
- pnpm install
- cache store node-$(checksum pnpm-lock.yaml) $(pnpm store path)
AppVeyor
AppVeyor에선 다음과 같은 코드를 appveyor.yml
에 추가함으로써 pnpm을 dependencies를 설치하는데에 사용할 수 있습니다:
install:
- ps: Install-Product node $env:nodejs_version
- corepack enable
- corepack prepare pnpm@latest-10 --activate
- pnpm install
GitHub Actions
GitHub Actions에선 다음과 같이 .github/workflows/NAME.yml
를 작성함으로써 pnpm을 dependencies를 설치하고 캐싱하는데에 사용할 수 있습니다:
name: pnpm Example Workflow
on:
push:
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
GitLab CI
GitLab에서 pnpm을 사용하여 dependencies을 설치하고 캐싱할 수 있습니다( .gitlab-ci.yml
에 속함).
stages:
- build
build:
stage: build
image: node:18.17.1
before_script:
- corepack enable
- corepack prepare pnpm@latest-10 --activate
- pnpm config set store-dir .pnpm-store
script:
- pnpm install # install dependencies
cache:
key:
files:
- pnpm-lock.yaml
paths:
- .pnpm-store
Bitbucket Pipelines
pnpm을 통해 dependencies를 설치하고 캐시할 수 있습니다.
definitions:
caches:
pnpm: $BITBUCKET_CLONE_DIR/.pnpm-store
pipelines:
pull-requests:
"**":
- step:
name: Build and test
image: node:18.17.1
script:
- corepack enable
- corepack prepare pnpm@latest-10 --activate
- pnpm install
- pnpm run build # Replace with your build/test…etc. commands
caches:
- pnpm
Azure Pipelines
Azure Pipelines에서 pnpm을 사용하여 azure-pipelines.yml
에 추가하여 dependencies을 설치하고 캐싱할 수 있습니다.
variables:
pnpm_config_cache: $(Pipeline.Workspace)/.pnpm-store
steps:
- task: Cache@2
inputs:
key: 'pnpm | "$(Agent.OS)" | pnpm-lock.yaml'
path: $(pnpm_config_cache)
displayName: Cache pnpm
- script: |
corepack enable
corepack prepare pnpm@latest-10 --activate
pnpm config set store-dir $(pnpm_config_cache)
displayName: "Setup pnpm"
- script: |
pnpm install
pnpm run build
displayName: "pnpm install and build"
CircleCI
CircleCI에서 이것을 .circleci/config.yml
에 추가하여 pnpm을 사용하여 dependencies을 설치하고 캐싱할 수 있습니다.
version: 2.1
jobs:
build: # this can be any name you choose
docker:
- image: node:18
resource_class: large
parallelism: 10
steps:
- checkout
- restore_cache:
name: Restore pnpm Package Cache
keys:
- pnpm-packages-{{ checksum "pnpm-lock.yaml" }}
- run:
name: Install pnpm package manager
command: |
corepack enable
corepack prepare pnpm@latest-10 --activate
pnpm config set store-dir .pnpm-store
- run:
name: Install Dependencies
command: |
pnpm install
- save_cache:
name: Save pnpm Package Cache
key: pnpm-packages-{{ checksum "pnpm-lock.yaml" }}
paths:
- .pnpm-store
Jenkins
pnpm을 통해 dependencies를 설치하고 캐시할 수 있습니다.
pipeline {
agent {
docker {
image 'node:lts-bullseye-slim'
args '-p 3000:3000'
}
}
stages {
stage('Build') {
steps {
sh 'corepack enable'
sh 'corepack prepare pnpm@latest-10 --activate'
sh 'pnpm install'
}
}
}
}