feat: Add logging to `Cargo.lock`/`Cargo.toml` hashing (#156)

There are a few problems in cargo-binstall where sometimes change to
`Cargo.lock` does not invalidate the cache.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2023-08-04 20:39:02 +10:00 committed by GitHub
parent b8a6852b4f
commit b919e1427f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 12 deletions

View File

@ -67029,8 +67029,8 @@ class CacheConfig {
hasher.update(JSON.stringify(parsed));
parsedKeyFiles.push(cargo_manifest);
}
catch (_e) {
// Fallback to caching them as regular file
catch (e) { // Fallback to caching them as regular file
lib_core.warning(`Error parsing Cargo.toml manifest, fallback to caching entire file: ${e}`);
keyFiles.push(cargo_manifest);
}
}
@ -67042,6 +67042,7 @@ class CacheConfig {
if (parsed.version !== 3 || !("package" in parsed)) {
// Fallback to caching them as regular file since this action
// can only handle Cargo.lock format version 3
lib_core.warning('Unsupported Cargo.lock format, fallback to caching entire file');
keyFiles.push(cargo_lock);
continue;
}
@ -67053,8 +67054,8 @@ class CacheConfig {
hasher.update(JSON.stringify(packages));
parsedKeyFiles.push(cargo_lock);
}
catch (_e) {
// Fallback to caching them as regular file
catch (e) { // Fallback to caching them as regular file
lib_core.warning(`Error parsing Cargo.lock manifest, fallback to caching entire file: ${e}`);
keyFiles.push(cargo_lock);
}
}

9
dist/save/index.js vendored
View File

@ -67029,8 +67029,8 @@ class CacheConfig {
hasher.update(JSON.stringify(parsed));
parsedKeyFiles.push(cargo_manifest);
}
catch (_e) {
// Fallback to caching them as regular file
catch (e) { // Fallback to caching them as regular file
core.warning(`Error parsing Cargo.toml manifest, fallback to caching entire file: ${e}`);
keyFiles.push(cargo_manifest);
}
}
@ -67042,6 +67042,7 @@ class CacheConfig {
if (parsed.version !== 3 || !("package" in parsed)) {
// Fallback to caching them as regular file since this action
// can only handle Cargo.lock format version 3
core.warning('Unsupported Cargo.lock format, fallback to caching entire file');
keyFiles.push(cargo_lock);
continue;
}
@ -67053,8 +67054,8 @@ class CacheConfig {
hasher.update(JSON.stringify(packages));
parsedKeyFiles.push(cargo_lock);
}
catch (_e) {
// Fallback to caching them as regular file
catch (e) { // Fallback to caching them as regular file
core.warning(`Error parsing Cargo.lock manifest, fallback to caching entire file: ${e}`);
keyFiles.push(cargo_lock);
}
}

View File

@ -175,8 +175,8 @@ export class CacheConfig {
hasher.update(JSON.stringify(parsed));
parsedKeyFiles.push(cargo_manifest);
} catch (_e) {
// Fallback to caching them as regular file
} catch (e) { // Fallback to caching them as regular file
core.warning(`Error parsing Cargo.toml manifest, fallback to caching entire file: ${e}`);
keyFiles.push(cargo_manifest);
}
}
@ -191,6 +191,7 @@ export class CacheConfig {
if (parsed.version !== 3 || !("package" in parsed)) {
// Fallback to caching them as regular file since this action
// can only handle Cargo.lock format version 3
core.warning('Unsupported Cargo.lock format, fallback to caching entire file');
keyFiles.push(cargo_lock);
continue;
}
@ -204,8 +205,8 @@ export class CacheConfig {
hasher.update(JSON.stringify(packages));
parsedKeyFiles.push(cargo_lock);
} catch (_e) {
// Fallback to caching them as regular file
} catch (e) { // Fallback to caching them as regular file
core.warning(`Error parsing Cargo.lock manifest, fallback to caching entire file: ${e}`);
keyFiles.push(cargo_lock);
}
}