Closed hildjj closed 3 years ago
Use actions/cache for that.
Maybe add an example to the docs then? This is what I came up with:
- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with:
# pnpm cache files are stored in `~/.pnpm-store` on Linux/macOS
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}
restore-keys: |
{{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}
and
- name: clean pnpm store
run: store prune
at the end
You don't need to run pnpm prune
directly since post-action of pnpm/action-setup does it for you. Otherwise, it is a good pull request.
will send PR, and thanks for the info on the prune.
What's the benefit of running pnpm store prune
at the end? Is it just to keep the cache size to a minimum? Or is it somehow necessary for expected behavior?
@privatenumber It's just to keep cache size to a minimum.
Cache's path
needs to be set to action's dest
input, or is always ~/.pnpm-store
?
Can I use dest
output like the following example?
- uses: pnpm/action-setup@v2.0.1
id: pnpm-install
with:
version: 7
run_install: false
- uses: actions/cache@v3
name: Packages cache
with:
path: ${{ steps.pnpm-install.outputs.dest }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
In readme states: "Where to store pnpm files" is this that should be cached or includes pnpm internal files?
EDIT: This does not work as expected, since
dest
output is not the pnpm store directory. Solucion provided in #41
There are other directories documented at https://pnpm.io/npmrc#store-dir. Is that directory the intended to be set in the path
input?
no, store-dir should not be in PATH
no, store-dir should not be in PATH
I meant, the path
input of this action. 😅
Correct caching of the
~/.pnpm-store
directory would be cool.See https://github.com/bahmutov/npm-install for one approach to get ideas from