mirror of
https://github.com/actions/cache.git
synced 2025-04-23 22:40:48 +00:00
build action & add jobs to Tests workflow for only-restore option
* add regular & proxy server jobs * run job between save & restore jobs to test that only-restore option works with consecutive restores
This commit is contained in:
parent
4827442d41
commit
02fa69bea4
3 changed files with 93 additions and 42 deletions
48
.github/workflows/workflow.yml
vendored
48
.github/workflows/workflow.yml
vendored
|
@ -71,6 +71,30 @@ jobs:
|
||||||
path: |
|
path: |
|
||||||
test-cache
|
test-cache
|
||||||
~/test-cache
|
~/test-cache
|
||||||
|
test-only-restore:
|
||||||
|
needs: test-restore
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
fail-fast: false
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Restore cache
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
only-restore: true
|
||||||
|
key: test-${{ runner.os }}-${{ github.run_id }}
|
||||||
|
path: |
|
||||||
|
test-cache
|
||||||
|
~/test-cache
|
||||||
|
- name: Verify cache files in working directory
|
||||||
|
shell: bash
|
||||||
|
run: __tests__/verify-cache-files.sh ${{ runner.os }} test-cache
|
||||||
|
- name: Verify cache files outside working directory
|
||||||
|
shell: bash
|
||||||
|
run: __tests__/verify-cache-files.sh ${{ runner.os }} ~/test-cache
|
||||||
test-restore:
|
test-restore:
|
||||||
needs: test-save
|
needs: test-save
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -118,6 +142,30 @@ jobs:
|
||||||
with:
|
with:
|
||||||
key: test-proxy-${{ github.run_id }}
|
key: test-proxy-${{ github.run_id }}
|
||||||
path: test-cache
|
path: test-cache
|
||||||
|
test-proxy-only-restore:
|
||||||
|
needs: test-proxy-save
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ubuntu:latest
|
||||||
|
options: --dns 127.0.0.1
|
||||||
|
services:
|
||||||
|
squid-proxy:
|
||||||
|
image: datadog/squid:latest
|
||||||
|
ports:
|
||||||
|
- 3128:3128
|
||||||
|
env:
|
||||||
|
https_proxy: http://squid-proxy:3128
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Restore cache
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
only-restore: true
|
||||||
|
key: test-proxy-${{ github.run_id }}
|
||||||
|
path: test-cache
|
||||||
|
- name: Verify cache
|
||||||
|
run: __tests__/verify-cache-files.sh proxy test-cache
|
||||||
test-proxy-restore:
|
test-proxy-restore:
|
||||||
needs: test-proxy-save
|
needs: test-proxy-save
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
4
dist/restore/index.js
vendored
4
dist/restore/index.js
vendored
|
@ -4607,7 +4607,9 @@ exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inpu
|
||||||
var Inputs;
|
var Inputs;
|
||||||
(function (Inputs) {
|
(function (Inputs) {
|
||||||
Inputs["Key"] = "key";
|
Inputs["Key"] = "key";
|
||||||
|
Inputs["OnlyRestore"] = "only-restore";
|
||||||
Inputs["Path"] = "path";
|
Inputs["Path"] = "path";
|
||||||
|
Inputs["Reeval"] = "reeval";
|
||||||
Inputs["RestoreKeys"] = "restore-keys";
|
Inputs["RestoreKeys"] = "restore-keys";
|
||||||
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
||||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||||
|
@ -37317,8 +37319,6 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
|
||||||
...getCompressionProgram(),
|
...getCompressionProgram(),
|
||||||
'-cf',
|
'-cf',
|
||||||
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||||
'--exclude',
|
|
||||||
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
|
||||||
'-P',
|
'-P',
|
||||||
'-C',
|
'-C',
|
||||||
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||||
|
|
7
dist/save/index.js
vendored
7
dist/save/index.js
vendored
|
@ -4607,7 +4607,9 @@ exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inpu
|
||||||
var Inputs;
|
var Inputs;
|
||||||
(function (Inputs) {
|
(function (Inputs) {
|
||||||
Inputs["Key"] = "key";
|
Inputs["Key"] = "key";
|
||||||
|
Inputs["OnlyRestore"] = "only-restore";
|
||||||
Inputs["Path"] = "path";
|
Inputs["Path"] = "path";
|
||||||
|
Inputs["Reeval"] = "reeval";
|
||||||
Inputs["RestoreKeys"] = "restore-keys";
|
Inputs["RestoreKeys"] = "restore-keys";
|
||||||
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
Inputs["UploadChunkSize"] = "upload-chunk-size";
|
||||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||||
|
@ -37317,8 +37319,6 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
|
||||||
...getCompressionProgram(),
|
...getCompressionProgram(),
|
||||||
'-cf',
|
'-cf',
|
||||||
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||||
'--exclude',
|
|
||||||
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
|
||||||
'-P',
|
'-P',
|
||||||
'-C',
|
'-C',
|
||||||
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
||||||
|
@ -46770,6 +46770,8 @@ const utils = __importStar(__webpack_require__(443));
|
||||||
process.on("uncaughtException", e => utils.logWarning(e.message));
|
process.on("uncaughtException", e => utils.logWarning(e.message));
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const save = !core.getBooleanInput(constants_1.Inputs.OnlyRestore);
|
||||||
|
if (save) {
|
||||||
try {
|
try {
|
||||||
if (!utils.isCacheFeatureAvailable()) {
|
if (!utils.isCacheFeatureAvailable()) {
|
||||||
return;
|
return;
|
||||||
|
@ -46814,6 +46816,7 @@ function run() {
|
||||||
catch (error) {
|
catch (error) {
|
||||||
utils.logWarning(error.message);
|
utils.logWarning(error.message);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
run();
|
run();
|
||||||
|
|
Loading…
Add table
Reference in a new issue