mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-30 07:19:54 +02:00
Cache multiple entries using --files-from tar input
remove known failing test Quote tar paths Add salt to test cache Try reading input files from manifest bump salt Run test on macos more testing Run caching tests on 3 platforms Run tests on self-hosted Apparently cant reference hosted runners by name Bump salt wait for some time after save more timing out smarter waiting Cache in tmp dir that won't be deleted Use child_process instead of actions/exec Revert tempDir hack bump salt more logging More console logging Use filepath to with cacheHttpClient Test cache restoration Revert temp dir hack debug logging clean up cache.yml testing Bump salt change debug output build actions
This commit is contained in:
parent
db235cfc56
commit
e0d1942524
11 changed files with 157 additions and 80 deletions
|
@ -1,4 +1,5 @@
|
|||
import * as core from "@actions/core";
|
||||
import * as glob from "@actions/glob";
|
||||
import * as os from "os";
|
||||
import * as path from "path";
|
||||
|
||||
|
@ -181,16 +182,17 @@ test("isValidEvent returns false for unknown event", () => {
|
|||
expect(isValidEvent).toBe(false);
|
||||
});
|
||||
|
||||
test("expandPaths with no ~ in path", () => {
|
||||
test("resolvePaths with no ~ in path", async () => {
|
||||
// TODO: these test paths will need to exist
|
||||
const filePath = ".cache/yarn";
|
||||
|
||||
const resolvedPath = actionUtils.expandPaths([filePath]);
|
||||
const resolvedPath = await actionUtils.resolvePaths([filePath]);
|
||||
|
||||
const expectedPath = [path.resolve(filePath)];
|
||||
expect(resolvedPath).toStrictEqual(expectedPath);
|
||||
});
|
||||
|
||||
test("expandPaths with ~ in path", () => {
|
||||
test("resolvePaths with ~ in path", async () => {
|
||||
const filePath = "~/.cache/yarn";
|
||||
|
||||
const homedir = jest.requireActual("os").homedir();
|
||||
|
@ -199,20 +201,22 @@ test("expandPaths with ~ in path", () => {
|
|||
return homedir;
|
||||
});
|
||||
|
||||
const resolvedPath = actionUtils.expandPaths([filePath]);
|
||||
const resolvedPath = await actionUtils.resolvePaths([filePath]);
|
||||
|
||||
const expectedPath = [path.join(homedir, ".cache/yarn")];
|
||||
expect(resolvedPath).toStrictEqual(expectedPath);
|
||||
});
|
||||
|
||||
test("expandPaths with home not found", () => {
|
||||
test("resolvePaths with home not found", () => {
|
||||
const filePath = "~/.cache/yarn";
|
||||
const homedirMock = jest.spyOn(os, "homedir");
|
||||
homedirMock.mockImplementation(() => {
|
||||
return "";
|
||||
});
|
||||
// const globMock = jest.spyOn(glob, "homedir");
|
||||
// globMock.mockImplementation(() => "");
|
||||
|
||||
expect(() => actionUtils.expandPaths([filePath])).toThrow(
|
||||
expect(async () => await actionUtils.resolvePaths([filePath])).toThrow(
|
||||
"Unable to resolve `~` to HOME"
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue