setup-pdm icon indicating copy to clipboard operation
setup-pdm copied to clipboard

[Feature] Add more information for generating cache key

Open Dragon1573 opened this issue 2 months ago • 0 comments

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.

image

But when I switch to Caches page, there're only 3 caches available.

image

Error logs seems like follows:

image

From the cache key, it seems pdm-project/setup-pdm@v4 only tells different caches apart by following informations:

  • Operating System: Windows, macOS or Linux
  • 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') }}

Dragon1573 avatar Apr 27 '24 14:04 Dragon1573