Compare commits

...

19 Commits

Author SHA1 Message Date
67b144e17c Add backend ids 2024-06-24 01:16:26 -07:00
ae82de5d80 Add fix cache paths 2024-06-17 03:35:51 -07:00
92c0d581d5 Add more debug info 2024-06-17 02:58:38 -07:00
15ed468872 Fix cache save 2024-06-17 02:39:15 -07:00
2fbb473cf9 Fix cache misses 2024-06-17 02:35:05 -07:00
d8dede30d8 Fix cache service url bug 2024-06-17 01:32:58 -07:00
313eb59159 Add downloads v2 2024-06-17 01:17:28 -07:00
07e50f1839 Use zlib for compression 2024-06-13 03:18:21 -07:00
b4b70a7f57 Implement cache v2 2024-06-10 12:13:36 -07:00
b88a5b44f3 Implement cache v2 2024-06-10 12:02:34 -07:00
643d6d6123 Implement cache v2 2024-06-10 11:37:36 -07:00
f7e6edf3a0 Implement cache v2 2024-06-10 11:07:49 -07:00
270eaa9768 Add twirp client 2024-05-29 06:29:41 -07:00
a2aae2e903 Add warning 2024-05-23 09:22:18 -07:00
2c0830523b test 2024-05-23 09:16:10 -07:00
0c45773b62 Merge pull request #1327 from cdce8p/fix-fail-on-cache-miss
Fix `fail-on-cache-miss` not working
2024-03-19 09:31:49 -04:00
8a55f839aa Add test case for process exit
Co-authored-by: Bethany <bethanyj28@users.noreply.github.com>
2024-03-19 09:28:12 +01:00
3884cace14 Bump version 2024-03-01 07:28:18 +01:00
e29dad3e36 Fix fail-on-cache-miss not working 2024-03-01 07:28:18 +01:00
9 changed files with 267647 additions and 16960 deletions

View File

@ -1,5 +1,9 @@
# Releases
### 4.0.2
- Fixed restore `fail-on-cache-miss` not working.
### 4.0.1
- Updated `isGhes` check

View File

@ -449,3 +449,19 @@ test("restore with lookup-only set", async () => {
);
expect(failedMock).toHaveBeenCalledTimes(0);
});
test("restore failure with earlyExit should call process exit", async () => {
testUtils.setInput(Inputs.Path, "node_modules");
const failedMock = jest.spyOn(core, "setFailed");
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
const processExitMock = jest.spyOn(process, "exit").mockImplementation();
// call restoreImpl with `earlyExit` set to true
await restoreImpl(new StateProvider(), true);
expect(restoreCacheMock).toHaveBeenCalledTimes(0);
expect(failedMock).toHaveBeenCalledWith(
"Input required and not supplied: key"
);
expect(processExitMock).toHaveBeenCalledWith(1);
});

File diff suppressed because one or more lines are too long

70902
dist/restore/index.js vendored

File diff suppressed because one or more lines are too long

70887
dist/save-only/index.js vendored

File diff suppressed because one or more lines are too long

70887
dist/save/index.js vendored

File diff suppressed because one or more lines are too long

984
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "cache",
"version": "4.0.1",
"version": "4.0.2",
"private": true,
"description": "Cache dependencies and build outputs",
"main": "dist/restore/index.js",
@ -23,10 +23,10 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/cache": "^3.2.3",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.2"
"@actions/cache": "file:/workspaces/toolkit/packages/cache",
"@actions/core": "file:/workspaces/toolkit/packages/core",
"@actions/exec": "file:/workspaces/toolkit/packages/exec",
"@actions/io": "file:/workspaces/toolkit/packages/io"
},
"devDependencies": {
"@types/jest": "^27.5.2",

View File

@ -10,7 +10,8 @@ import {
import * as utils from "./utils/actionUtils";
export async function restoreImpl(
stateProvider: IStateProvider
stateProvider: IStateProvider,
earlyExit?: boolean | undefined
): Promise<string | undefined> {
try {
if (!utils.isCacheFeatureAvailable()) {
@ -83,6 +84,9 @@ export async function restoreImpl(
return cacheKey;
} catch (error: unknown) {
core.setFailed((error as Error).message);
if (earlyExit) {
process.exit(1);
}
}
}
@ -90,14 +94,7 @@ async function run(
stateProvider: IStateProvider,
earlyExit: boolean | undefined
): Promise<void> {
try {
await restoreImpl(stateProvider);
} catch (err) {
console.error(err);
if (earlyExit) {
process.exit(1);
}
}
await restoreImpl(stateProvider, earlyExit);
// node will stay alive if any promises are not resolved,
// which is a possibility if HTTP requests are dangling