mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-11-23 20:19:16 +01:00
initial hacky
This commit is contained in:
parent
71e3ee5cce
commit
402b512df8
5 changed files with 64 additions and 32 deletions
BIN
actions-cache-3.0.1.tgz
Normal file
BIN
actions-cache-3.0.1.tgz
Normal file
Binary file not shown.
34
dist/restore/index.js
vendored
34
dist/restore/index.js
vendored
|
@ -1113,9 +1113,15 @@ function resolvePaths(patterns) {
|
||||||
.replace(new RegExp(`\\${path.sep}`, 'g'), '/');
|
.replace(new RegExp(`\\${path.sep}`, 'g'), '/');
|
||||||
core.debug(`Matched: ${relativeFile}`);
|
core.debug(`Matched: ${relativeFile}`);
|
||||||
// Paths are made relative so the tar entries are all relative to the root of the workspace.
|
// Paths are made relative so the tar entries are all relative to the root of the workspace.
|
||||||
|
if (relativeFile === '') {
|
||||||
|
// path.relative returns empty string if workspace and file are equal
|
||||||
|
paths.push('.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
paths.push(`${relativeFile}`);
|
paths.push(`${relativeFile}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||||
finally {
|
finally {
|
||||||
try {
|
try {
|
||||||
|
@ -5464,6 +5470,7 @@ const buffer = __importStar(__webpack_require__(293));
|
||||||
const fs = __importStar(__webpack_require__(747));
|
const fs = __importStar(__webpack_require__(747));
|
||||||
const stream = __importStar(__webpack_require__(794));
|
const stream = __importStar(__webpack_require__(794));
|
||||||
const util = __importStar(__webpack_require__(669));
|
const util = __importStar(__webpack_require__(669));
|
||||||
|
const timer = __importStar(__webpack_require__(581));
|
||||||
const utils = __importStar(__webpack_require__(15));
|
const utils = __importStar(__webpack_require__(15));
|
||||||
const constants_1 = __webpack_require__(931);
|
const constants_1 = __webpack_require__(931);
|
||||||
const requestUtils_1 = __webpack_require__(899);
|
const requestUtils_1 = __webpack_require__(899);
|
||||||
|
@ -5654,10 +5661,14 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
||||||
const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
|
const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
|
||||||
const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
|
const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
|
||||||
downloadProgress.nextSegment(segmentSize);
|
downloadProgress.nextSegment(segmentSize);
|
||||||
const result = yield client.downloadToBuffer(segmentStart, segmentSize, {
|
const result = yield Promise.race([client.downloadToBuffer(segmentStart, segmentSize, {
|
||||||
concurrency: options.downloadConcurrency,
|
concurrency: options.downloadConcurrency,
|
||||||
onProgress: downloadProgress.onProgress()
|
onProgress: downloadProgress.onProgress()
|
||||||
});
|
}),
|
||||||
|
timer.setTimeout(60 * 60 * 1000, 'timeout')]);
|
||||||
|
if (result === 'timeout') {
|
||||||
|
throw new Error("Segment download timed out");
|
||||||
|
}
|
||||||
fs.writeFileSync(fd, result);
|
fs.writeFileSync(fd, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37272,9 +37283,9 @@ function extractTar(archivePath, compressionMethod) {
|
||||||
function getCompressionProgram() {
|
function getCompressionProgram() {
|
||||||
switch (compressionMethod) {
|
switch (compressionMethod) {
|
||||||
case constants_1.CompressionMethod.Zstd:
|
case constants_1.CompressionMethod.Zstd:
|
||||||
return ['--use-compress-program', 'zstd -d --long=30'];
|
return ['--use-compress-program', 'unzstd --long=30'];
|
||||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||||
return ['--use-compress-program', 'zstd -d'];
|
return ['--use-compress-program', 'unzstd'];
|
||||||
default:
|
default:
|
||||||
return ['-z'];
|
return ['-z'];
|
||||||
}
|
}
|
||||||
|
@ -37305,9 +37316,9 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
|
||||||
function getCompressionProgram() {
|
function getCompressionProgram() {
|
||||||
switch (compressionMethod) {
|
switch (compressionMethod) {
|
||||||
case constants_1.CompressionMethod.Zstd:
|
case constants_1.CompressionMethod.Zstd:
|
||||||
return ['--use-compress-program', 'zstd -T0 --long=30'];
|
return ['--use-compress-program', 'zstdmt --long=30'];
|
||||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||||
return ['--use-compress-program', 'zstd -T0'];
|
return ['--use-compress-program', 'zstdmt'];
|
||||||
default:
|
default:
|
||||||
return ['-z'];
|
return ['-z'];
|
||||||
}
|
}
|
||||||
|
@ -37338,9 +37349,9 @@ function listTar(archivePath, compressionMethod) {
|
||||||
function getCompressionProgram() {
|
function getCompressionProgram() {
|
||||||
switch (compressionMethod) {
|
switch (compressionMethod) {
|
||||||
case constants_1.CompressionMethod.Zstd:
|
case constants_1.CompressionMethod.Zstd:
|
||||||
return ['--use-compress-program', 'zstd -d --long=30'];
|
return ['--use-compress-program', 'unzstd --long=30'];
|
||||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||||
return ['--use-compress-program', 'zstd -d'];
|
return ['--use-compress-program', 'unzstd'];
|
||||||
default:
|
default:
|
||||||
return ['-z'];
|
return ['-z'];
|
||||||
}
|
}
|
||||||
|
@ -42343,7 +42354,12 @@ function clean(key)
|
||||||
/* 578 */,
|
/* 578 */,
|
||||||
/* 579 */,
|
/* 579 */,
|
||||||
/* 580 */,
|
/* 580 */,
|
||||||
/* 581 */,
|
/* 581 */
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("timers/promises");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
/* 582 */
|
/* 582 */
|
||||||
/***/ (function(module) {
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
|
34
dist/save/index.js
vendored
34
dist/save/index.js
vendored
|
@ -1113,9 +1113,15 @@ function resolvePaths(patterns) {
|
||||||
.replace(new RegExp(`\\${path.sep}`, 'g'), '/');
|
.replace(new RegExp(`\\${path.sep}`, 'g'), '/');
|
||||||
core.debug(`Matched: ${relativeFile}`);
|
core.debug(`Matched: ${relativeFile}`);
|
||||||
// Paths are made relative so the tar entries are all relative to the root of the workspace.
|
// Paths are made relative so the tar entries are all relative to the root of the workspace.
|
||||||
|
if (relativeFile === '') {
|
||||||
|
// path.relative returns empty string if workspace and file are equal
|
||||||
|
paths.push('.');
|
||||||
|
}
|
||||||
|
else {
|
||||||
paths.push(`${relativeFile}`);
|
paths.push(`${relativeFile}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||||
finally {
|
finally {
|
||||||
try {
|
try {
|
||||||
|
@ -5464,6 +5470,7 @@ const buffer = __importStar(__webpack_require__(293));
|
||||||
const fs = __importStar(__webpack_require__(747));
|
const fs = __importStar(__webpack_require__(747));
|
||||||
const stream = __importStar(__webpack_require__(794));
|
const stream = __importStar(__webpack_require__(794));
|
||||||
const util = __importStar(__webpack_require__(669));
|
const util = __importStar(__webpack_require__(669));
|
||||||
|
const timer = __importStar(__webpack_require__(581));
|
||||||
const utils = __importStar(__webpack_require__(15));
|
const utils = __importStar(__webpack_require__(15));
|
||||||
const constants_1 = __webpack_require__(931);
|
const constants_1 = __webpack_require__(931);
|
||||||
const requestUtils_1 = __webpack_require__(899);
|
const requestUtils_1 = __webpack_require__(899);
|
||||||
|
@ -5654,10 +5661,14 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
||||||
const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
|
const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
|
||||||
const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
|
const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
|
||||||
downloadProgress.nextSegment(segmentSize);
|
downloadProgress.nextSegment(segmentSize);
|
||||||
const result = yield client.downloadToBuffer(segmentStart, segmentSize, {
|
const result = yield Promise.race([client.downloadToBuffer(segmentStart, segmentSize, {
|
||||||
concurrency: options.downloadConcurrency,
|
concurrency: options.downloadConcurrency,
|
||||||
onProgress: downloadProgress.onProgress()
|
onProgress: downloadProgress.onProgress()
|
||||||
});
|
}),
|
||||||
|
timer.setTimeout(60 * 60 * 1000, 'timeout')]);
|
||||||
|
if (result === 'timeout') {
|
||||||
|
throw new Error("Segment download timed out");
|
||||||
|
}
|
||||||
fs.writeFileSync(fd, result);
|
fs.writeFileSync(fd, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37272,9 +37283,9 @@ function extractTar(archivePath, compressionMethod) {
|
||||||
function getCompressionProgram() {
|
function getCompressionProgram() {
|
||||||
switch (compressionMethod) {
|
switch (compressionMethod) {
|
||||||
case constants_1.CompressionMethod.Zstd:
|
case constants_1.CompressionMethod.Zstd:
|
||||||
return ['--use-compress-program', 'zstd -d --long=30'];
|
return ['--use-compress-program', 'unzstd --long=30'];
|
||||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||||
return ['--use-compress-program', 'zstd -d'];
|
return ['--use-compress-program', 'unzstd'];
|
||||||
default:
|
default:
|
||||||
return ['-z'];
|
return ['-z'];
|
||||||
}
|
}
|
||||||
|
@ -37305,9 +37316,9 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
|
||||||
function getCompressionProgram() {
|
function getCompressionProgram() {
|
||||||
switch (compressionMethod) {
|
switch (compressionMethod) {
|
||||||
case constants_1.CompressionMethod.Zstd:
|
case constants_1.CompressionMethod.Zstd:
|
||||||
return ['--use-compress-program', 'zstd -T0 --long=30'];
|
return ['--use-compress-program', 'zstdmt --long=30'];
|
||||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||||
return ['--use-compress-program', 'zstd -T0'];
|
return ['--use-compress-program', 'zstdmt'];
|
||||||
default:
|
default:
|
||||||
return ['-z'];
|
return ['-z'];
|
||||||
}
|
}
|
||||||
|
@ -37338,9 +37349,9 @@ function listTar(archivePath, compressionMethod) {
|
||||||
function getCompressionProgram() {
|
function getCompressionProgram() {
|
||||||
switch (compressionMethod) {
|
switch (compressionMethod) {
|
||||||
case constants_1.CompressionMethod.Zstd:
|
case constants_1.CompressionMethod.Zstd:
|
||||||
return ['--use-compress-program', 'zstd -d --long=30'];
|
return ['--use-compress-program', 'unzstd --long=30'];
|
||||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||||
return ['--use-compress-program', 'zstd -d'];
|
return ['--use-compress-program', 'unzstd'];
|
||||||
default:
|
default:
|
||||||
return ['-z'];
|
return ['-z'];
|
||||||
}
|
}
|
||||||
|
@ -42343,7 +42354,12 @@ function clean(key)
|
||||||
/* 578 */,
|
/* 578 */,
|
||||||
/* 579 */,
|
/* 579 */,
|
||||||
/* 580 */,
|
/* 580 */,
|
||||||
/* 581 */,
|
/* 581 */
|
||||||
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
module.exports = require("timers/promises");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
/* 582 */
|
/* 582 */
|
||||||
/***/ (function(module) {
|
/***/ (function(module) {
|
||||||
|
|
||||||
|
|
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -9,7 +9,7 @@
|
||||||
"version": "3.0.5",
|
"version": "3.0.5",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.0.0",
|
"@actions/cache": "file:actions-cache-3.0.1.tgz",
|
||||||
"@actions/core": "^1.7.0",
|
"@actions/core": "^1.7.0",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.2"
|
"@actions/io": "^1.1.2"
|
||||||
|
@ -36,9 +36,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache": {
|
"node_modules/@actions/cache": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.0.0.tgz",
|
"resolved": "file:actions-cache-3.0.1.tgz",
|
||||||
"integrity": "sha512-GL9CT1Fnu+pqs8TTB621q8Xa8Cilw2n9MwvbgMedetH7L1q2n6jY61gzbwGbKgtVbp3gVJ12aNMi4osSGXx3KQ==",
|
"integrity": "sha512-ucvw0xvFpe0/vfNQ/rc11ste0nidCdBAJ5j5F01BxBqjxmGH2doVzfPlqSIGhcN7wKI074x2ATb9+7HSrTqGHg==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
|
@ -9533,9 +9534,8 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": {
|
"@actions/cache": {
|
||||||
"version": "3.0.0",
|
"version": "file:actions-cache-3.0.1.tgz",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.0.0.tgz",
|
"integrity": "sha512-ucvw0xvFpe0/vfNQ/rc11ste0nidCdBAJ5j5F01BxBqjxmGH2doVzfPlqSIGhcN7wKI074x2ATb9+7HSrTqGHg==",
|
||||||
"integrity": "sha512-GL9CT1Fnu+pqs8TTB621q8Xa8Cilw2n9MwvbgMedetH7L1q2n6jY61gzbwGbKgtVbp3gVJ12aNMi4osSGXx3KQ==",
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.0.0",
|
"@actions/cache": "file:actions-cache-3.0.1.tgz",
|
||||||
"@actions/core": "^1.7.0",
|
"@actions/core": "^1.7.0",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.2"
|
"@actions/io": "^1.1.2"
|
||||||
|
|
Loading…
Reference in a new issue