Skip to main content
Version: Next

Continuous Integration

pnpm can easily be used in various continuous integration systems.

Travis#

On Travis CI, you can use pnpm for installing your dependencies by adding this to your .travis.yml file:

.travis.yml
cache:
npm: false
directories:
- "~/.pnpm-store"
before_install:
- curl -f https://get.pnpm.io/v6.7.js | node - add --global [email protected]
- pnpm config set store-dir ~/.pnpm-store
install:
- pnpm install

Semaphore#

On Semaphore, you can use pnpm for installing and caching your dependencies by adding this to your .semaphore/semaphore.yml file:

.semaphore/semaphore.yml
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:
- curl -f https://get.pnpm.io/v6.7.js | node - add --global [email protected]
- checkout
- cache restore node-$(checksum pnpm-lock.yaml)
- pnpm install
- cache store node-$(checksum pnpm-lock.yaml) ~/.pnpm-store

AppVeyor#

On AppVeyor, you can use pnpm for installing your dependencies by adding this to your appveyor.yml:

appveyor.yml
install:
- ps: Install-Product node $env:nodejs_version
- curl -f https://get.pnpm.io/v6.7.js | node - add --global p[email protected]
- pnpm install

Sail CI#

On [Sail CI], you can use pnpm for installing your dependencies by adding this to your .sail.yml file:

.sail.yml
install:
image: znck/pnpm:latest
command:
- pnpm
args:
- install

To get the exact Node version and pnpm version you require you can always make your own Docker image and push to Docker Hub.

GitHub Actions#

On GitHub Actions, you can use pnpm for installing and caching your dependencies like so (belongs in .github/workflows/NAME.yml):

.github/workflows/NAME.yml
name: pnpm Example Workflow
on:
push:
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [15]
steps:
- uses: actions/[email protected]
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-[email protected]
with:
node-version: ${{ matrix.node-version }}
- name: Cache .pnpm-store
uses: actions/[email protected]
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Install pnpm
run: curl -f https://get.pnpm.io/v6.7.js | node - add --global [email protected]
- name: pnpm Build
run: pnpm install
note

Using actions/[email protected] you need to install pnpm with root permissions, eg:sudo npm install -g pnpm. Alternatively, if you specify the Node.js version to use, pnpm may be installed with no priviledged user.

Gitlab CI#

On Gitlab, you can use pnpm for installing and caching your dependencies like so (belongs in .gitlab-ci.yml):

.gitlab-ci.yml
stages:
- build
build:
stage: build
image: node:14.16.0-buster
before_script:
- curl -f https://get.pnpm.io/v6.7.js | node - add --global [email protected]
- pnpm config set store-dir .pnpm-store
script:
- pnpm install # install dependencies
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- .pnpm-store

Bitbucket Pipelines#

You can use pnpm for installing and caching your dependencies:

.bitbucket-pipelines.yml
definitions:
caches:
pnpm: $BITBUCKET_CLONE_DIR/.pnpm-store
pipelines:
pull-requests:
"**":
- step:
name: Build and test
image: node:14.16.0
script:
- curl -f https://get.pnpm.io/v6.7.js | node - add --global [email protected]
- pnpm install
- pnpm run build # Replace with your build/test…etc. commands
caches:
- pnpm
Last updated on by Zoltan Kochan