3 Commits

Author SHA1 Message Date
Arpad Borsos
e207df5d26 2.6.2 2023-08-20 10:28:01 +02:00
Arpad Borsos
decb69d790 Update dependencies and add changelog 2023-08-20 10:27:32 +02:00
Jiahao XU
ab6b2769d1 dep: Use smol-toml instead of toml (#164)
Fixed #162 #163

The former is listed on
https://github.com/toml-lang/toml/wiki#implementations and is toml 1.0
compliant.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-19 12:23:03 +02:00
6 changed files with 2669 additions and 8415 deletions

View File

@@ -1,5 +1,9 @@
# Changelog
## 2.6.2
- Fix `toml` parsing.
## 2.6.1
- Fix hash contributions of `Cargo.lock`/`Cargo.toml` files.

5494
dist/restore/index.js vendored

File diff suppressed because it is too large Load Diff

5494
dist/save/index.js vendored

File diff suppressed because it is too large Load Diff

75
package-lock.json generated
View File

@@ -1,21 +1,21 @@
{
"name": "rust-cache",
"version": "2.6.1",
"version": "2.6.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "rust-cache",
"version": "2.6.1",
"version": "2.6.2",
"license": "LGPL-3.0",
"dependencies": {
"@actions/buildjet-cache": "npm:github-actions.cache-buildjet@0.1.2",
"@actions/cache": "^3.2.1",
"@actions/buildjet-cache": "npm:github-actions.cache-buildjet@0.2.0",
"@actions/cache": "^3.2.2",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/glob": "^0.4.0",
"@actions/io": "^1.1.3",
"toml": "^3.0.0"
"smol-toml": "^1.1.1"
},
"devDependencies": {
"@vercel/ncc": "^0.36.1",
@@ -28,9 +28,9 @@
},
"node_modules/@actions/buildjet-cache": {
"name": "github-actions.cache-buildjet",
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/github-actions.cache-buildjet/-/github-actions.cache-buildjet-0.1.2.tgz",
"integrity": "sha512-mBgIxCYgDDSzkCCK1/DbVF36K0k2uaSx+Dk4LANat8KMzq7XtYK96ZnS7/fOosqzjtK7AlZtXsBkOoY5NKlcHw==",
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/github-actions.cache-buildjet/-/github-actions.cache-buildjet-0.2.0.tgz",
"integrity": "sha512-Dm1ZL9EBRo3JOwQKrGodxlqRsmFKerhwZj8DYTnWiAIU+qgR4cV8le97Dw/grmBgnAvANNMQlRP6+sNE1auQ6g==",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/exec": "^1.0.1",
@@ -51,14 +51,14 @@
}
},
"node_modules/@actions/cache": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.2.1.tgz",
"integrity": "sha512-QurbMiY//02+0kN1adJkMHN44RcZ5kAXfhSnKUZmtSmhMTNqLitGArG1xOkt93NNyByTlLGAc5wIOF/dZ2ENOQ==",
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.2.2.tgz",
"integrity": "sha512-6D0Jq5JrLZRQ3VApeQwQkkV20ZZXjXsHNYXd9VjNUdi9E0h93wESpxfMJ2JWLCUCgHNLcfY0v3GjNM+2FdRMlg==",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/exec": "^1.0.1",
"@actions/glob": "^0.1.0",
"@actions/http-client": "^2.0.1",
"@actions/http-client": "^2.1.1",
"@actions/io": "^1.0.1",
"@azure/abort-controller": "^1.1.0",
"@azure/ms-rest-js": "^2.6.0",
@@ -111,9 +111,9 @@
}
},
"node_modules/@actions/http-client": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.1.0.tgz",
"integrity": "sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.1.1.tgz",
"integrity": "sha512-qhrkRMB40bbbLo7gF+0vu+X+UawOvQQqNAA/5Unx774RS8poaOhThDOG6BGmxvAnxhQnDp2BG/ZUm65xZILTpw==",
"dependencies": {
"tunnel": "^0.0.6"
}
@@ -135,15 +135,16 @@
}
},
"node_modules/@azure/core-auth": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.4.0.tgz",
"integrity": "sha512-HFrcTgmuSuukRf/EdPmqBrc5l6Q5Uu+2TbuhaKbgaCpP2TfAeiNaQPAadxO+CYBRHGUzIDteMAjFspFLDLnKVQ==",
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.5.0.tgz",
"integrity": "sha512-udzoBuYG1VBoHVohDTrvKjyzel34zt77Bhp7dQntVGGD0ehVq48owENbBG8fIgkHRNUBQH5k1r0hpoMu5L8+kw==",
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-util": "^1.1.0",
"tslib": "^2.2.0"
},
"engines": {
"node": ">=12.0.0"
"node": ">=14.0.0"
}
},
"node_modules/@azure/core-http": {
@@ -229,9 +230,9 @@
}
},
"node_modules/@azure/core-util": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.3.2.tgz",
"integrity": "sha512-2bECOUh88RvL1pMZTcc6OzfobBeWDBf5oBbhjIhT1MV9otMVWCzpOJkkiKtrnO88y5GGBelgY8At73KGAdbkeQ==",
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.4.0.tgz",
"integrity": "sha512-eGAyJpm3skVQoLiRqm/xPa+SXi/NPDdSHMxbRAz2lSprd+Zs+qrpQGQQ2VQ3Nttu+nSZR4XoYQC71LbEI7jsig==",
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"tslib": "^2.2.0"
@@ -306,9 +307,9 @@
}
},
"node_modules/@types/node": {
"version": "20.4.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.5.tgz",
"integrity": "sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg=="
"version": "20.5.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.1.tgz",
"integrity": "sha512-4tT2UrL5LBqDwoed9wZ6N3umC4Yhz3W3FloMmiiG4JwmUJWpie0c7lcnUNd4gtMKuDEO4wRVS8B6Xa0uMRsMKg=="
},
"node_modules/@types/node-fetch": {
"version": "2.6.4",
@@ -472,9 +473,9 @@
}
},
"node_modules/node-fetch": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz",
"integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==",
"version": "2.6.13",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.13.tgz",
"integrity": "sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
@@ -511,10 +512,14 @@
"semver": "bin/semver.js"
}
},
"node_modules/toml": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz",
"integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w=="
"node_modules/smol-toml": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.1.1.tgz",
"integrity": "sha512-qyYMygHyDKiy82iiKTH/zXr0DZmEpsou0AMZnkXdYhA/0LhPLoZ/xHaOBrbecLbAJ/Gd5KhMWWH8TXtgv1g+DQ==",
"engines": {
"node": ">= 18",
"pnpm": ">= 8"
}
},
"node_modules/tr46": {
"version": "0.0.3",
@@ -522,9 +527,9 @@
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
},
"node_modules/tslib": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz",
"integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig=="
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
},
"node_modules/tunnel": {
"version": "0.0.6",

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "rust-cache",
"version": "2.6.1",
"version": "2.6.2",
"description": "A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.",
"keywords": [
"actions",
@@ -22,13 +22,13 @@
},
"homepage": "https://github.com/Swatinem/rust-cache#readme",
"dependencies": {
"@actions/buildjet-cache": "npm:github-actions.cache-buildjet@0.1.2",
"@actions/cache": "^3.2.1",
"@actions/buildjet-cache": "npm:github-actions.cache-buildjet@0.2.0",
"@actions/cache": "^3.2.2",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/glob": "^0.4.0",
"@actions/io": "^1.1.3",
"toml": "^3.0.0"
"smol-toml": "^1.1.1"
},
"devDependencies": {
"@vercel/ncc": "^0.36.1",

View File

@@ -5,7 +5,7 @@ import fs from "fs";
import fs_promises from "fs/promises";
import os from "os";
import path from "path";
import * as toml from "toml";
import * as toml from "smol-toml";
import { getCargoBins } from "./cleanup";
import { CacheProvider, getCmdOutput } from "./utils";
@@ -147,12 +147,13 @@ export class CacheConfig {
for (const cargo_manifest of cargo_manifests) {
try {
const content = await fs_promises.readFile(cargo_manifest, { encoding: "utf8" });
const parsed = toml.parse(content);
// Use any since TomlPrimitive is not exposed
const parsed = toml.parse(content) as { [key: string]: any };
if ("package" in parsed) {
const pack = parsed.package;
if ("version" in pack) {
pack.version = "0.0.0";
pack["version"] = "0.0.0";
}
}
@@ -205,7 +206,7 @@ export class CacheConfig {
// 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 as any[]).filter((p: any) => "source" in p || "checksum" in p);
hasher.update(JSON.stringify(packages));