setup-pdm
setup-pdm copied to clipboard
[Feature] Add more information for generating cache key
What happened?
Currently, I'm using pdm-project/setup-pdm@v4
for initializing PDM runtime and caching dependencies for my project (See build.yml
). According to the YAML, there should be 5 concurrent jobs running on GitHub, and there should be 5 caches sotred after a single run.
But when I switch to Caches page, there're only 3 caches available.
Error logs seems like follows:
From the cache key, it seems pdm-project/setup-pdm@v4
only tells different caches apart by following informations:
- Operating System:
Windows
,macOS
orLinux
- Python implementation:
python
,pypy
,graalpy
, etc. - Python version:
3.11.9
,3.12.3
,3.13.0-alpha6
, etc. - Hash of the user-specified lock-file
This makes darwin-x64 (runs on macos-13
, which is an x64
runner image) and darwin-arm64 (runs on macos-14
, which is an arm64
runner image) are "the same", windows-x64 (runs on windows-latest
with Python architecture x64
) and windows-x86 (runs on windows-latest
with Python architecture x86
) are the same. This will also cause "restore error" in the next run, led by restoring cache to a wrong architecture image.
Suggestions
Use the same solution as original actions/cache@v4
. Users configure the key on their own by setting with.key
parameter, in my case it can be solved by configuring it as follows:
with:
key: setup-pdm-${{ runner.os }}-${{ runner.arch }}-python-${{ steps.setup-pdm.outputs.python-version }}-${{ hashFiles('pdm.lock') }}