diff --git a/__tests__/__fixtures__/helloWorld.txt b/__tests__/__fixtures__/helloWorld.txt deleted file mode 100644 index 95d09f2..0000000 --- a/__tests__/__fixtures__/helloWorld.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/__tests__/actionUtils.test.ts b/__tests__/actionUtils.test.ts deleted file mode 100644 index 419881e..0000000 --- a/__tests__/actionUtils.test.ts +++ /dev/null @@ -1,234 +0,0 @@ -import * as core from "@actions/core"; - -import { Events, Outputs, RefKey, State } from "../src/constants"; -import * as actionUtils from "../src/utils/actionUtils"; -import * as testUtils from "../src/utils/testUtils"; - -jest.mock("@actions/core"); - -beforeAll(() => { - jest.spyOn(core, "getInput").mockImplementation((name, options) => { - return jest.requireActual("@actions/core").getInput(name, options); - }); -}); - -afterEach(() => { - delete process.env[Events.Key]; - delete process.env[RefKey]; -}); - -test("isGhes returns true if server url is not github.com", () => { - try { - process.env["GITHUB_SERVER_URL"] = "http://example.com"; - expect(actionUtils.isGhes()).toBe(true); - } finally { - process.env["GITHUB_SERVER_URL"] = undefined; - } -}); - -test("isGhes returns true when server url is github.com", () => { - try { - process.env["GITHUB_SERVER_URL"] = "http://github.com"; - expect(actionUtils.isGhes()).toBe(false); - } finally { - process.env["GITHUB_SERVER_URL"] = undefined; - } -}); - -test("isExactKeyMatch with undefined cache key returns false", () => { - const key = "linux-rust"; - const cacheKey = undefined; - - expect(actionUtils.isExactKeyMatch(key, cacheKey)).toBe(false); -}); - -test("isExactKeyMatch with empty cache key returns false", () => { - const key = "linux-rust"; - const cacheKey = ""; - - expect(actionUtils.isExactKeyMatch(key, cacheKey)).toBe(false); -}); - -test("isExactKeyMatch with different keys returns false", () => { - const key = "linux-rust"; - const cacheKey = "linux-"; - - expect(actionUtils.isExactKeyMatch(key, cacheKey)).toBe(false); -}); - -test("isExactKeyMatch with different key accents returns false", () => { - const key = "linux-áccent"; - const cacheKey = "linux-accent"; - - expect(actionUtils.isExactKeyMatch(key, cacheKey)).toBe(false); -}); - -test("isExactKeyMatch with same key returns true", () => { - const key = "linux-rust"; - const cacheKey = "linux-rust"; - - expect(actionUtils.isExactKeyMatch(key, cacheKey)).toBe(true); -}); - -test("isExactKeyMatch with same key and different casing returns true", () => { - const key = "linux-rust"; - const cacheKey = "LINUX-RUST"; - - expect(actionUtils.isExactKeyMatch(key, cacheKey)).toBe(true); -}); - -test("setOutputAndState with undefined entry to set cache-hit output", () => { - const key = "linux-rust"; - const cacheKey = undefined; - - const setOutputMock = jest.spyOn(core, "setOutput"); - const saveStateMock = jest.spyOn(core, "saveState"); - - actionUtils.setOutputAndState(key, cacheKey); - - expect(setOutputMock).toHaveBeenCalledWith(Outputs.CacheHit, "false"); - expect(setOutputMock).toHaveBeenCalledTimes(1); - - expect(saveStateMock).toHaveBeenCalledTimes(0); -}); - -test("setOutputAndState with exact match to set cache-hit output and state", () => { - const key = "linux-rust"; - const cacheKey = "linux-rust"; - - const setOutputMock = jest.spyOn(core, "setOutput"); - const saveStateMock = jest.spyOn(core, "saveState"); - - actionUtils.setOutputAndState(key, cacheKey); - - expect(setOutputMock).toHaveBeenCalledWith(Outputs.CacheHit, "true"); - expect(setOutputMock).toHaveBeenCalledTimes(1); - - expect(saveStateMock).toHaveBeenCalledWith(State.CacheMatchedKey, cacheKey); - expect(saveStateMock).toHaveBeenCalledTimes(1); -}); - -test("setOutputAndState with no exact match to set cache-hit output and state", () => { - const key = "linux-rust"; - const cacheKey = "linux-rust-bb828da54c148048dd17899ba9fda624811cfb43"; - - const setOutputMock = jest.spyOn(core, "setOutput"); - const saveStateMock = jest.spyOn(core, "saveState"); - - actionUtils.setOutputAndState(key, cacheKey); - - expect(setOutputMock).toHaveBeenCalledWith(Outputs.CacheHit, "false"); - expect(setOutputMock).toHaveBeenCalledTimes(1); - - expect(saveStateMock).toHaveBeenCalledWith(State.CacheMatchedKey, cacheKey); - expect(saveStateMock).toHaveBeenCalledTimes(1); -}); - -test("getCacheState with no state returns undefined", () => { - const getStateMock = jest.spyOn(core, "getState"); - getStateMock.mockImplementation(() => { - return ""; - }); - - const state = actionUtils.getCacheState(); - - expect(state).toBe(undefined); - - expect(getStateMock).toHaveBeenCalledWith(State.CacheMatchedKey); - expect(getStateMock).toHaveBeenCalledTimes(1); -}); - -test("getCacheState with valid state", () => { - const cacheKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43"; - - const getStateMock = jest.spyOn(core, "getState"); - getStateMock.mockImplementation(() => { - return cacheKey; - }); - - const state = actionUtils.getCacheState(); - - expect(state).toEqual(cacheKey); - - expect(getStateMock).toHaveBeenCalledWith(State.CacheMatchedKey); - expect(getStateMock).toHaveBeenCalledTimes(1); -}); - -test("logWarning logs a message with a warning prefix", () => { - const message = "A warning occurred."; - - const infoMock = jest.spyOn(core, "info"); - - actionUtils.logWarning(message); - - expect(infoMock).toHaveBeenCalledWith(`[warning]${message}`); -}); - -test("isValidEvent returns false for event that does not have a branch or tag", () => { - const event = "foo"; - process.env[Events.Key] = event; - - const isValidEvent = actionUtils.isValidEvent(); - - expect(isValidEvent).toBe(false); -}); - -test("isValidEvent returns true for event that has a ref", () => { - const event = Events.Push; - process.env[Events.Key] = event; - process.env[RefKey] = "ref/heads/feature"; - - const isValidEvent = actionUtils.isValidEvent(); - - expect(isValidEvent).toBe(true); -}); - -test("getInputAsArray returns empty array if not required and missing", () => { - expect(actionUtils.getInputAsArray("foo")).toEqual([]); -}); - -test("getInputAsArray throws error if required and missing", () => { - expect(() => - actionUtils.getInputAsArray("foo", { required: true }) - ).toThrowError(); -}); - -test("getInputAsArray handles single line correctly", () => { - testUtils.setInput("foo", "bar"); - expect(actionUtils.getInputAsArray("foo")).toEqual(["bar"]); -}); - -test("getInputAsArray handles multiple lines correctly", () => { - testUtils.setInput("foo", "bar\nbaz"); - expect(actionUtils.getInputAsArray("foo")).toEqual(["bar", "baz"]); -}); - -test("getInputAsArray handles different new lines correctly", () => { - testUtils.setInput("foo", "bar\r\nbaz"); - expect(actionUtils.getInputAsArray("foo")).toEqual(["bar", "baz"]); -}); - -test("getInputAsArray handles empty lines correctly", () => { - testUtils.setInput("foo", "\n\nbar\n\nbaz\n\n"); - expect(actionUtils.getInputAsArray("foo")).toEqual(["bar", "baz"]); -}); - -test("getInputAsInt returns undefined if input not set", () => { - expect(actionUtils.getInputAsInt("undefined")).toBeUndefined(); -}); - -test("getInputAsInt returns value if input is valid", () => { - testUtils.setInput("foo", "8"); - expect(actionUtils.getInputAsInt("foo")).toBe(8); -}); - -test("getInputAsInt returns undefined if input is invalid or NaN", () => { - testUtils.setInput("foo", "bar"); - expect(actionUtils.getInputAsInt("foo")).toBeUndefined(); -}); - -test("getInputAsInt throws if required and value missing", () => { - expect(() => - actionUtils.getInputAsInt("undefined", { required: true }) - ).toThrowError(); -}); diff --git a/__tests__/create-cache-files.sh b/__tests__/create-cache-files.sh deleted file mode 100755 index 0ce4140..0000000 --- a/__tests__/create-cache-files.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Validate args -prefix="$1" -if [ -z "$prefix" ]; then - echo "Must supply prefix argument" - exit 1 -fi - -path="$2" -if [ -z "$path" ]; then - echo "Must supply path argument" - exit 1 -fi - -mkdir -p $path -echo "$prefix $GITHUB_RUN_ID" > $path/test-file.txt diff --git a/__tests__/restore.test.ts b/__tests__/restore.test.ts deleted file mode 100644 index 4761782..0000000 --- a/__tests__/restore.test.ts +++ /dev/null @@ -1,310 +0,0 @@ -import * as cache from "@actions/cache"; -import * as core from "@actions/core"; - -import { Events, Inputs, RefKey } from "../src/constants"; -import run from "../src/restore"; -import * as actionUtils from "../src/utils/actionUtils"; -import * as testUtils from "../src/utils/testUtils"; - -jest.mock("../src/utils/actionUtils"); - -beforeAll(() => { - jest.spyOn(actionUtils, "isExactKeyMatch").mockImplementation( - (key, cacheResult) => { - const actualUtils = jest.requireActual("../src/utils/actionUtils"); - return actualUtils.isExactKeyMatch(key, cacheResult); - } - ); - - jest.spyOn(actionUtils, "isValidEvent").mockImplementation(() => { - const actualUtils = jest.requireActual("../src/utils/actionUtils"); - return actualUtils.isValidEvent(); - }); - - jest.spyOn(actionUtils, "getInputAsArray").mockImplementation( - (name, options) => { - const actualUtils = jest.requireActual("../src/utils/actionUtils"); - return actualUtils.getInputAsArray(name, options); - } - ); -}); - -beforeEach(() => { - process.env[Events.Key] = Events.Push; - process.env[RefKey] = "refs/heads/feature-branch"; - - jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false); -}); - -afterEach(() => { - testUtils.clearInputs(); - delete process.env[Events.Key]; - delete process.env[RefKey]; -}); - -test("restore with invalid event outputs warning", async () => { - const logWarningMock = jest.spyOn(actionUtils, "logWarning"); - const failedMock = jest.spyOn(core, "setFailed"); - const invalidEvent = "commit_comment"; - process.env[Events.Key] = invalidEvent; - delete process.env[RefKey]; - await run(); - expect(logWarningMock).toHaveBeenCalledWith( - `Event Validation Error: The event type ${invalidEvent} is not supported because it's not tied to a branch or tag ref.` - ); - expect(failedMock).toHaveBeenCalledTimes(0); -}); - -test("restore on GHES should no-op", async () => { - jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true); - - const logWarningMock = jest.spyOn(actionUtils, "logWarning"); - const restoreCacheMock = jest.spyOn(cache, "restoreCache"); - const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput"); - - await run(); - - expect(restoreCacheMock).toHaveBeenCalledTimes(0); - expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); - expect(setCacheHitOutputMock).toHaveBeenCalledWith(false); - expect(logWarningMock).toHaveBeenCalledWith( - "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details" - ); -}); - -test("restore with no path should fail", async () => { - const failedMock = jest.spyOn(core, "setFailed"); - const restoreCacheMock = jest.spyOn(cache, "restoreCache"); - await run(); - expect(restoreCacheMock).toHaveBeenCalledTimes(0); - // this input isn't necessary for restore b/c tarball contains entries relative to workspace - expect(failedMock).not.toHaveBeenCalledWith( - "Input required and not supplied: path" - ); -}); - -test("restore with no key", async () => { - testUtils.setInput(Inputs.Path, "node_modules"); - const failedMock = jest.spyOn(core, "setFailed"); - const restoreCacheMock = jest.spyOn(cache, "restoreCache"); - await run(); - expect(restoreCacheMock).toHaveBeenCalledTimes(0); - expect(failedMock).toHaveBeenCalledWith( - "Input required and not supplied: key" - ); -}); - -test("restore with too many keys should fail", async () => { - const path = "node_modules"; - const key = "node-test"; - const restoreKeys = [...Array(20).keys()].map(x => x.toString()); - testUtils.setInputs({ - path: path, - key, - restoreKeys - }); - const failedMock = jest.spyOn(core, "setFailed"); - const restoreCacheMock = jest.spyOn(cache, "restoreCache"); - await run(); - expect(restoreCacheMock).toHaveBeenCalledTimes(1); - expect(restoreCacheMock).toHaveBeenCalledWith([path], key, restoreKeys); - expect(failedMock).toHaveBeenCalledWith( - `Key Validation Error: Keys are limited to a maximum of 10.` - ); -}); - -test("restore with large key should fail", async () => { - const path = "node_modules"; - const key = "foo".repeat(512); // Over the 512 character limit - testUtils.setInputs({ - path: path, - key - }); - const failedMock = jest.spyOn(core, "setFailed"); - const restoreCacheMock = jest.spyOn(cache, "restoreCache"); - await run(); - expect(restoreCacheMock).toHaveBeenCalledTimes(1); - expect(restoreCacheMock).toHaveBeenCalledWith([path], key, []); - expect(failedMock).toHaveBeenCalledWith( - `Key Validation Error: ${key} cannot be larger than 512 characters.` - ); -}); - -test("restore with invalid key should fail", async () => { - const path = "node_modules"; - const key = "comma,comma"; - testUtils.setInputs({ - path: path, - key - }); - const failedMock = jest.spyOn(core, "setFailed"); - const restoreCacheMock = jest.spyOn(cache, "restoreCache"); - await run(); - expect(restoreCacheMock).toHaveBeenCalledTimes(1); - expect(restoreCacheMock).toHaveBeenCalledWith([path], key, []); - expect(failedMock).toHaveBeenCalledWith( - `Key Validation Error: ${key} cannot contain commas.` - ); -}); - -test("restore with no cache found", async () => { - const path = "node_modules"; - const key = "node-test"; - testUtils.setInputs({ - path: path, - key - }); - - const infoMock = jest.spyOn(core, "info"); - const failedMock = jest.spyOn(core, "setFailed"); - const stateMock = jest.spyOn(core, "saveState"); - const restoreCacheMock = jest - .spyOn(cache, "restoreCache") - .mockImplementationOnce(() => { - return Promise.resolve(undefined); - }); - - await run(); - - expect(restoreCacheMock).toHaveBeenCalledTimes(1); - expect(restoreCacheMock).toHaveBeenCalledWith([path], key, []); - - expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); - expect(failedMock).toHaveBeenCalledTimes(0); - - expect(infoMock).toHaveBeenCalledWith( - `Cache not found for input keys: ${key}` - ); -}); - -test("restore with server error should fail", async () => { - const path = "node_modules"; - const key = "node-test"; - testUtils.setInputs({ - path: path, - key - }); - - const logWarningMock = jest.spyOn(actionUtils, "logWarning"); - const failedMock = jest.spyOn(core, "setFailed"); - const stateMock = jest.spyOn(core, "saveState"); - const restoreCacheMock = jest - .spyOn(cache, "restoreCache") - .mockImplementationOnce(() => { - throw new Error("HTTP Error Occurred"); - }); - const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput"); - - await run(); - - expect(restoreCacheMock).toHaveBeenCalledTimes(1); - expect(restoreCacheMock).toHaveBeenCalledWith([path], key, []); - - expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); - - expect(logWarningMock).toHaveBeenCalledTimes(1); - expect(logWarningMock).toHaveBeenCalledWith("HTTP Error Occurred"); - - expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); - expect(setCacheHitOutputMock).toHaveBeenCalledWith(false); - - expect(failedMock).toHaveBeenCalledTimes(0); -}); - -test("restore with restore keys and no cache found", async () => { - const path = "node_modules"; - const key = "node-test"; - const restoreKey = "node-"; - testUtils.setInputs({ - path: path, - key, - restoreKeys: [restoreKey] - }); - - const infoMock = jest.spyOn(core, "info"); - const failedMock = jest.spyOn(core, "setFailed"); - const stateMock = jest.spyOn(core, "saveState"); - const restoreCacheMock = jest - .spyOn(cache, "restoreCache") - .mockImplementationOnce(() => { - return Promise.resolve(undefined); - }); - - await run(); - - expect(restoreCacheMock).toHaveBeenCalledTimes(1); - expect(restoreCacheMock).toHaveBeenCalledWith([path], key, [restoreKey]); - - expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); - expect(failedMock).toHaveBeenCalledTimes(0); - - expect(infoMock).toHaveBeenCalledWith( - `Cache not found for input keys: ${key}, ${restoreKey}` - ); -}); - -test("restore with cache found for key", async () => { - const path = "node_modules"; - const key = "node-test"; - testUtils.setInputs({ - path: path, - key - }); - - const infoMock = jest.spyOn(core, "info"); - const failedMock = jest.spyOn(core, "setFailed"); - const stateMock = jest.spyOn(core, "saveState"); - const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput"); - const restoreCacheMock = jest - .spyOn(cache, "restoreCache") - .mockImplementationOnce(() => { - return Promise.resolve(key); - }); - - await run(); - - expect(restoreCacheMock).toHaveBeenCalledTimes(1); - expect(restoreCacheMock).toHaveBeenCalledWith([path], key, []); - - expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); - expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); - expect(setCacheHitOutputMock).toHaveBeenCalledWith(true); - - expect(infoMock).toHaveBeenCalledWith(`Cache restored from key: ${key}`); - expect(failedMock).toHaveBeenCalledTimes(0); -}); - -test("restore with cache found for restore key", async () => { - const path = "node_modules"; - const key = "node-test"; - const restoreKey = "node-"; - testUtils.setInputs({ - path: path, - key, - restoreKeys: [restoreKey] - }); - - const infoMock = jest.spyOn(core, "info"); - const failedMock = jest.spyOn(core, "setFailed"); - const stateMock = jest.spyOn(core, "saveState"); - const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput"); - const restoreCacheMock = jest - .spyOn(cache, "restoreCache") - .mockImplementationOnce(() => { - return Promise.resolve(restoreKey); - }); - - await run(); - - expect(restoreCacheMock).toHaveBeenCalledTimes(1); - expect(restoreCacheMock).toHaveBeenCalledWith([path], key, [restoreKey]); - - expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); - expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1); - expect(setCacheHitOutputMock).toHaveBeenCalledWith(false); - - expect(infoMock).toHaveBeenCalledWith( - `Cache restored from key: ${restoreKey}` - ); - expect(failedMock).toHaveBeenCalledTimes(0); -}); diff --git a/__tests__/save.test.ts b/__tests__/save.test.ts deleted file mode 100644 index 30178a2..0000000 --- a/__tests__/save.test.ts +++ /dev/null @@ -1,340 +0,0 @@ -import * as cache from "@actions/cache"; -import * as core from "@actions/core"; - -import { Events, Inputs, RefKey } from "../src/constants"; -import run from "../src/save"; -import * as actionUtils from "../src/utils/actionUtils"; -import * as testUtils from "../src/utils/testUtils"; - -jest.mock("@actions/core"); -jest.mock("@actions/cache"); -jest.mock("../src/utils/actionUtils"); - -beforeAll(() => { - jest.spyOn(core, "getInput").mockImplementation((name, options) => { - return jest.requireActual("@actions/core").getInput(name, options); - }); - - jest.spyOn(actionUtils, "getCacheState").mockImplementation(() => { - return jest.requireActual("../src/utils/actionUtils").getCacheState(); - }); - - jest.spyOn(actionUtils, "getInputAsArray").mockImplementation( - (name, options) => { - return jest - .requireActual("../src/utils/actionUtils") - .getInputAsArray(name, options); - } - ); - - jest.spyOn(actionUtils, "getInputAsInt").mockImplementation( - (name, options) => { - return jest - .requireActual("../src/utils/actionUtils") - .getInputAsInt(name, options); - } - ); - - jest.spyOn(actionUtils, "isExactKeyMatch").mockImplementation( - (key, cacheResult) => { - return jest - .requireActual("../src/utils/actionUtils") - .isExactKeyMatch(key, cacheResult); - } - ); - - jest.spyOn(actionUtils, "isValidEvent").mockImplementation(() => { - const actualUtils = jest.requireActual("../src/utils/actionUtils"); - return actualUtils.isValidEvent(); - }); -}); - -beforeEach(() => { - process.env[Events.Key] = Events.Push; - process.env[RefKey] = "refs/heads/feature-branch"; - - jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false); -}); - -afterEach(() => { - testUtils.clearInputs(); - delete process.env[Events.Key]; - delete process.env[RefKey]; -}); - -test("save with invalid event outputs warning", async () => { - const logWarningMock = jest.spyOn(actionUtils, "logWarning"); - const failedMock = jest.spyOn(core, "setFailed"); - const invalidEvent = "commit_comment"; - process.env[Events.Key] = invalidEvent; - delete process.env[RefKey]; - await run(); - expect(logWarningMock).toHaveBeenCalledWith( - `Event Validation Error: The event type ${invalidEvent} is not supported because it's not tied to a branch or tag ref.` - ); - expect(failedMock).toHaveBeenCalledTimes(0); -}); - -test("save with no primary key in state outputs warning", async () => { - const logWarningMock = jest.spyOn(actionUtils, "logWarning"); - const failedMock = jest.spyOn(core, "setFailed"); - - const savedCacheKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43"; - jest.spyOn(core, "getState") - // Cache Entry State - .mockImplementationOnce(() => { - return savedCacheKey; - }) - // Cache Key State - .mockImplementationOnce(() => { - return ""; - }); - const saveCacheMock = jest.spyOn(cache, "saveCache"); - - await run(); - - expect(saveCacheMock).toHaveBeenCalledTimes(0); - expect(logWarningMock).toHaveBeenCalledWith( - `Error retrieving key from state.` - ); - expect(logWarningMock).toHaveBeenCalledTimes(1); - expect(failedMock).toHaveBeenCalledTimes(0); -}); - -test("save on GHES should no-op", async () => { - jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true); - - const logWarningMock = jest.spyOn(actionUtils, "logWarning"); - const saveCacheMock = jest.spyOn(cache, "saveCache"); - - await run(); - - expect(saveCacheMock).toHaveBeenCalledTimes(0); - expect(logWarningMock).toHaveBeenCalledWith( - "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details" - ); -}); - -test("save with exact match returns early", async () => { - const infoMock = jest.spyOn(core, "info"); - const failedMock = jest.spyOn(core, "setFailed"); - - const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43"; - const savedCacheKey = primaryKey; - - jest.spyOn(core, "getState") - // Cache Entry State - .mockImplementationOnce(() => { - return savedCacheKey; - }) - // Cache Key State - .mockImplementationOnce(() => { - return primaryKey; - }); - const saveCacheMock = jest.spyOn(cache, "saveCache"); - - await run(); - - expect(saveCacheMock).toHaveBeenCalledTimes(0); - expect(infoMock).toHaveBeenCalledWith( - `Cache hit occurred on the primary key ${primaryKey}, not saving cache.` - ); - expect(failedMock).toHaveBeenCalledTimes(0); -}); - -test("save with missing input outputs warning", async () => { - const logWarningMock = jest.spyOn(actionUtils, "logWarning"); - const failedMock = jest.spyOn(core, "setFailed"); - - const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43"; - const savedCacheKey = "Linux-node-"; - - jest.spyOn(core, "getState") - // Cache Entry State - .mockImplementationOnce(() => { - return savedCacheKey; - }) - // Cache Key State - .mockImplementationOnce(() => { - return primaryKey; - }); - const saveCacheMock = jest.spyOn(cache, "saveCache"); - - await run(); - - expect(saveCacheMock).toHaveBeenCalledTimes(0); - expect(logWarningMock).toHaveBeenCalledWith( - "Input required and not supplied: path" - ); - expect(logWarningMock).toHaveBeenCalledTimes(1); - expect(failedMock).toHaveBeenCalledTimes(0); -}); - -test("save with large cache outputs warning", async () => { - const logWarningMock = jest.spyOn(actionUtils, "logWarning"); - const failedMock = jest.spyOn(core, "setFailed"); - - const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43"; - const savedCacheKey = "Linux-node-"; - - jest.spyOn(core, "getState") - // Cache Entry State - .mockImplementationOnce(() => { - return savedCacheKey; - }) - // Cache Key State - .mockImplementationOnce(() => { - return primaryKey; - }); - - const inputPath = "node_modules"; - testUtils.setInput(Inputs.Path, inputPath); - - const saveCacheMock = jest - .spyOn(cache, "saveCache") - .mockImplementationOnce(() => { - throw new Error( - "Cache size of ~6144 MB (6442450944 B) is over the 5GB limit, not saving cache." - ); - }); - - await run(); - - expect(saveCacheMock).toHaveBeenCalledTimes(1); - expect(saveCacheMock).toHaveBeenCalledWith( - [inputPath], - primaryKey, - expect.anything() - ); - - expect(logWarningMock).toHaveBeenCalledTimes(1); - expect(logWarningMock).toHaveBeenCalledWith( - "Cache size of ~6144 MB (6442450944 B) is over the 5GB limit, not saving cache." - ); - expect(failedMock).toHaveBeenCalledTimes(0); -}); - -test("save with reserve cache failure outputs warning", async () => { - const infoMock = jest.spyOn(core, "info"); - const logWarningMock = jest.spyOn(actionUtils, "logWarning"); - const failedMock = jest.spyOn(core, "setFailed"); - - const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43"; - const savedCacheKey = "Linux-node-"; - - jest.spyOn(core, "getState") - // Cache Entry State - .mockImplementationOnce(() => { - return savedCacheKey; - }) - // Cache Key State - .mockImplementationOnce(() => { - return primaryKey; - }); - - const inputPath = "node_modules"; - testUtils.setInput(Inputs.Path, inputPath); - - const saveCacheMock = jest - .spyOn(cache, "saveCache") - .mockImplementationOnce(() => { - const actualCache = jest.requireActual("@actions/cache"); - const error = new actualCache.ReserveCacheError( - `Unable to reserve cache with key ${primaryKey}, another job may be creating this cache.` - ); - throw error; - }); - - await run(); - - expect(saveCacheMock).toHaveBeenCalledTimes(1); - expect(saveCacheMock).toHaveBeenCalledWith( - [inputPath], - primaryKey, - expect.anything() - ); - - expect(infoMock).toHaveBeenCalledWith( - `Unable to reserve cache with key ${primaryKey}, another job may be creating this cache.` - ); - expect(logWarningMock).toHaveBeenCalledTimes(0); - expect(failedMock).toHaveBeenCalledTimes(0); -}); - -test("save with server error outputs warning", async () => { - const logWarningMock = jest.spyOn(actionUtils, "logWarning"); - const failedMock = jest.spyOn(core, "setFailed"); - - const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43"; - const savedCacheKey = "Linux-node-"; - - jest.spyOn(core, "getState") - // Cache Entry State - .mockImplementationOnce(() => { - return savedCacheKey; - }) - // Cache Key State - .mockImplementationOnce(() => { - return primaryKey; - }); - - const inputPath = "node_modules"; - testUtils.setInput(Inputs.Path, inputPath); - - const saveCacheMock = jest - .spyOn(cache, "saveCache") - .mockImplementationOnce(() => { - throw new Error("HTTP Error Occurred"); - }); - - await run(); - - expect(saveCacheMock).toHaveBeenCalledTimes(1); - expect(saveCacheMock).toHaveBeenCalledWith( - [inputPath], - primaryKey, - expect.anything() - ); - - expect(logWarningMock).toHaveBeenCalledTimes(1); - expect(logWarningMock).toHaveBeenCalledWith("HTTP Error Occurred"); - - expect(failedMock).toHaveBeenCalledTimes(0); -}); - -test("save with valid inputs uploads a cache", async () => { - const failedMock = jest.spyOn(core, "setFailed"); - - const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43"; - const savedCacheKey = "Linux-node-"; - - jest.spyOn(core, "getState") - // Cache Entry State - .mockImplementationOnce(() => { - return savedCacheKey; - }) - // Cache Key State - .mockImplementationOnce(() => { - return primaryKey; - }); - - const inputPath = "node_modules"; - testUtils.setInput(Inputs.Path, inputPath); - testUtils.setInput(Inputs.UploadChunkSize, "4000000"); - - const cacheId = 4; - const saveCacheMock = jest - .spyOn(cache, "saveCache") - .mockImplementationOnce(() => { - return Promise.resolve(cacheId); - }); - - await run(); - - expect(saveCacheMock).toHaveBeenCalledTimes(1); - expect(saveCacheMock).toHaveBeenCalledWith([inputPath], primaryKey, { - uploadChunkSize: 4000000 - }); - - expect(failedMock).toHaveBeenCalledTimes(0); -}); diff --git a/__tests__/verify-cache-files.sh b/__tests__/verify-cache-files.sh deleted file mode 100755 index 3ee8a84..0000000 --- a/__tests__/verify-cache-files.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -# Validate args -prefix="$1" -if [ -z "$prefix" ]; then - echo "Must supply prefix argument" - exit 1 -fi - -path="$2" -if [ -z "$path" ]; then - echo "Must specify path argument" - exit 1 -fi - -# Sanity check GITHUB_RUN_ID defined -if [ -z "$GITHUB_RUN_ID" ]; then - echo "GITHUB_RUN_ID not defined" - exit 1 -fi - -# Verify file exists -file="$path/test-file.txt" -echo "Checking for $file" -if [ ! -e $file ]; then - echo "File does not exist" - exit 1 -fi - -# Verify file content -content="$(cat $file)" -echo "File content:\n$content" -if [ -z "$(echo $content | grep --fixed-strings "$prefix $GITHUB_RUN_ID")" ]; then - echo "Unexpected file content" - exit 1 -fi diff --git a/package-lock.json b/package-lock.json index 7cc6767..4152ddc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,9 @@ "@actions/cache": "^1.0.7", "@actions/core": "^1.2.6", "@actions/exec": "^1.0.1", - "@actions/io": "^1.1.0" + "@actions/io": "^1.1.0", + "aws-sdk": "^2.998.0", + "filesize": "^8.0.3" }, "devDependencies": { "@types/jest": "^24.0.13", @@ -65,9 +67,9 @@ } }, "node_modules/@actions/glob": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.1.tgz", - "integrity": "sha512-ikM4GVZOgSGDNTjv0ECJ8AOqmDqQwtO4K1M4P465C9iikRq34+FwCjUVSwzgOYDP85qtddyWpzBw5lTub/9Xmg==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.2.tgz", + "integrity": "sha512-SclLR7Ia5sEqjkJTPs7Sd86maMDw43p769YxBOxvPvEWuPEhpAnBsQfENOpXjFYMmhCqd127bmf+YdvJqVqR4A==", "dependencies": { "@actions/core": "^1.2.6", "minimatch": "^3.0.4" @@ -98,9 +100,9 @@ } }, "node_modules/@azure/abort-controller/node_modules/tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, "node_modules/@azure/core-asynciterator-polyfill": { "version": "1.0.0", @@ -108,72 +110,51 @@ "integrity": "sha512-kmv8CGrPfN9SwMwrkiBK9VTQYxdFQEGe0BmQk+M8io56P9KNzpAxcWE/1fxJj7uouwN4kXF0BHW8DNlgx+wtCg==" }, "node_modules/@azure/core-auth": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.3.0.tgz", - "integrity": "sha512-kSDSZBL6c0CYdhb+7KuutnKGf2geeT+bCJAgccB0DD7wmNJSsQPcF7TcuoZX83B7VK4tLz/u+8sOO/CnCsYp8A==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.3.2.tgz", + "integrity": "sha512-7CU6DmCHIZp5ZPiZ9r3J17lTKMmYsm/zGvNkjArQwPkrLlZ1TZ+EUYfGgh2X31OLMVAQCTJZW4cXHJi02EbJnA==", "dependencies": { "@azure/abort-controller": "^1.0.0", - "tslib": "^2.0.0" + "tslib": "^2.2.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=12.0.0" } }, "node_modules/@azure/core-auth/node_modules/tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, "node_modules/@azure/core-http": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-1.2.4.tgz", - "integrity": "sha512-cNumz3ckyFZY5zWOgcTHSO7AKRVwxbodG8WfcEGcdH+ZJL3KvJEI/vN58H6xk5v3ijulU2x/WPGJqrMVvcI79A==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.2.0.tgz", + "integrity": "sha512-DCXm8OTNhPxErNvwuNgd9r/W+LjMrHHNc9/q4QgIOpCaoBvpJd1O5Nl2gbAhrwfiwmEBNWHMeGoe5+g3Lx2H/A==", "dependencies": { "@azure/abort-controller": "^1.0.0", "@azure/core-asynciterator-polyfill": "^1.0.0", "@azure/core-auth": "^1.3.0", - "@azure/core-tracing": "1.0.0-preview.11", + "@azure/core-tracing": "1.0.0-preview.13", "@azure/logger": "^1.0.0", "@types/node-fetch": "^2.5.0", - "@types/tunnel": "^0.0.1", - "form-data": "^3.0.0", + "@types/tunnel": "^0.0.3", + "form-data": "^4.0.0", "node-fetch": "^2.6.0", "process": "^0.11.10", "tough-cookie": "^4.0.0", - "tslib": "^2.0.0", + "tslib": "^2.2.0", "tunnel": "^0.0.6", "uuid": "^8.3.0", "xml2js": "^0.4.19" }, "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/@azure/core-http/node_modules/@azure/core-tracing": { - "version": "1.0.0-preview.11", - "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.11.tgz", - "integrity": "sha512-frF0pJc9HTmKncVokhBxCqipjbql02DThQ1ZJ9wLi7SDMLdPAFyDI5xZNzX5guLz+/DtPkY+SGK2li9FIXqshQ==", - "dependencies": { - "@opencensus/web-types": "0.0.7", - "@opentelemetry/api": "1.0.0-rc.0", - "tslib": "^2.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/@azure/core-http/node_modules/@opentelemetry/api": { - "version": "1.0.0-rc.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.0.0-rc.0.tgz", - "integrity": "sha512-iXKByCMfrlO5S6Oh97BuM56tM2cIBB0XsL/vWF/AtJrJEKx4MC/Xdu0xDsGXMGcNWpqF7ujMsjjnp0+UHBwnDQ==", - "engines": { - "node": ">=8.0.0" + "node": ">=12.0.0" } }, "node_modules/@azure/core-http/node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -197,9 +178,9 @@ } }, "node_modules/@azure/core-http/node_modules/tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, "node_modules/@azure/core-http/node_modules/uuid": { "version": "8.3.2", @@ -210,74 +191,57 @@ } }, "node_modules/@azure/core-lro": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-1.0.4.tgz", - "integrity": "sha512-4IVqLl6NIqxVzL+zMdf9Nwa1ZUPuoG/IAMoWQIA6qgpKuAiPy/KiH4Q5j0Zn0q20GFiymQeLcCIH82LSlbQBTQ==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.2.0.tgz", + "integrity": "sha512-TJo95eNT1dwYOPCb0m1C2zyxVlHuRRkKGeg9TKu8XMF2qh4v6c1weD63r9RVIrLdHdnSqS0n6PTXBpWoB8NqMw==", "dependencies": { "@azure/abort-controller": "^1.0.0", - "@azure/core-http": "^1.2.0", - "@azure/core-tracing": "1.0.0-preview.11", - "events": "^3.0.0", - "tslib": "^2.0.0" + "@azure/core-tracing": "1.0.0-preview.13", + "@azure/logger": "^1.0.0", + "tslib": "^2.2.0" }, "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/@azure/core-lro/node_modules/@azure/core-tracing": { - "version": "1.0.0-preview.11", - "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.11.tgz", - "integrity": "sha512-frF0pJc9HTmKncVokhBxCqipjbql02DThQ1ZJ9wLi7SDMLdPAFyDI5xZNzX5guLz+/DtPkY+SGK2li9FIXqshQ==", - "dependencies": { - "@opencensus/web-types": "0.0.7", - "@opentelemetry/api": "1.0.0-rc.0", - "tslib": "^2.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/@azure/core-lro/node_modules/@opentelemetry/api": { - "version": "1.0.0-rc.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.0.0-rc.0.tgz", - "integrity": "sha512-iXKByCMfrlO5S6Oh97BuM56tM2cIBB0XsL/vWF/AtJrJEKx4MC/Xdu0xDsGXMGcNWpqF7ujMsjjnp0+UHBwnDQ==", - "engines": { - "node": ">=8.0.0" + "node": ">=12.0.0" } }, "node_modules/@azure/core-lro/node_modules/tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, "node_modules/@azure/core-paging": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.1.3.tgz", - "integrity": "sha512-his7Ah40ThEYORSpIAwuh6B8wkGwO/zG7gqVtmSE4WAJ46e36zUDXTKReUCLBDc6HmjjApQQxxcRFy5FruG79A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.2.0.tgz", + "integrity": "sha512-ZX1bCjm/MjKPCN6kQD/9GJErYSoKA8YWp6YWoo5EIzcTWlSBLXu3gNaBTUl8usGl+UShiKo7b4Gdy1NSTIlpZg==", "dependencies": { - "@azure/core-asynciterator-polyfill": "^1.0.0" + "@azure/core-asynciterator-polyfill": "^1.0.0", + "tslib": "^2.2.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=12.0.0" } }, + "node_modules/@azure/core-paging/node_modules/tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + }, "node_modules/@azure/core-tracing": { - "version": "1.0.0-preview.10", - "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.10.tgz", - "integrity": "sha512-iIwjtMwQnsxB7cYkugMx+s4W1nfy3+pT/ceo+uW1fv4YDgYe84nh+QP0fEC9IH/3UATLSWbIBemdMHzk2APUrw==", + "version": "1.0.0-preview.13", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.13.tgz", + "integrity": "sha512-KxDlhXyMlh2Jhj2ykX6vNEU0Vou4nHr025KoSEiz7cS3BNiHNaZcdECk/DmLkEB0as5T7b/TpRcehJ5yV6NeXQ==", "dependencies": { - "@opencensus/web-types": "0.0.7", - "@opentelemetry/api": "^0.10.2", - "tslib": "^2.0.0" + "@opentelemetry/api": "^1.0.1", + "tslib": "^2.2.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=12.0.0" } }, "node_modules/@azure/core-tracing/node_modules/tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, "node_modules/@azure/logger": { "version": "1.0.2", @@ -291,14 +255,14 @@ } }, "node_modules/@azure/logger/node_modules/tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, "node_modules/@azure/ms-rest-js": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.3.0.tgz", - "integrity": "sha512-8NOnHgovi61NpcUld53zRkY/IcQJBBO48VeMntNTUtaPo8yYYTnu1hWRvp6b6vpBnur7HGmuj692J9li5Kx6/Q==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.6.0.tgz", + "integrity": "sha512-4C5FCtvEzWudblB+h92/TYYPiq7tuElX8icVYToxOdggnYqeec4Se14mjse5miInKtZahiFHdl8lZA/jziEc5g==", "dependencies": { "@azure/core-auth": "^1.1.4", "abort-controller": "^3.0.0", @@ -307,7 +271,7 @@ "tough-cookie": "^3.0.1", "tslib": "^1.10.0", "tunnel": "0.0.6", - "uuid": "^3.3.2", + "uuid": "^8.3.2", "xml2js": "^0.4.19" } }, @@ -337,29 +301,36 @@ "node": ">=6" } }, + "node_modules/@azure/ms-rest-js/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@azure/storage-blob": { - "version": "12.5.0", - "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.5.0.tgz", - "integrity": "sha512-DgoefgODst2IPkkQsNdhtYdyJgSsAZC1pEujO6aD5y7uFy5GnzhYliobSrp204jYRyK5XeJ9iiePmy/SPtTbLA==", + "version": "12.8.0", + "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.8.0.tgz", + "integrity": "sha512-c8+Wz19xauW0bGkTCoqZH4dYfbtBniPiGiRQOn1ca6G5jsjr4azwaTk9gwjVY8r3vY2Taf95eivLzipfIfiS4A==", "dependencies": { "@azure/abort-controller": "^1.0.0", - "@azure/core-http": "^1.2.0", - "@azure/core-lro": "^1.0.2", + "@azure/core-http": "^2.0.0", + "@azure/core-lro": "^2.2.0", "@azure/core-paging": "^1.1.1", - "@azure/core-tracing": "1.0.0-preview.10", + "@azure/core-tracing": "1.0.0-preview.13", "@azure/logger": "^1.0.0", - "@opentelemetry/api": "^0.10.2", "events": "^3.0.0", - "tslib": "^2.0.0" + "tslib": "^2.2.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=12.0.0" } }, "node_modules/@azure/storage-blob/node_modules/tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, "node_modules/@babel/code-frame": { "version": "7.8.3", @@ -862,29 +833,10 @@ "node": ">= 6" } }, - "node_modules/@opencensus/web-types": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/@opencensus/web-types/-/web-types-0.0.7.tgz", - "integrity": "sha512-xB+w7ZDAu3YBzqH44rCmG9/RlrOmFuDPt/bpf17eJr8eZSrLt7nc7LnWdxM9Mmoj/YKMHpxRg28txu3TcpiL+g==", - "engines": { - "node": ">=6.0" - } - }, "node_modules/@opentelemetry/api": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-0.10.2.tgz", - "integrity": "sha512-GtpMGd6vkzDMYcpu2t9LlhEgMy/SzBwRnz48EejlRArYqZzqSzAsKmegUK7zHgl+EOIaK9mKHhnRaQu3qw20cA==", - "dependencies": { - "@opentelemetry/context-base": "^0.10.2" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/@opentelemetry/context-base": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/@opentelemetry/context-base/-/context-base-0.10.2.tgz", - "integrity": "sha512-hZNKjKOYsckoOEgBziGMnBcX0M7EtstnCmwz5jZUOUYwlZ+/xxX6z3jPu1XVO2Jivk0eLfuP9GP+vFD49CMetw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.0.3.tgz", + "integrity": "sha512-puWxACExDe9nxbBB3lOymQFrLYml2dVOrd7USiVRnSbgXE+KwBu+HxFvxrzfqsiSda9IWsXJG1ef7C1O2/GmKQ==", "engines": { "node": ">=8.0.0" } @@ -1004,9 +956,9 @@ "integrity": "sha512-gWL8VUkg8VRaCAUgG9WmhefMqHmMblxe2rVpMF86nZY/+ZysU+BkAp+3cz03AixWDSSz0ks5WX59yAhv/cDwFA==" }, "node_modules/@types/node-fetch": { - "version": "2.5.10", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.10.tgz", - "integrity": "sha512-IpkX0AasN44hgEad0gEF/V6EgR5n69VEqPEgnmoM8GsIGro3PowbWs4tR6IhxUTyPLpOn+fiGG6nrQhcmoCuIQ==", + "version": "2.5.12", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.12.tgz", + "integrity": "sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==", "dependencies": { "@types/node": "*", "form-data": "^3.0.0" @@ -1032,9 +984,9 @@ "dev": true }, "node_modules/@types/tunnel": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/@types/tunnel/-/tunnel-0.0.1.tgz", - "integrity": "sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A==", + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@types/tunnel/-/tunnel-0.0.3.tgz", + "integrity": "sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==", "dependencies": { "@types/node": "*" } @@ -1711,6 +1663,65 @@ "node": ">= 4.5.0" } }, + "node_modules/aws-sdk": { + "version": "2.998.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.998.0.tgz", + "integrity": "sha512-jenbMcGxOg9AeH6p1m0vbsJYNaeJXBnOM58GXsaKecPgRnCm/IykTPlB6aQKfNDk0WQnw5BHDcy7iQPnEjEkUQ==", + "hasInstallScript": true, + "dependencies": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.15.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "uuid": "3.3.2", + "xml2js": "0.4.19" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/aws-sdk/node_modules/events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/aws-sdk/node_modules/sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" + }, + "node_modules/aws-sdk/node_modules/uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/aws-sdk/node_modules/xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "node_modules/aws-sdk/node_modules/xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", + "engines": { + "node": ">=4.0" + } + }, "node_modules/aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -1924,6 +1935,25 @@ "node": ">=0.10.0" } }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -2027,6 +2057,16 @@ "node-int64": "^0.4.0" } }, + "node_modules/buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "dependencies": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, "node_modules/buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -3311,6 +3351,14 @@ "dev": true, "optional": true }, + "node_modules/filesize": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/filesize/-/filesize-8.0.3.tgz", + "integrity": "sha512-UrhwVdUWmP0Jo9uLhVro8U36D4Yp3uT6pfXeNJHVRwyQrZjsqfnypOLthfnuB/bk1glUu7aIY947kyfoOfXuog==", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -3733,6 +3781,11 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, "node_modules/ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -4328,8 +4381,7 @@ "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "node_modules/isexe": { "version": "2.0.0", @@ -4989,6 +5041,14 @@ "node": ">= 6" } }, + "node_modules/jmespath": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", + "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -5492,13 +5552,35 @@ } }, "node_modules/node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", + "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, "engines": { "node": "4.x || >=6.0.0" } }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -6227,6 +6309,15 @@ "node": ">=0.6" } }, + "node_modules/querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", + "engines": { + "node": ">=0.4.x" + } + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -7949,6 +8040,20 @@ "deprecated": "Please see https://github.com/lydell/urix#deprecated", "dev": true }, + "node_modules/url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", + "dependencies": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "node_modules/url/node_modules/punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" + }, "node_modules/use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", @@ -8374,9 +8479,9 @@ } }, "@actions/glob": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.1.tgz", - "integrity": "sha512-ikM4GVZOgSGDNTjv0ECJ8AOqmDqQwtO4K1M4P465C9iikRq34+FwCjUVSwzgOYDP85qtddyWpzBw5lTub/9Xmg==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.2.tgz", + "integrity": "sha512-SclLR7Ia5sEqjkJTPs7Sd86maMDw43p769YxBOxvPvEWuPEhpAnBsQfENOpXjFYMmhCqd127bmf+YdvJqVqR4A==", "requires": { "@actions/core": "^1.2.6", "minimatch": "^3.0.4" @@ -8404,9 +8509,9 @@ }, "dependencies": { "tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" } } }, @@ -8416,62 +8521,47 @@ "integrity": "sha512-kmv8CGrPfN9SwMwrkiBK9VTQYxdFQEGe0BmQk+M8io56P9KNzpAxcWE/1fxJj7uouwN4kXF0BHW8DNlgx+wtCg==" }, "@azure/core-auth": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.3.0.tgz", - "integrity": "sha512-kSDSZBL6c0CYdhb+7KuutnKGf2geeT+bCJAgccB0DD7wmNJSsQPcF7TcuoZX83B7VK4tLz/u+8sOO/CnCsYp8A==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.3.2.tgz", + "integrity": "sha512-7CU6DmCHIZp5ZPiZ9r3J17lTKMmYsm/zGvNkjArQwPkrLlZ1TZ+EUYfGgh2X31OLMVAQCTJZW4cXHJi02EbJnA==", "requires": { "@azure/abort-controller": "^1.0.0", - "tslib": "^2.0.0" + "tslib": "^2.2.0" }, "dependencies": { "tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" } } }, "@azure/core-http": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-1.2.4.tgz", - "integrity": "sha512-cNumz3ckyFZY5zWOgcTHSO7AKRVwxbodG8WfcEGcdH+ZJL3KvJEI/vN58H6xk5v3ijulU2x/WPGJqrMVvcI79A==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-2.2.0.tgz", + "integrity": "sha512-DCXm8OTNhPxErNvwuNgd9r/W+LjMrHHNc9/q4QgIOpCaoBvpJd1O5Nl2gbAhrwfiwmEBNWHMeGoe5+g3Lx2H/A==", "requires": { "@azure/abort-controller": "^1.0.0", "@azure/core-asynciterator-polyfill": "^1.0.0", "@azure/core-auth": "^1.3.0", - "@azure/core-tracing": "1.0.0-preview.11", + "@azure/core-tracing": "1.0.0-preview.13", "@azure/logger": "^1.0.0", "@types/node-fetch": "^2.5.0", - "@types/tunnel": "^0.0.1", - "form-data": "^3.0.0", + "@types/tunnel": "^0.0.3", + "form-data": "^4.0.0", "node-fetch": "^2.6.0", "process": "^0.11.10", "tough-cookie": "^4.0.0", - "tslib": "^2.0.0", + "tslib": "^2.2.0", "tunnel": "^0.0.6", "uuid": "^8.3.0", "xml2js": "^0.4.19" }, "dependencies": { - "@azure/core-tracing": { - "version": "1.0.0-preview.11", - "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.11.tgz", - "integrity": "sha512-frF0pJc9HTmKncVokhBxCqipjbql02DThQ1ZJ9wLi7SDMLdPAFyDI5xZNzX5guLz+/DtPkY+SGK2li9FIXqshQ==", - "requires": { - "@opencensus/web-types": "0.0.7", - "@opentelemetry/api": "1.0.0-rc.0", - "tslib": "^2.0.0" - } - }, - "@opentelemetry/api": { - "version": "1.0.0-rc.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.0.0-rc.0.tgz", - "integrity": "sha512-iXKByCMfrlO5S6Oh97BuM56tM2cIBB0XsL/vWF/AtJrJEKx4MC/Xdu0xDsGXMGcNWpqF7ujMsjjnp0+UHBwnDQ==" - }, "form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -8489,9 +8579,9 @@ } }, "tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, "uuid": { "version": "8.3.2", @@ -8501,61 +8591,52 @@ } }, "@azure/core-lro": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-1.0.4.tgz", - "integrity": "sha512-4IVqLl6NIqxVzL+zMdf9Nwa1ZUPuoG/IAMoWQIA6qgpKuAiPy/KiH4Q5j0Zn0q20GFiymQeLcCIH82LSlbQBTQ==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.2.0.tgz", + "integrity": "sha512-TJo95eNT1dwYOPCb0m1C2zyxVlHuRRkKGeg9TKu8XMF2qh4v6c1weD63r9RVIrLdHdnSqS0n6PTXBpWoB8NqMw==", "requires": { "@azure/abort-controller": "^1.0.0", - "@azure/core-http": "^1.2.0", - "@azure/core-tracing": "1.0.0-preview.11", - "events": "^3.0.0", - "tslib": "^2.0.0" + "@azure/core-tracing": "1.0.0-preview.13", + "@azure/logger": "^1.0.0", + "tslib": "^2.2.0" }, "dependencies": { - "@azure/core-tracing": { - "version": "1.0.0-preview.11", - "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.11.tgz", - "integrity": "sha512-frF0pJc9HTmKncVokhBxCqipjbql02DThQ1ZJ9wLi7SDMLdPAFyDI5xZNzX5guLz+/DtPkY+SGK2li9FIXqshQ==", - "requires": { - "@opencensus/web-types": "0.0.7", - "@opentelemetry/api": "1.0.0-rc.0", - "tslib": "^2.0.0" - } - }, - "@opentelemetry/api": { - "version": "1.0.0-rc.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.0.0-rc.0.tgz", - "integrity": "sha512-iXKByCMfrlO5S6Oh97BuM56tM2cIBB0XsL/vWF/AtJrJEKx4MC/Xdu0xDsGXMGcNWpqF7ujMsjjnp0+UHBwnDQ==" - }, "tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" } } }, "@azure/core-paging": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.1.3.tgz", - "integrity": "sha512-his7Ah40ThEYORSpIAwuh6B8wkGwO/zG7gqVtmSE4WAJ46e36zUDXTKReUCLBDc6HmjjApQQxxcRFy5FruG79A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.2.0.tgz", + "integrity": "sha512-ZX1bCjm/MjKPCN6kQD/9GJErYSoKA8YWp6YWoo5EIzcTWlSBLXu3gNaBTUl8usGl+UShiKo7b4Gdy1NSTIlpZg==", "requires": { - "@azure/core-asynciterator-polyfill": "^1.0.0" - } - }, - "@azure/core-tracing": { - "version": "1.0.0-preview.10", - "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.10.tgz", - "integrity": "sha512-iIwjtMwQnsxB7cYkugMx+s4W1nfy3+pT/ceo+uW1fv4YDgYe84nh+QP0fEC9IH/3UATLSWbIBemdMHzk2APUrw==", - "requires": { - "@opencensus/web-types": "0.0.7", - "@opentelemetry/api": "^0.10.2", - "tslib": "^2.0.0" + "@azure/core-asynciterator-polyfill": "^1.0.0", + "tslib": "^2.2.0" }, "dependencies": { "tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + } + } + }, + "@azure/core-tracing": { + "version": "1.0.0-preview.13", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.13.tgz", + "integrity": "sha512-KxDlhXyMlh2Jhj2ykX6vNEU0Vou4nHr025KoSEiz7cS3BNiHNaZcdECk/DmLkEB0as5T7b/TpRcehJ5yV6NeXQ==", + "requires": { + "@opentelemetry/api": "^1.0.1", + "tslib": "^2.2.0" + }, + "dependencies": { + "tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" } } }, @@ -8568,16 +8649,16 @@ }, "dependencies": { "tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" } } }, "@azure/ms-rest-js": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.3.0.tgz", - "integrity": "sha512-8NOnHgovi61NpcUld53zRkY/IcQJBBO48VeMntNTUtaPo8yYYTnu1hWRvp6b6vpBnur7HGmuj692J9li5Kx6/Q==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.6.0.tgz", + "integrity": "sha512-4C5FCtvEzWudblB+h92/TYYPiq7tuElX8icVYToxOdggnYqeec4Se14mjse5miInKtZahiFHdl8lZA/jziEc5g==", "requires": { "@azure/core-auth": "^1.1.4", "abort-controller": "^3.0.0", @@ -8586,7 +8667,7 @@ "tough-cookie": "^3.0.1", "tslib": "^1.10.0", "tunnel": "0.0.6", - "uuid": "^3.3.2", + "uuid": "^8.3.2", "xml2js": "^0.4.19" }, "dependencies": { @@ -8609,29 +8690,33 @@ "psl": "^1.1.28", "punycode": "^2.1.1" } + }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" } } }, "@azure/storage-blob": { - "version": "12.5.0", - "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.5.0.tgz", - "integrity": "sha512-DgoefgODst2IPkkQsNdhtYdyJgSsAZC1pEujO6aD5y7uFy5GnzhYliobSrp204jYRyK5XeJ9iiePmy/SPtTbLA==", + "version": "12.8.0", + "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.8.0.tgz", + "integrity": "sha512-c8+Wz19xauW0bGkTCoqZH4dYfbtBniPiGiRQOn1ca6G5jsjr4azwaTk9gwjVY8r3vY2Taf95eivLzipfIfiS4A==", "requires": { "@azure/abort-controller": "^1.0.0", - "@azure/core-http": "^1.2.0", - "@azure/core-lro": "^1.0.2", + "@azure/core-http": "^2.0.0", + "@azure/core-lro": "^2.2.0", "@azure/core-paging": "^1.1.1", - "@azure/core-tracing": "1.0.0-preview.10", + "@azure/core-tracing": "1.0.0-preview.13", "@azure/logger": "^1.0.0", - "@opentelemetry/api": "^0.10.2", "events": "^3.0.0", - "tslib": "^2.0.0" + "tslib": "^2.2.0" }, "dependencies": { "tslib": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz", - "integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" } } }, @@ -9077,23 +9162,10 @@ "@types/yargs": "^13.0.0" } }, - "@opencensus/web-types": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/@opencensus/web-types/-/web-types-0.0.7.tgz", - "integrity": "sha512-xB+w7ZDAu3YBzqH44rCmG9/RlrOmFuDPt/bpf17eJr8eZSrLt7nc7LnWdxM9Mmoj/YKMHpxRg28txu3TcpiL+g==" - }, "@opentelemetry/api": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-0.10.2.tgz", - "integrity": "sha512-GtpMGd6vkzDMYcpu2t9LlhEgMy/SzBwRnz48EejlRArYqZzqSzAsKmegUK7zHgl+EOIaK9mKHhnRaQu3qw20cA==", - "requires": { - "@opentelemetry/context-base": "^0.10.2" - } - }, - "@opentelemetry/context-base": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/@opentelemetry/context-base/-/context-base-0.10.2.tgz", - "integrity": "sha512-hZNKjKOYsckoOEgBziGMnBcX0M7EtstnCmwz5jZUOUYwlZ+/xxX6z3jPu1XVO2Jivk0eLfuP9GP+vFD49CMetw==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.0.3.tgz", + "integrity": "sha512-puWxACExDe9nxbBB3lOymQFrLYml2dVOrd7USiVRnSbgXE+KwBu+HxFvxrzfqsiSda9IWsXJG1ef7C1O2/GmKQ==" }, "@types/babel__core": { "version": "7.1.7", @@ -9209,9 +9281,9 @@ "integrity": "sha512-gWL8VUkg8VRaCAUgG9WmhefMqHmMblxe2rVpMF86nZY/+ZysU+BkAp+3cz03AixWDSSz0ks5WX59yAhv/cDwFA==" }, "@types/node-fetch": { - "version": "2.5.10", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.10.tgz", - "integrity": "sha512-IpkX0AasN44hgEad0gEF/V6EgR5n69VEqPEgnmoM8GsIGro3PowbWs4tR6IhxUTyPLpOn+fiGG6nrQhcmoCuIQ==", + "version": "2.5.12", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.12.tgz", + "integrity": "sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==", "requires": { "@types/node": "*", "form-data": "^3.0.0" @@ -9236,9 +9308,9 @@ "dev": true }, "@types/tunnel": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/@types/tunnel/-/tunnel-0.0.1.tgz", - "integrity": "sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A==", + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@types/tunnel/-/tunnel-0.0.3.tgz", + "integrity": "sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==", "requires": { "@types/node": "*" } @@ -9707,6 +9779,53 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, + "aws-sdk": { + "version": "2.998.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.998.0.tgz", + "integrity": "sha512-jenbMcGxOg9AeH6p1m0vbsJYNaeJXBnOM58GXsaKecPgRnCm/IykTPlB6aQKfNDk0WQnw5BHDcy7iQPnEjEkUQ==", + "requires": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.15.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "uuid": "3.3.2", + "xml2js": "0.4.19" + }, + "dependencies": { + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" + }, + "sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" + } + } + }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -9870,6 +9989,11 @@ } } }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -9968,6 +10092,16 @@ "node-int64": "^0.4.0" } }, + "buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -11012,6 +11146,11 @@ "dev": true, "optional": true }, + "filesize": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/filesize/-/filesize-8.0.3.tgz", + "integrity": "sha512-UrhwVdUWmP0Jo9uLhVro8U36D4Yp3uT6pfXeNJHVRwyQrZjsqfnypOLthfnuB/bk1glUu7aIY947kyfoOfXuog==" + }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -11335,6 +11474,11 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -11771,8 +11915,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", @@ -12308,6 +12451,11 @@ } } }, + "jmespath": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", + "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=" + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -12723,9 +12871,33 @@ } }, "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", + "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", + "requires": { + "whatwg-url": "^5.0.0" + }, + "dependencies": { + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + } + } }, "node-int64": { "version": "0.4.0", @@ -13271,6 +13443,11 @@ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", "dev": true }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" + }, "react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -14619,6 +14796,22 @@ "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", "dev": true }, + "url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" + } + } + }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", diff --git a/package.json b/package.json index 5fe21e8..915f19a 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,9 @@ "@actions/cache": "^1.0.7", "@actions/core": "^1.2.6", "@actions/exec": "^1.0.1", - "@actions/io": "^1.1.0" + "@actions/io": "^1.1.0", + "aws-sdk": "^2.998.0", + "filesize": "^8.0.3" }, "devDependencies": { "@types/jest": "^24.0.13", diff --git a/src/cache.service.ts b/src/cache.service.ts new file mode 100644 index 0000000..ef45c4d --- /dev/null +++ b/src/cache.service.ts @@ -0,0 +1,95 @@ +import * as utils from "@actions/cache/lib/internal/cacheUtils"; +import { createTar, listTar } from "@actions/cache/lib/internal/tar"; +import * as core from "@actions/core"; +import { S3 } from "aws-sdk"; +import filesize from "filesize"; +import fs from "fs"; +import * as path from "path"; + +export class CacheService { + private _client: S3; + private _bucket: string; + + constructor( + accessKeyId: string, + secretAccessKey: string, + region: string, + bucket: string + ) { + this._client = new S3({ + region: region, + credentials: { + accessKeyId: accessKeyId, + secretAccessKey: secretAccessKey + } + }); + this._bucket = bucket; + } + + async restoreCache( + paths: string[], + primaryKey: string, + restoreKeys: string[] + ): Promise { + return ""; + } + + async saveCache(paths: string[], key: string): Promise { + const compressionMethod = await utils.getCompressionMethod(); + + const cachePaths = await utils.resolvePaths(paths); + core.debug("Cache Paths:"); + core.debug(`${JSON.stringify(cachePaths)}`); + + const archiveFolder = await utils.createTempDirectory(); + const archivePath = path.join( + archiveFolder, + utils.getCacheFileName(compressionMethod) + ); + + core.debug(`Archive Path: ${archivePath}`); + + try { + await createTar(archiveFolder, cachePaths, compressionMethod); + if (core.isDebug()) { + await listTar(archivePath, compressionMethod); + } + + core.info( + `Archive Size: ${filesize(fs.statSync(archivePath).size)}` + ); + + core.debug(`Saving Cache (ID: ${key})`); + await this.uploadToS3(key, archivePath); + } finally { + // Try to delete the archive to save space + try { + await utils.unlinkFile(archivePath); + } catch (error) { + core.debug(`Failed to delete archive: ${error}`); + } + } + + return key; + } + + private async uploadToS3(key: string, archivePath: string): Promise { + const client = new S3(); + // Read in the file, convert it to base64, store to S3 + fs.readFile(archivePath, (err, data) => { + if (err) { + throw err; + } + + const base64data = data.toString("base64"); + + client + .putObject({ + Bucket: this._bucket, + Key: key, + Body: base64data + }) + .send(); + }); + } +} diff --git a/src/constants.ts b/src/constants.ts index 133f47d..60da022 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -2,7 +2,11 @@ export enum Inputs { Key = "key", Path = "path", RestoreKeys = "restore-keys", - UploadChunkSize = "upload-chunk-size" + UploadChunkSize = "upload-chunk-size", + Region = "region", + AccessKeyId = "access-key-id", + SecretAccessKey = "secret-access-key", + Bucket = "bucket" } export enum Outputs { diff --git a/src/restore.ts b/src/restore.ts index d411459..e871fff 100644 --- a/src/restore.ts +++ b/src/restore.ts @@ -1,29 +1,11 @@ -import * as cache from "@actions/cache"; import * as core from "@actions/core"; -import { Events, Inputs, State } from "./constants"; +import { CacheService } from "./cache.service"; +import { Inputs, State } from "./constants"; import * as utils from "./utils/actionUtils"; async function run(): Promise { try { - if (utils.isGhes()) { - utils.logWarning( - "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details" - ); - utils.setCacheHitOutput(false); - return; - } - - // Validate inputs, this can cause task failure - if (!utils.isValidEvent()) { - utils.logWarning( - `Event Validation Error: The event type ${ - process.env[Events.Key] - } is not supported because it's not tied to a branch or tag ref.` - ); - return; - } - const primaryKey = core.getInput(Inputs.Key, { required: true }); core.saveState(State.CachePrimaryKey, primaryKey); @@ -33,6 +15,13 @@ async function run(): Promise { }); try { + const cache: CacheService = new CacheService( + core.getInput(Inputs.AccessKeyId), + core.getInput(Inputs.SecretAccessKey), + core.getInput(Inputs.Region), + core.getInput(Inputs.Bucket) + ); + const cacheKey = await cache.restoreCache( cachePaths, primaryKey, @@ -56,12 +45,8 @@ async function run(): Promise { core.info(`Cache restored from key: ${cacheKey}`); } catch (error) { - if (error.name === cache.ValidationError.name) { - throw error; - } else { - utils.logWarning(error.message); - utils.setCacheHitOutput(false); - } + utils.logWarning(error.message); + utils.setCacheHitOutput(false); } } catch (error) { core.setFailed(error.message); diff --git a/src/save.ts b/src/save.ts index fc0eb73..1b3d279 100644 --- a/src/save.ts +++ b/src/save.ts @@ -1,7 +1,8 @@ -import * as cache from "@actions/cache"; +import {} from "@actions/cache"; import * as core from "@actions/core"; -import { Events, Inputs, State } from "./constants"; +import { CacheService } from "./cache.service"; +import { Inputs, State } from "./constants"; import * as utils from "./utils/actionUtils"; // Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in @@ -11,22 +12,6 @@ process.on("uncaughtException", e => utils.logWarning(e.message)); async function run(): Promise { try { - if (utils.isGhes()) { - utils.logWarning( - "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details" - ); - return; - } - - if (!utils.isValidEvent()) { - utils.logWarning( - `Event Validation Error: The event type ${ - process.env[Events.Key] - } is not supported because it's not tied to a branch or tag ref.` - ); - return; - } - const state = utils.getCacheState(); // Inputs are re-evaluted before the post action, so we want the original key used for restore @@ -48,18 +33,16 @@ async function run(): Promise { }); try { - await cache.saveCache(cachePaths, primaryKey, { - uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize) - }); + const cache: CacheService = new CacheService( + core.getInput(Inputs.AccessKeyId), + core.getInput(Inputs.SecretAccessKey), + core.getInput(Inputs.Region), + core.getInput(Inputs.Bucket) + ); + await cache.saveCache(cachePaths, primaryKey); core.info(`Cache saved with key: ${primaryKey}`); } catch (error) { - if (error.name === cache.ValidationError.name) { - throw error; - } else if (error.name === cache.ReserveCacheError.name) { - core.info(error.message); - } else { - utils.logWarning(error.message); - } + utils.logWarning(error.message); } } catch (error) { utils.logWarning(error.message); diff --git a/src/utils/testUtils.ts b/src/utils/testUtils.ts deleted file mode 100644 index 9e2134f..0000000 --- a/src/utils/testUtils.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Inputs } from "../constants"; - -// See: https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L67 -function getInputName(name: string): string { - return `INPUT_${name.replace(/ /g, "_").toUpperCase()}`; -} - -export function setInput(name: string, value: string): void { - process.env[getInputName(name)] = value; -} - -interface CacheInput { - path: string; - key: string; - restoreKeys?: string[]; -} - -export function setInputs(input: CacheInput): void { - setInput(Inputs.Path, input.path); - setInput(Inputs.Key, input.key); - input.restoreKeys && - setInput(Inputs.RestoreKeys, input.restoreKeys.join("\n")); -} - -export function clearInputs(): void { - delete process.env[getInputName(Inputs.Path)]; - delete process.env[getInputName(Inputs.Key)]; - delete process.env[getInputName(Inputs.RestoreKeys)]; - delete process.env[getInputName(Inputs.UploadChunkSize)]; -}