mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-05-20 16:21:24 +02:00
Compare commits
6 commits
1df91166b3
...
c5f47cc0b9
Author | SHA1 | Date | |
---|---|---|---|
c5f47cc0b9 | |||
0c45773b62 | |||
8a55f839aa | |||
3884cace14 | |||
e29dad3e36 | |||
028d01341f |
|
@ -1,5 +1,9 @@
|
|||
# Releases
|
||||
|
||||
### 4.0.2
|
||||
|
||||
- Fixed restore `fail-on-cache-miss` not working.
|
||||
|
||||
### 4.0.1
|
||||
|
||||
- Updated `isGhes` check
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
15
dist/restore-only/index.js
vendored
15
dist/restore-only/index.js
vendored
|
@ -59392,7 +59392,7 @@ const core = __importStar(__nccwpck_require__(2186));
|
|||
const constants_1 = __nccwpck_require__(9042);
|
||||
const stateProvider_1 = __nccwpck_require__(1527);
|
||||
const utils = __importStar(__nccwpck_require__(6850));
|
||||
function restoreImpl(stateProvider) {
|
||||
function restoreImpl(stateProvider, earlyExit) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
if (!utils.isCacheFeatureAvailable()) {
|
||||
|
@ -59438,21 +59438,16 @@ function restoreImpl(stateProvider) {
|
|||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
if (earlyExit) {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.restoreImpl = restoreImpl;
|
||||
function run(stateProvider, earlyExit) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield restoreImpl(stateProvider);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
if (earlyExit) {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
yield restoreImpl(stateProvider, earlyExit);
|
||||
// node will stay alive if any promises are not resolved,
|
||||
// which is a possibility if HTTP requests are dangling
|
||||
// due to retries or timeouts. We know that if we got here
|
||||
|
|
15
dist/restore/index.js
vendored
15
dist/restore/index.js
vendored
|
@ -59392,7 +59392,7 @@ const core = __importStar(__nccwpck_require__(2186));
|
|||
const constants_1 = __nccwpck_require__(9042);
|
||||
const stateProvider_1 = __nccwpck_require__(1527);
|
||||
const utils = __importStar(__nccwpck_require__(6850));
|
||||
function restoreImpl(stateProvider) {
|
||||
function restoreImpl(stateProvider, earlyExit) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
if (!utils.isCacheFeatureAvailable()) {
|
||||
|
@ -59438,21 +59438,16 @@ function restoreImpl(stateProvider) {
|
|||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
if (earlyExit) {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.restoreImpl = restoreImpl;
|
||||
function run(stateProvider, earlyExit) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield restoreImpl(stateProvider);
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
if (earlyExit) {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
yield restoreImpl(stateProvider, earlyExit);
|
||||
// node will stay alive if any promises are not resolved,
|
||||
// which is a possibility if HTTP requests are dangling
|
||||
// due to retries or timeouts. We know that if we got here
|
||||
|
|
33
examples.md
33
examples.md
|
@ -39,6 +39,7 @@
|
|||
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
|
||||
- [Swift - Swift Package Manager](#swift---swift-package-manager)
|
||||
- [Swift - Mint](#swift---mint)
|
||||
- [* - ASDF](#---asdf)
|
||||
- [* - Bazel](#---bazel)
|
||||
|
||||
## C# - NuGet
|
||||
|
@ -659,6 +660,38 @@ steps:
|
|||
${{ runner.os }}-mint-
|
||||
```
|
||||
|
||||
## * - ASDF
|
||||
|
||||
[ASDF](https://asdf-vm.com), see [#235](https://github.com/asdf-vm/actions/issues/235):
|
||||
|
||||
```yaml
|
||||
- name: Setup ASDF itself
|
||||
uses: asdf-vm/actions/setup@v3
|
||||
|
||||
- name: Cache ASDF
|
||||
uses: actions/cache@v4
|
||||
id: asdf-cache
|
||||
with:
|
||||
# https://github.com/asdf-vm/asdf/blob/master/.gitignore
|
||||
path: |
|
||||
~/.asdf/installs
|
||||
~/.asdf/plugins
|
||||
~/.asdf/shims
|
||||
key: ${{ runner.os }}-asdf-tools-${{ hashFiles('.tool-versions') }}
|
||||
restore-keys: ${{ runner.os }}-asdf-tools-
|
||||
|
||||
- name: Install ASDF plugins
|
||||
uses: asdf-vm/actions/install@v3
|
||||
# See https://github.com/asdf-vm/actions/issues/445
|
||||
if: ${{ steps.asdf-cache.outputs.cache-hit != 'true' }}
|
||||
with:
|
||||
asdf_branch: v0.14.0
|
||||
|
||||
- name: Reshim installed ASDF tools
|
||||
shell: bash
|
||||
run: asdf reshim
|
||||
```
|
||||
|
||||
## * - Bazel
|
||||
|
||||
[`bazelisk`](https://github.com/bazelbuild/bazelisk) does not have be to separately downloaded and installed because it's already included in GitHub's `ubuntu-latest` and `macos-latest` base images.
|
||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "cache",
|
||||
"version": "4.0.1",
|
||||
"version": "4.0.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "cache",
|
||||
"version": "4.0.1",
|
||||
"version": "4.0.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^3.2.3",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue