mirror of
https://github.com/Swatinem/rust-cache
synced 2025-04-13 23:58:43 +00:00
rebuild
This commit is contained in:
parent
271ff4b692
commit
d45cd2b045
45
dist/restore/index.js
vendored
45
dist/restore/index.js
vendored
|
@ -54634,14 +54634,32 @@ async function getCaches() {
|
||||||
if (targetKey) {
|
if (targetKey) {
|
||||||
targetKey = `${targetKey}-`;
|
targetKey = `${targetKey}-`;
|
||||||
}
|
}
|
||||||
|
const registryIndex = `v0-registry-index`;
|
||||||
|
const registryCache = `v0-registry-cache`;
|
||||||
|
const target = `v0-target-${targetKey}${rustKey}`;
|
||||||
return {
|
return {
|
||||||
index: { path: paths.index, key: "registry-index-XXX", restoreKeys: ["registry-index"] },
|
index: {
|
||||||
cache: { path: paths.cache, key: `registry-cache-${lockHash}`, restoreKeys: ["registry-cache"] },
|
name: "Registry Index",
|
||||||
git: { path: paths.git, key: "git-db" },
|
path: paths.index,
|
||||||
|
key: `${registryIndex}-`,
|
||||||
|
restoreKeys: [registryIndex],
|
||||||
|
},
|
||||||
|
cache: {
|
||||||
|
name: "Registry Cache",
|
||||||
|
path: paths.cache,
|
||||||
|
key: `${registryCache}-${lockHash}`,
|
||||||
|
restoreKeys: [registryCache],
|
||||||
|
},
|
||||||
|
// git: {
|
||||||
|
// name: "Git Dependencies",
|
||||||
|
// path: paths.git,
|
||||||
|
// key: "git-db",
|
||||||
|
// },
|
||||||
target: {
|
target: {
|
||||||
|
name: "Target",
|
||||||
path: paths.target,
|
path: paths.target,
|
||||||
key: `target-${targetKey}${rustKey}-${lockHash}`,
|
key: `${target}-${lockHash}`,
|
||||||
restoreKeys: [`target-${targetKey}${rustKey}`],
|
restoreKeys: [target],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -54714,13 +54732,16 @@ async function run() {
|
||||||
try {
|
try {
|
||||||
core.exportVariable("CARGO_INCREMENTAL", 0);
|
core.exportVariable("CARGO_INCREMENTAL", 0);
|
||||||
const caches = await getCaches();
|
const caches = await getCaches();
|
||||||
for (const [name, { path, key, restoreKeys }] of Object.entries(caches)) {
|
for (const [type, { name, path, key, restoreKeys }] of Object.entries(caches)) {
|
||||||
|
const start = Date.now();
|
||||||
|
core.startGroup(`Restoring ${name}"…`);
|
||||||
|
core.info(`Restoring to path "${path}".`);
|
||||||
|
core.info(`Using keys:\n ${[key, ...restoreKeys].join("\n ")}`);
|
||||||
try {
|
try {
|
||||||
core.startGroup(`Restoring "${path}" from "${key}"…`);
|
|
||||||
const restoreKey = await cache.restoreCache([path], key, restoreKeys);
|
const restoreKey = await cache.restoreCache([path], key, restoreKeys);
|
||||||
if (restoreKey) {
|
if (restoreKey) {
|
||||||
core.info(`Restored "${path}" from cache key "${restoreKey}".`);
|
core.info(`Restored from cache key "${restoreKey}".`);
|
||||||
core.saveState(name, restoreKey);
|
core.saveState(type, restoreKey);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.info("No cache found.");
|
core.info("No cache found.");
|
||||||
|
@ -54729,9 +54750,11 @@ async function run() {
|
||||||
catch (e) {
|
catch (e) {
|
||||||
core.info(`[warning] ${e.message}`);
|
core.info(`[warning] ${e.message}`);
|
||||||
}
|
}
|
||||||
finally {
|
const duration = Math.round((Date.now() - start) / 1000);
|
||||||
core.endGroup();
|
if (duration) {
|
||||||
|
core.info(`Took ${duration}s.`);
|
||||||
}
|
}
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
|
80
dist/save/index.js
vendored
80
dist/save/index.js
vendored
|
@ -54581,25 +54581,25 @@ var exec = __webpack_require__(1514);
|
||||||
// EXTERNAL MODULE: ./node_modules/@actions/glob/lib/glob.js
|
// EXTERNAL MODULE: ./node_modules/@actions/glob/lib/glob.js
|
||||||
var glob = __webpack_require__(8090);
|
var glob = __webpack_require__(8090);
|
||||||
|
|
||||||
// EXTERNAL MODULE: ./node_modules/@actions/io/lib/io.js
|
|
||||||
var io = __webpack_require__(7436);
|
|
||||||
|
|
||||||
// EXTERNAL MODULE: external "crypto"
|
// EXTERNAL MODULE: external "crypto"
|
||||||
var external_crypto_ = __webpack_require__(6417);
|
var external_crypto_ = __webpack_require__(6417);
|
||||||
var external_crypto_default = /*#__PURE__*/__webpack_require__.n(external_crypto_);
|
var external_crypto_default = /*#__PURE__*/__webpack_require__.n(external_crypto_);
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: ./node_modules/@actions/io/lib/io.js
|
||||||
|
var io = __webpack_require__(7436);
|
||||||
|
|
||||||
// EXTERNAL MODULE: external "fs"
|
// EXTERNAL MODULE: external "fs"
|
||||||
var external_fs_ = __webpack_require__(5747);
|
var external_fs_ = __webpack_require__(5747);
|
||||||
var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_);
|
var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_);
|
||||||
|
|
||||||
// EXTERNAL MODULE: external "path"
|
|
||||||
var external_path_ = __webpack_require__(5622);
|
|
||||||
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);
|
|
||||||
|
|
||||||
// EXTERNAL MODULE: external "os"
|
// EXTERNAL MODULE: external "os"
|
||||||
var external_os_ = __webpack_require__(2087);
|
var external_os_ = __webpack_require__(2087);
|
||||||
var external_os_default = /*#__PURE__*/__webpack_require__.n(external_os_);
|
var external_os_default = /*#__PURE__*/__webpack_require__.n(external_os_);
|
||||||
|
|
||||||
|
// EXTERNAL MODULE: external "path"
|
||||||
|
var external_path_ = __webpack_require__(5622);
|
||||||
|
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_);
|
||||||
|
|
||||||
// CONCATENATED MODULE: ./src/common.ts
|
// CONCATENATED MODULE: ./src/common.ts
|
||||||
var __asyncValues = (undefined && undefined.__asyncValues) || function (o) {
|
var __asyncValues = (undefined && undefined.__asyncValues) || function (o) {
|
||||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||||
|
@ -54637,14 +54637,32 @@ async function getCaches() {
|
||||||
if (targetKey) {
|
if (targetKey) {
|
||||||
targetKey = `${targetKey}-`;
|
targetKey = `${targetKey}-`;
|
||||||
}
|
}
|
||||||
|
const registryIndex = `v0-registry-index`;
|
||||||
|
const registryCache = `v0-registry-cache`;
|
||||||
|
const target = `v0-target-${targetKey}${rustKey}`;
|
||||||
return {
|
return {
|
||||||
index: { path: paths.index, key: "registry-index-XXX", restoreKeys: ["registry-index"] },
|
index: {
|
||||||
cache: { path: paths.cache, key: `registry-cache-${lockHash}`, restoreKeys: ["registry-cache"] },
|
name: "Registry Index",
|
||||||
git: { path: paths.git, key: "git-db" },
|
path: paths.index,
|
||||||
|
key: `${registryIndex}-`,
|
||||||
|
restoreKeys: [registryIndex],
|
||||||
|
},
|
||||||
|
cache: {
|
||||||
|
name: "Registry Cache",
|
||||||
|
path: paths.cache,
|
||||||
|
key: `${registryCache}-${lockHash}`,
|
||||||
|
restoreKeys: [registryCache],
|
||||||
|
},
|
||||||
|
// git: {
|
||||||
|
// name: "Git Dependencies",
|
||||||
|
// path: paths.git,
|
||||||
|
// key: "git-db",
|
||||||
|
// },
|
||||||
target: {
|
target: {
|
||||||
|
name: "Target",
|
||||||
path: paths.target,
|
path: paths.target,
|
||||||
key: `target-${targetKey}${rustKey}-${lockHash}`,
|
key: `${target}-${lockHash}`,
|
||||||
restoreKeys: [`target-${targetKey}${rustKey}`],
|
restoreKeys: [target],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -54720,19 +54738,22 @@ var save_asyncValues = (undefined && undefined.__asyncValues) || function (o) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
if (!isValidEvent()) {
|
if (!isValidEvent()) {
|
||||||
//return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const caches = await getCaches();
|
const caches = await getCaches();
|
||||||
const registryName = await getRegistryName();
|
const registryName = await getRegistryName();
|
||||||
const packages = await getPackages();
|
const packages = await getPackages();
|
||||||
|
// TODO: remove this once https://github.com/actions/toolkit/pull/553 lands
|
||||||
|
await macOsWorkaround();
|
||||||
await pruneTarget(packages);
|
await pruneTarget(packages);
|
||||||
if (registryName) {
|
if (registryName) {
|
||||||
// save the index based on its revision
|
// save the index based on its revision
|
||||||
const indexRef = await getIndexRef(registryName);
|
const indexRef = await getIndexRef(registryName);
|
||||||
caches.index.key = `registry-index-${indexRef}`;
|
caches.index.key += indexRef;
|
||||||
await io.rmRF(external_path_default().join(paths.index, registryName, ".cache"));
|
await io.rmRF(external_path_default().join(paths.index, registryName, ".cache"));
|
||||||
await pruneRegistryCache(registryName, packages);
|
await pruneRegistryCache(registryName, packages);
|
||||||
}
|
}
|
||||||
|
@ -54740,23 +54761,26 @@ async function run() {
|
||||||
delete caches.index;
|
delete caches.index;
|
||||||
delete caches.cache;
|
delete caches.cache;
|
||||||
}
|
}
|
||||||
for (const [name, { path, key }] of Object.entries(caches)) {
|
for (const [type, { name, path, key }] of Object.entries(caches)) {
|
||||||
if (core.getState(name) === key) {
|
if (core.getState(type) === key) {
|
||||||
core.info(`Cache for "${path}" up-to-date.`);
|
core.info(`${name} up-to-date.`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
const start = Date.now();
|
||||||
|
core.startGroup(`Saving ${name}…`);
|
||||||
|
core.info(`Saving path "${path}".`);
|
||||||
|
core.info(`Using key "${key}".`);
|
||||||
try {
|
try {
|
||||||
core.startGroup(`Saving "${path}" to cache key "${key}"…`);
|
await cache.saveCache([path], key);
|
||||||
if (await cache.saveCache([path], key)) {
|
|
||||||
core.info(`Saved "${path}" to cache key "${key}".`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
core.info(`[warning] ${e.message}`);
|
core.info(`[warning] ${e.message}`);
|
||||||
}
|
}
|
||||||
finally {
|
const duration = Math.round((Date.now() - start) / 1000);
|
||||||
core.endGroup();
|
if (duration) {
|
||||||
|
core.info(`Took ${duration}s.`);
|
||||||
}
|
}
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
@ -54769,7 +54793,7 @@ async function getIndexRef(registryName) {
|
||||||
return (await getCmdOutput("git", ["rev-parse", "--short", "origin/master"], { cwd })).trim();
|
return (await getCmdOutput("git", ["rev-parse", "--short", "origin/master"], { cwd })).trim();
|
||||||
}
|
}
|
||||||
async function getPackages() {
|
async function getPackages() {
|
||||||
const meta = JSON.parse(await getCmdOutput("cargo", ["metadata", "--format-version", "1"]));
|
const meta = JSON.parse(await getCmdOutput("cargo", ["metadata", "--all-features", "--format-version", "1"]));
|
||||||
return meta.packages.map(({ name, version }) => ({ name, version }));
|
return meta.packages.map(({ name, version }) => ({ name, version }));
|
||||||
}
|
}
|
||||||
async function pruneRegistryCache(registryName, packages) {
|
async function pruneRegistryCache(registryName, packages) {
|
||||||
|
@ -54860,6 +54884,14 @@ async function rmExcept(dirName, keepPrefix) {
|
||||||
finally { if (e_3) throw e_3.error; }
|
finally { if (e_3) throw e_3.error; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
async function macOsWorkaround() {
|
||||||
|
try {
|
||||||
|
// Workaround for https://github.com/actions/cache/issues/403
|
||||||
|
// Also see https://github.com/rust-lang/cargo/issues/8603
|
||||||
|
await exec.exec("sudo", ["/usr/sbin/purge"]);
|
||||||
|
}
|
||||||
|
catch (_a) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
Loading…
Reference in a new issue