Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
578b235f6e | ||
|
|
5113490c3f | ||
|
|
c0e052c18c | ||
|
|
4e0f4b19dd | ||
|
|
b919e1427f |
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 2.6.1
|
||||
|
||||
- Fix hash contributions of `Cargo.lock`/`Cargo.toml` files.
|
||||
|
||||
## 2.6.0
|
||||
|
||||
- Add "buildjet" as a second `cache-provider` backend.
|
||||
|
||||
25
dist/restore/index.js
vendored
25
dist/restore/index.js
vendored
@@ -67021,16 +67021,24 @@ class CacheConfig {
|
||||
const deps = parsed[section_name];
|
||||
for (const key of Object.keys(deps)) {
|
||||
const dep = deps[key];
|
||||
if ("path" in dep) {
|
||||
dep.version = "0.0.0";
|
||||
try {
|
||||
if ("path" in dep) {
|
||||
dep.version = "0.0.0";
|
||||
dep.path = "";
|
||||
}
|
||||
}
|
||||
catch (_e) {
|
||||
// Not an object, probably a string (version),
|
||||
// continue.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
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,19 +67050,18 @@ 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;
|
||||
}
|
||||
// Package without `[[package]].source` and `[[package]].checksum`
|
||||
// are the one with `path = "..."` to crates within the workspace.
|
||||
const packages = parsed.package.filter((p) => {
|
||||
"source" in p || "checksum" in p;
|
||||
});
|
||||
const packages = parsed.package.filter((p) => "source" in p || "checksum" in p);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
25
dist/save/index.js
vendored
25
dist/save/index.js
vendored
@@ -67021,16 +67021,24 @@ class CacheConfig {
|
||||
const deps = parsed[section_name];
|
||||
for (const key of Object.keys(deps)) {
|
||||
const dep = deps[key];
|
||||
if ("path" in dep) {
|
||||
dep.version = "0.0.0";
|
||||
try {
|
||||
if ("path" in dep) {
|
||||
dep.version = "0.0.0";
|
||||
dep.path = "";
|
||||
}
|
||||
}
|
||||
catch (_e) {
|
||||
// Not an object, probably a string (version),
|
||||
// continue.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
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,19 +67050,18 @@ 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;
|
||||
}
|
||||
// Package without `[[package]].source` and `[[package]].checksum`
|
||||
// are the one with `path = "..."` to crates within the workspace.
|
||||
const packages = parsed.package.filter((p) => {
|
||||
"source" in p || "checksum" in p;
|
||||
});
|
||||
const packages = parsed.package.filter((p) => "source" in p || "checksum" in p);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "rust-cache",
|
||||
"version": "2.6.0",
|
||||
"version": "2.6.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "rust-cache",
|
||||
"version": "2.6.0",
|
||||
"version": "2.6.1",
|
||||
"license": "LGPL-3.0",
|
||||
"dependencies": {
|
||||
"@actions/buildjet-cache": "npm:github-actions.cache-buildjet@0.1.2",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "rust-cache",
|
||||
"version": "2.6.0",
|
||||
"version": "2.6.1",
|
||||
"description": "A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.",
|
||||
"keywords": [
|
||||
"actions",
|
||||
|
||||
@@ -166,8 +166,15 @@ export class CacheConfig {
|
||||
for (const key of Object.keys(deps)) {
|
||||
const dep = deps[key];
|
||||
|
||||
if ("path" in dep) {
|
||||
dep.version = "0.0.0";
|
||||
try {
|
||||
if ("path" in dep) {
|
||||
dep.version = "0.0.0";
|
||||
dep.path = "";
|
||||
}
|
||||
} catch (_e) {
|
||||
// Not an object, probably a string (version),
|
||||
// continue.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,8 +182,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,21 +198,20 @@ 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;
|
||||
}
|
||||
|
||||
// Package without `[[package]].source` and `[[package]].checksum`
|
||||
// are the one with `path = "..."` to crates within the workspace.
|
||||
const packages = parsed.package.filter((p: any) => {
|
||||
"source" in p || "checksum" in p;
|
||||
});
|
||||
const packages = parsed.package.filter((p: any) => "source" in p || "checksum" in p);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user