mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-02 04:57:46 +02:00
Merge f9a5292a1e
into 6849a64899
This commit is contained in:
commit
107b418561
9 changed files with 93 additions and 21 deletions
23
.github/workflows/workflow.yml
vendored
23
.github/workflows/workflow.yml
vendored
|
@ -35,6 +35,29 @@ jobs:
|
||||||
run: npm run test
|
run: npm run test
|
||||||
|
|
||||||
# End to end save and restore
|
# End to end save and restore
|
||||||
|
test-dont-save:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
fail-fast: false
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Generate files in working directory
|
||||||
|
shell: bash
|
||||||
|
run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache
|
||||||
|
- name: Generate files outside working directory
|
||||||
|
shell: bash
|
||||||
|
run: __tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache
|
||||||
|
- name: Save cache
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
key: test-${{ runner.os }}-${{ github.run_id }}
|
||||||
|
path: |
|
||||||
|
test-cache
|
||||||
|
~/test-cache
|
||||||
|
save: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
test-save:
|
test-save:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
|
|
@ -26,6 +26,10 @@ inputs:
|
||||||
description: 'Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache'
|
description: 'Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache'
|
||||||
default: 'false'
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
|
save:
|
||||||
|
description: 'Do not run the post step to save the cache if false'
|
||||||
|
default: 'true'
|
||||||
|
required: false
|
||||||
save-always:
|
save-always:
|
||||||
description: 'Run the post step to save the cache even if another step before fails'
|
description: 'Run the post step to save the cache even if another step before fails'
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
|
3
dist/restore-only/index.js
vendored
3
dist/restore-only/index.js
vendored
|
@ -59324,7 +59324,8 @@ var Inputs;
|
||||||
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
||||||
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
||||||
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
|
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
|
||||||
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
|
Inputs["LookupOnly"] = "lookup-only";
|
||||||
|
Inputs["Save"] = "save"; // Input for save action
|
||||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||||
var Outputs;
|
var Outputs;
|
||||||
(function (Outputs) {
|
(function (Outputs) {
|
||||||
|
|
3
dist/restore/index.js
vendored
3
dist/restore/index.js
vendored
|
@ -59324,7 +59324,8 @@ var Inputs;
|
||||||
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
||||||
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
||||||
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
|
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
|
||||||
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
|
Inputs["LookupOnly"] = "lookup-only";
|
||||||
|
Inputs["Save"] = "save"; // Input for save action
|
||||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||||
var Outputs;
|
var Outputs;
|
||||||
(function (Outputs) {
|
(function (Outputs) {
|
||||||
|
|
3
dist/save-only/index.js
vendored
3
dist/save-only/index.js
vendored
|
@ -59324,7 +59324,8 @@ var Inputs;
|
||||||
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
||||||
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
||||||
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
|
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
|
||||||
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
|
Inputs["LookupOnly"] = "lookup-only";
|
||||||
|
Inputs["Save"] = "save"; // Input for save action
|
||||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||||
var Outputs;
|
var Outputs;
|
||||||
(function (Outputs) {
|
(function (Outputs) {
|
||||||
|
|
63
dist/save/index.js
vendored
63
dist/save/index.js
vendored
|
@ -59324,7 +59324,8 @@ var Inputs;
|
||||||
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
||||||
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
Inputs["EnableCrossOsArchive"] = "enableCrossOsArchive";
|
||||||
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
|
Inputs["FailOnCacheMiss"] = "fail-on-cache-miss";
|
||||||
Inputs["LookupOnly"] = "lookup-only"; // Input for cache, restore action
|
Inputs["LookupOnly"] = "lookup-only";
|
||||||
|
Inputs["Save"] = "save"; // Input for save action
|
||||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||||
var Outputs;
|
var Outputs;
|
||||||
(function (Outputs) {
|
(function (Outputs) {
|
||||||
|
@ -59346,6 +59347,46 @@ var Events;
|
||||||
exports.RefKey = "GITHUB_REF";
|
exports.RefKey = "GITHUB_REF";
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 5131:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
|
const saveImpl_1 = __nccwpck_require__(6589);
|
||||||
|
const doSave = core.getInput(constants_1.Inputs.Save);
|
||||||
|
if (doSave) {
|
||||||
|
(0, saveImpl_1.saveRun)(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 6589:
|
/***/ 6589:
|
||||||
|
@ -59876,18 +59917,12 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"]
|
||||||
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
||||||
/******/
|
/******/
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
var __webpack_exports__ = {};
|
/******/
|
||||||
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
/******/ // startup
|
||||||
(() => {
|
/******/ // Load entry module and return exports
|
||||||
"use strict";
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
||||||
var exports = __webpack_exports__;
|
/******/ var __webpack_exports__ = __nccwpck_require__(5131);
|
||||||
|
/******/ module.exports = __webpack_exports__;
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
/******/
|
||||||
const saveImpl_1 = __nccwpck_require__(6589);
|
|
||||||
(0, saveImpl_1.saveRun)(true);
|
|
||||||
|
|
||||||
})();
|
|
||||||
|
|
||||||
module.exports = __webpack_exports__;
|
|
||||||
/******/ })()
|
/******/ })()
|
||||||
;
|
;
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "cache",
|
"name": "cache",
|
||||||
"version": "4.1.1",
|
"version": "4.1.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "cache",
|
"name": "cache",
|
||||||
"version": "4.1.1",
|
"version": "4.1.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.2.3",
|
"@actions/cache": "^3.2.3",
|
||||||
|
|
|
@ -5,7 +5,8 @@ export enum Inputs {
|
||||||
UploadChunkSize = "upload-chunk-size", // Input for cache, save action
|
UploadChunkSize = "upload-chunk-size", // Input for cache, save action
|
||||||
EnableCrossOsArchive = "enableCrossOsArchive", // Input for cache, restore, save action
|
EnableCrossOsArchive = "enableCrossOsArchive", // Input for cache, restore, save action
|
||||||
FailOnCacheMiss = "fail-on-cache-miss", // Input for cache, restore action
|
FailOnCacheMiss = "fail-on-cache-miss", // Input for cache, restore action
|
||||||
LookupOnly = "lookup-only" // Input for cache, restore action
|
LookupOnly = "lookup-only", // Input for cache, restore action
|
||||||
|
Save = "save" // Input for save action
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Outputs {
|
export enum Outputs {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
import * as core from "@actions/core";
|
||||||
|
|
||||||
|
import { Inputs } from "./constants";
|
||||||
import { saveRun } from "./saveImpl";
|
import { saveRun } from "./saveImpl";
|
||||||
|
|
||||||
saveRun(true);
|
const doSave = core.getInput(Inputs.Save);
|
||||||
|
if (doSave) {
|
||||||
|
saveRun(true);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue