mirror of
https://github.com/moonrepo/setup-rust.git
synced 2025-04-29 21:40:01 +00:00
Add logs.
This commit is contained in:
parent
6a8624d80a
commit
1c70765f66
3 changed files with 21 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@moonrepo/setup-rust",
|
"name": "@moonrepo/setup-rust",
|
||||||
"version": "1.0.3",
|
"version": "1.2.0",
|
||||||
"description": "A GitHub action for setting up Rust and Cargo.",
|
"description": "A GitHub action for setting up Rust and Cargo.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -22,7 +22,10 @@ export function getTargetPaths(): string[] {
|
||||||
const profile = getCacheTarget();
|
const profile = getCacheTarget();
|
||||||
const dirs = core.getInput('target-dirs', { required: true }).split(',');
|
const dirs = core.getInput('target-dirs', { required: true }).split(',');
|
||||||
|
|
||||||
return dirs.filter((dir) => dir.trim()).map((dir) => path.join(WORKSPACE_ROOT, dir, profile));
|
return dirs
|
||||||
|
.map((dir) => dir.trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((dir) => path.join(WORKSPACE_ROOT, dir, profile));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCachePaths(): string[] {
|
export function getCachePaths(): string[] {
|
||||||
|
|
16
src/cargo.ts
16
src/cargo.ts
|
@ -179,6 +179,13 @@ export async function saveCache() {
|
||||||
|
|
||||||
core.info(`Saving cache with key ${primaryKey}`);
|
core.info(`Saving cache with key ${primaryKey}`);
|
||||||
|
|
||||||
|
core.debug(`Cache key: ${primaryKey}`);
|
||||||
|
core.debug('Cache paths:');
|
||||||
|
|
||||||
|
for (const cachePath of cachePaths) {
|
||||||
|
core.debug(`- ${cachePath}`);
|
||||||
|
}
|
||||||
|
|
||||||
await cache.saveCache(cachePaths, primaryKey);
|
await cache.saveCache(cachePaths, primaryKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,6 +197,15 @@ export async function restoreCache() {
|
||||||
core.info('Attempting to restore cache');
|
core.info('Attempting to restore cache');
|
||||||
|
|
||||||
const primaryKey = await getPrimaryCacheKey();
|
const primaryKey = await getPrimaryCacheKey();
|
||||||
|
const cachePaths = getCachePaths();
|
||||||
|
|
||||||
|
core.debug(`Cache key: ${primaryKey}`);
|
||||||
|
core.debug('Cache paths:');
|
||||||
|
|
||||||
|
for (const cachePath of cachePaths) {
|
||||||
|
core.debug(`- ${cachePath}`);
|
||||||
|
}
|
||||||
|
|
||||||
const cacheKey = await cache.restoreCache(getCachePaths(), primaryKey, getCachePrefixes());
|
const cacheKey = await cache.restoreCache(getCachePaths(), primaryKey, getCachePrefixes());
|
||||||
|
|
||||||
if (cacheKey) {
|
if (cacheKey) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue