10000 Cache hit output by dhvcc · Pull Request #373 · actions/setup-python · GitHub
[go: up one dir, main page]

Skip to content

Cache hit output #373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix tests and rebuild
  • Loading branch information
dhvcc committed Apr 4, 2022
commit 168d1eac87c5d23d88a075a8e04a49583fa711f6
15 changes: 8 additions & 7 deletions __tests__/cache-restore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,27 +193,28 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py

describe('Check if handleMatchResult', () => {
it.each([
['pip', '3.8.12', 'requirements.txt', 'someKey', true],
['pipenv', '3.9.1', 'requirements.txt', 'someKey', true],
['poetry', '3.8.12', 'requirements.txt', 'someKey', true],
['pip', '3.9.2', ' 10000 requirements.txt', undefined, false],
['pipenv', '3.8.12', 'requirements.txt', undefined, false],
['poetry', '3.9.12', 'requirements.txt', undefined, false]
['pip', '3.8.12', 'requirements.txt', 'someKey', 'someKey', true],
['pipenv', '3.9.1', 'requirements.txt', 'someKey', 'someKey', true],
['poetry', '3.8.12', 'requirements.txt', 'someKey', 'someKey', true],
['pip', '3.9.2', 'requirements.txt', undefined, 'someKey', false],
['pipenv', '3.8.12', 'requirements.txt', undefined, 'someKey', false],
['poetry', '3.9.12', 'requirements.txt', undefined, 'someKey', false]
])(
'sets correct outputs',
async (
packageManager,
pythonVersion,
dependencyFile,
matchedKey,
restoredKey,
expectedOutputValue
) => {
const cacheDistributor = getCacheDistributor(
packageManager,
pythonVersion,
dependencyFile
);
cacheDistributor.handleMatchResult(matchedKey);
cacheDistributor.handleMatchResult(matchedKey, restoredKey);
expect(setOutputSpy).toHaveBeenCalledWith(
'cache-hit',
expectedOutputValue
Expand Down
4 changes: 2 additions & 2 deletions dist/cache-save/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37238,14 +37238,14 @@ class CacheDistributor {
});
}
handleMatchResult(matchedKey, primaryKey) {
if (matchedKey == primaryKey) {
if (matchedKey) {
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
core.info(`Cache restored from key: ${matchedKey}`);
}
else {
core.info(`${this.packageManager} cache is not found`);
}
core.setOutput('cache-hit', Boolean(matchedKey));
core.setOutput('cache-hit', matchedKey === primaryKey);
}
}
exports.default = CacheDistributor;
Expand Down
4 changes: 2 additions & 2 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42583,14 +42583,14 @@ class CacheDistributor {
});
}
handleMatchResult(matchedKey, primaryKey) {
if (matchedKey == primaryKey) {
if (matchedKey) {
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
core.info(`Cache restored from key: ${matchedKey}`);
}
else {
core.info(`${this.packageManager} cache is not found`);
}
core.setOutput('cache-hit', Boolean(matchedKey));
core.setOutput('cache-hit', matchedKey === primaryKey);
}
}
exports.default = CacheDistributor;
Expand Down
0