mirror of
https://code.forgejo.org/actions/setup-python
synced 2025-06-15 15:34:14 +02:00
Include Python version in pip cache key (#303)
This commit is contained in:
parent
156361d073
commit
ba33a692f1
4 changed files with 13 additions and 13 deletions
|
@ -13,7 +13,7 @@ export function getCacheDistributor(
|
|||
) {
|
||||
switch (packageManager) {
|
||||
case PackageManagers.Pip:
|
||||
return new PipCache(cacheDependencyPath);
|
||||
return new PipCache(pythonVersion, cacheDependencyPath);
|
||||
case PackageManagers.Pipenv:
|
||||
return new PipenvCache(pythonVersion, cacheDependencyPath);
|
||||
default:
|
||||
|
|
|
@ -8,7 +8,10 @@ import os from 'os';
|
|||
import CacheDistributor from './cache-distributor';
|
||||
|
||||
class PipCache extends CacheDistributor {
|
||||
constructor(cacheDependencyPath: string = '**/requirements.txt') {
|
||||
constructor(
|
||||
private pythonVersion: string,
|
||||
cacheDependencyPath: string = '**/requirements.txt'
|
||||
) {
|
||||
super('pip', cacheDependencyPath);
|
||||
}
|
||||
|
||||
|
@ -36,8 +39,8 @@ class PipCache extends CacheDistributor {
|
|||
|
||||
protected async computeKeys() {
|
||||
const hash = await glob.hashFiles(this.cacheDependencyPath);
|
||||
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${this.packageManager}-${hash}`;
|
||||
const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${this.packageManager}`;
|
||||
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
||||
const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`;
|
||||
|
||||
return {
|
||||
primaryKey,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue