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:
cache: npm: false directories: - "~/.pnpm-store"before_install: - curl -f https://get.pnpm.io/v6.14.js | node - add --global pnpm@6 - pnpm config set store-dir ~/.pnpm-storeinstall: - pnpm installSemaphore#
On Semaphore, you can use pnpm for installing and caching your dependencies by
adding this to your .semaphore/semaphore.yml file:
version: v1.0name: Semaphore CI pnpm exampleagent: machine: type: e1-standard-2 os_image: ubuntu1804blocks: - name: Install dependencies task: jobs: - name: pnpm install commands: - curl -f https://get.pnpm.io/v6.14.js | node - add --global pnpm@6 - checkout - cache restore node-$(checksum pnpm-lock.yaml) - pnpm install - cache store node-$(checksum pnpm-lock.yaml) ~/.pnpm-storeAppVeyor#
On AppVeyor, you can use pnpm for installing your dependencies by adding this
to your appveyor.yml:
install: - ps: Install-Product node $env:nodejs_version - curl -f https://get.pnpm.io/v6.14.js | node - add --global pnpm@6 - pnpm installSail CI#
On [Sail CI], you can use pnpm for installing your dependencies by adding this to your .sail.yml file:
install: image: znck/pnpm:latest command: - pnpm args: - installTo 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):
name: pnpm Example Workflowon: push:jobs: build: runs-on: ubuntu-20.04 strategy: matrix: node-version: [15] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - name: Cache .pnpm-store uses: actions/cache@v1 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.14.js | node - add --global pnpm@6 - name: pnpm Build run: pnpm installnote
Using actions/setup-node@v2 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):
stages: - build
build: stage: build image: node:14.16.0-buster before_script: - curl -f https://get.pnpm.io/v6.14.js | node - add --global pnpm@6 - pnpm config set store-dir .pnpm-store script: - pnpm install # install dependencies cache: key: "$CI_COMMIT_REF_SLUG" paths: - .pnpm-storeBitbucket Pipelines#
You can use pnpm for installing and caching your dependencies:
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.14.js | node - add --global pnpm@6 - pnpm install - pnpm run build # Replace with your build/test…etc. commands caches: - pnpm