Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion .github/workflows/e2e-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup Python
id: setup-python
uses: ./
with:
python-version: ${{ matrix.python-version }}
cache: 'pipenv'
- name: Install pipenv
run: pipx install pipenv
run: pipx install pipenv --python ${{ steps.setup-python.outputs.python-path }}
- name: Install dependencies
run: |
cd __tests__/data
Expand Down
16 changes: 14 additions & 2 deletions dist/cache-save/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57529,8 +57529,20 @@ class CacheDistributor {
const cachePath = yield this.getCacheGlobalDirectories();
core.saveState(State.CACHE_PATHS, cachePath);
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
this.handleMatchResult(matchedKey, primaryKey);
try {
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
this.handleMatchResult(matchedKey, primaryKey);
}
catch (error) {
const typedError = error;
if (typedError.name === cache.ValidationError.name) {
throw error;
}
else {
core.warning(typedError.message);
core.setOutput('cache-hit', false);
}
}
});
}
handleMatchResult(matchedKey, primaryKey) {
Expand Down
16 changes: 14 additions & 2 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63600,8 +63600,20 @@ class CacheDistributor {
const cachePath = yield this.getCacheGlobalDirectories();
core.saveState(State.CACHE_PATHS, cachePath);
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
this.handleMatchResult(matchedKey, primaryKey);
try {
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
this.handleMatchResult(matchedKey, primaryKey);
}
catch (error) {
const typedError = error;
if (typedError.name === cache.ValidationError.name) {
throw error;
}
else {
core.warning(typedError.message);
core.setOutput('cache-hit', false);
}
}
});
}
handleMatchResult(matchedKey, primaryKey) {
Expand Down
22 changes: 16 additions & 6 deletions src/cache-distributions/cache-distributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,23 @@ abstract class CacheDistributor {
core.saveState(State.CACHE_PATHS, cachePath);
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);

const matchedKey = await cache.restoreCache(
cachePath,
primaryKey,
restoreKey
);
try {
const matchedKey = await cache.restoreCache(
cachePath,
primaryKey,
restoreKey
);

this.handleMatchResult(matchedKey, primaryKey);
this.handleMatchResult(matchedKey, primaryKey);
} catch (error) {
const typedError = error as Error;
if (typedError.name === cache.ValidationError.name) {
throw error;
} else {
core.warning(typedError.message);
core.setOutput('cache-hit', false);
}
}
}

public handleMatchResult(matchedKey: string | undefined, primaryKey: string) {
Expand Down