File tree 3 files changed +8
-9
lines changed 3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -92,13 +92,9 @@ describe('restore-cache', () => {
92
92
dependencyFile
93
93
) ;
94
94
await cacheDistributor . restoreCache ( ) ;
95
- let pythonKey = '' ;
96
- if ( packageManager === 'pipenv' ) {
97
- pythonKey = `python-${ pythonVersion } -` ;
98
- }
99
95
100
96
expect ( infoSpy ) . toHaveBeenCalledWith (
101
- `Cache restored from key: setup-python-${ process . env [ 'RUNNER_OS' ] } -${ pythonKey } ${ packageManager } -${ fileHash } `
97
+ `Cache restored from key: setup-python-${ process . env [ 'RUNNER_OS' ] } -python- ${ pythonVersion } - ${ packageManager } -${ fileHash } `
102
98
) ;
103
99
}
104
100
) ;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export function getCacheDistributor(
13
13
) {
14
14
switch ( packageManager ) {
15
15
case PackageManagers . Pip :
16
- return new PipCache ( cacheDependencyPath ) ;
16
+ return new PipCache ( pythonVersion , cacheDependencyPath ) ;
17
17
case PackageManagers . Pipenv :
18
18
return new PipenvCache ( pythonVersion , cacheDependencyPath ) ;
19
19
default :
Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ import os from 'os';
8
8
import CacheDistributor from './cache-distributor' ;
9
9
10
10
class PipCache extends CacheDistributor {
11
- constructor ( cacheDependencyPath : string = '**/requirements.txt' ) {
11
+ constructor (
12
+ private pythonVersion : string ,
13
+ cacheDependencyPath : string = '**/requirements.txt'
14
+ ) {
12
15
super ( 'pip' , cacheDependencyPath ) ;
13
16
}
14
17
@@ -36,8 +39,8 @@ class PipCache extends CacheDistributor {
36
39
37
40
protected async computeKeys ( ) {
38
41
const hash = await glob . hashFiles ( this . cacheDependencyPath ) ;
39
- const primaryKey = `${ this . CACHE_KEY_PREFIX } -${ process . env [ 'RUNNER_OS' ] } -${ this . packageManager } -${ hash } ` ;
40
- const restoreKey = `${ this . CACHE_KEY_PREFIX } -${ process . env [ 'RUNNER_OS' ] } -${ this . packageManager } ` ;
42
+ const primaryKey = `${ this . CACHE_KEY_PREFIX } -${ process . env [ 'RUNNER_OS' ] } -python- ${ this . pythonVersion } - ${ this . packageManager } -${ hash } ` ;
43
+ const restoreKey = `${ this . CACHE_KEY_PREFIX } -${ process . env [ 'RUNNER_OS' ] } -python- ${ this . pythonVersion } - ${ this . packageManager } ` ;
41
44
42
45
return {
43
46
primaryKey,
You can’t perform that action at this time.
0 commit comments