3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2026-06-26 10:08:46 +00:00

package maintenance

- update to TS6
- replace ncc by rollup, which seems to now be the recommended workflow according to <https://github.com/actions/typescript-action>
- remove buildjet provider, as they are shutting down, see <https://buildjet.com/for-github-actions/blog/we-are-shutting-down>
This commit is contained in:
Arpad Borsos 2026-06-06 13:55:47 +02:00
parent e18b497796
commit be9aa033ee
No known key found for this signature in database
GPG key ID: FC7BCA77824B3298
15 changed files with 667122 additions and 501283 deletions

View file

@ -3,7 +3,7 @@ import * as io from "@actions/io";
import fs from "fs";
import path from "path";
import { CARGO_HOME } from "./config";
import { CARGO_HOME, getCargoBins } from "./config";
import { exists } from "./utils";
import { Packages } from "./workspace";
@ -75,21 +75,6 @@ async function cleanProfileTarget(profileDir: string, packages: Packages, checkT
await rmExcept(path.join(profileDir, "deps"), keepDeps, checkTimestamp);
}
export async function getCargoBins(): Promise<Set<string>> {
const bins = new Set<string>();
try {
const { installs }: { installs: { [key: string]: { bins: Array<string> } } } = JSON.parse(
await fs.promises.readFile(path.join(CARGO_HOME, ".crates2.json"), "utf8"),
);
for (const pkg of Object.values(installs)) {
for (const bin of pkg.bins) {
bins.add(bin);
}
}
} catch {}
return bins;
}
/**
* Clean the cargo bin directory, removing the binaries that existed
* when the action started, as they were not created by the build.

View file

@ -7,7 +7,6 @@ import os from "os";
import path from "path";
import * as toml from "smol-toml";
import { getCargoBins } from "./cleanup";
import { CacheProvider, exists, getCmdOutput } from "./utils";
import { Workspace } from "./workspace";
@ -379,6 +378,21 @@ function digest(hasher: crypto.Hash): string {
return hasher.digest("hex").substring(0, HASH_LENGTH);
}
export async function getCargoBins(): Promise<Set<string>> {
const bins = new Set<string>();
try {
const { installs }: { installs: { [key: string]: { bins: Array<string> } } } = JSON.parse(
await fs.readFile(path.join(CARGO_HOME, ".crates2.json"), "utf8"),
);
for (const pkg of Object.values(installs)) {
for (const bin of pkg.bins) {
bins.add(bin);
}
}
} catch {}
return bins;
}
interface RustVersion {
host: string;
release: string;

View file

@ -1,6 +1,5 @@
import * as core from "@actions/core";
import * as exec from "@actions/exec";
import * as buildjetCache from "@actions/buildjet-cache";
import * as warpbuildCache from "@actions/warpbuild-cache";
import * as ghCache from "@actions/cache";
import fs from "fs";
@ -15,11 +14,7 @@ export function reportError(e: any) {
}
}
export async function getCmdOutput(
cmdFormat: string,
cmd: string,
options: exec.ExecOptions = {},
): Promise<string> {
export async function getCmdOutput(cmdFormat: string, cmd: string, options: exec.ExecOptions = {}): Promise<string> {
cmd = cmdFormat.replace("{0}", cmd);
let stdout = "";
let stderr = "";
@ -64,9 +59,6 @@ export function getCacheProvider(): CacheProvider {
case "github":
cache = ghCache;
break;
case "buildjet":
cache = buildjetCache;
break;
case "warpbuild":
cache = warpbuildCache;
break;