Open andykais opened 4 years ago
check this: https://github.com/pnpm/action-setup
cc @KSXGitHub
Thank you! I still think its worthwhile to add this to the website. Especially since its actually part of the pnpm organization, but feel free to close this issue since I am unblocked
@zkochan I'm here also looking for instructions on how to use actions/cache with pnpm.
I'm a Windows and macOS user so I don't know where the pnpm store exists on Linux, and I didn't find it in documentations.
@yume-chan Add ~/.pnpm-store/v3
to your cache. Don't add node_modules
.
@KSXGitHub Thank you! I know I can't cache node_modules
, so I'm asking for pnpm store path.
Since pnpm/action-setup
has a post run script to prune the store, actions/cache
should run after pnpm/action-setup
.
Turns out actions/cache
also uses post run script to save file.
From my test, GitHub Actions run post run scripts in reverse order, so one should declare actions/cache
in front of pnpm/action-setup
.
Here is my workflow file:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache PNPM store
uses: actions/cache@v2
with:
path: |
~/.pnpm-store/v3
key: ${{ runner.os }}-pnpm
- name: Setup PNPM
uses: pnpm/action-setup@v1.2.0
with:
version: latest
run_install: true
- run: pnpm run build --if-present
- run: pnpm test
Also note that because the store has been pruned, actions/cache can use a fixed cache key.
Also note that because the store has been pruned
what implies that the store has been pruned @yume-chan?
@andykais pnpm/action-setup
has a post script that execute pnpm store prune
.
The subject matter here is sufficiently documented on the Continuous Integration documentation page. This issue can likely be closed.
Github workflows are a fairly popular & free way to run continuous integration. This is what I have come up with for installing with pnpm on ci. I am curious if there is a better way. E.g. something that takes advantage of caching or an action to setup pnpm.