mirror of
https://github.com/Swatinem/rust-cache
synced 2026-06-09 18:20:59 +00:00
Merge branch 'master' of https://github.com/Swatinem/rust-cache
This commit is contained in:
commit
1fe0a60026
19 changed files with 81 additions and 55 deletions
34
.github/workflows/binstall.yml
vendored
Normal file
34
.github/workflows/binstall.yml
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
name: binstall
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
binstall:
|
||||
if: github.repository == 'Swatinem/rust-cache'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
|
||||
name: Test `cargo binstall` on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- run: rustup toolchain install stable --profile minimal --no-self-update
|
||||
|
||||
- uses: cargo-bins/cargo-binstall@v1.19.1
|
||||
|
||||
- uses: ./
|
||||
|
||||
- run: cargo binstall -y cargo-deny
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
6
.github/workflows/check-dist.yml
vendored
6
.github/workflows/check-dist.yml
vendored
|
|
@ -18,12 +18,12 @@ jobs:
|
|||
if: github.repository == 'Swatinem/rust-cache'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node.js 24.x
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: 24.x
|
||||
cache: npm
|
||||
|
|
@ -43,7 +43,7 @@ jobs:
|
|||
fi
|
||||
id: diff
|
||||
|
||||
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||
with:
|
||||
name: dist
|
||||
|
|
|
|||
4
.github/workflows/coverage.yml
vendored
4
.github/workflows/coverage.yml
vendored
|
|
@ -19,13 +19,13 @@ jobs:
|
|||
CARGO_TERM_COLOR: always
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- run: rustup toolchain install stable --profile minimal --component llvm-tools-preview --no-self-update
|
||||
|
||||
- uses: taiki-e/install-action@64c5c20c872907b6f7cd50994ac189e7274160f2 # v2.68.26
|
||||
- uses: taiki-e/install-action@25435dc8dd3baed7417e0c96d3fe89013a5b2e09 # v2.81.3
|
||||
with:
|
||||
tool: cargo-llvm-cov
|
||||
|
||||
|
|
|
|||
6
.github/workflows/dependabot.yml
vendored
6
.github/workflows/dependabot.yml
vendored
|
|
@ -15,10 +15,10 @@ jobs:
|
|||
steps:
|
||||
- name: Fetch metadata
|
||||
id: metadata
|
||||
uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2.5.0
|
||||
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
|
||||
with:
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
persist-credentials: false
|
||||
|
|
@ -37,7 +37,7 @@ jobs:
|
|||
fi
|
||||
- name: Setup node if necessary
|
||||
if: steps.npm.outputs.changed != ''
|
||||
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
node-version: 24.x
|
||||
cache: npm
|
||||
|
|
|
|||
2
.github/workflows/git-registry.yml
vendored
2
.github/workflows/git-registry.yml
vendored
|
|
@ -20,7 +20,7 @@ jobs:
|
|||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
|
|
|||
2
.github/workflows/install.yml
vendored
2
.github/workflows/install.yml
vendored
|
|
@ -19,7 +19,7 @@ jobs:
|
|||
CARGO_TERM_COLOR: always
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
|
|
|||
4
.github/workflows/multi-job-cache.yml
vendored
4
.github/workflows/multi-job-cache.yml
vendored
|
|
@ -20,7 +20,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
|
|
|||
4
.github/workflows/nix.yml
vendored
4
.github/workflows/nix.yml
vendored
|
|
@ -16,11 +16,11 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: cachix/install-nix-action@1ca7d21a94afc7c957383a2d217460d980de4934 # v31.10.1
|
||||
- uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 # v31.10.6
|
||||
|
||||
- uses: ./
|
||||
with:
|
||||
|
|
|
|||
2
.github/workflows/simple.yml
vendored
2
.github/workflows/simple.yml
vendored
|
|
@ -19,7 +19,7 @@ jobs:
|
|||
CARGO_TERM_COLOR: always
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
|
|
|||
2
.github/workflows/target-dir.yml
vendored
2
.github/workflows/target-dir.yml
vendored
|
|
@ -19,7 +19,7 @@ jobs:
|
|||
CARGO_TERM_COLOR: always
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
|
|
|||
2
.github/workflows/warpbuild.yml
vendored
2
.github/workflows/warpbuild.yml
vendored
|
|
@ -19,7 +19,7 @@ jobs:
|
|||
CARGO_TERM_COLOR: always
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
|
|
|||
2
.github/workflows/workspaces.yml
vendored
2
.github/workflows/workspaces.yml
vendored
|
|
@ -19,7 +19,7 @@ jobs:
|
|||
CARGO_TERM_COLOR: always
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
|
|
|||
4
.github/workflows/zizmor.yml
vendored
4
.github/workflows/zizmor.yml
vendored
|
|
@ -16,9 +16,9 @@ jobs:
|
|||
security-events: write # for uploading results to the Security tab
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Run zizmor 🌈
|
||||
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
|
||||
uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ sensible defaults.
|
|||
## Example usage
|
||||
|
||||
```yaml
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
# selecting a toolchain either by action or manual `rustup` calls should happen
|
||||
# before the plugin, as the cache uses the current rustc version as its cache key
|
||||
|
|
@ -32,7 +32,7 @@ sensible defaults.
|
|||
# default: "true"
|
||||
add-job-id-key: ""
|
||||
|
||||
# Weather the a hash of the rust environment should be included in the cache key.
|
||||
# Whether the a hash of the rust environment should be included in the cache key.
|
||||
# This includes a hash of all Cargo.toml/Cargo.lock files, rust-toolchain files,
|
||||
# and .cargo/config.toml files (if present), as well as the specified 'env-vars'.
|
||||
# default: "true"
|
||||
|
|
|
|||
12
dist/restore.js
vendored
12
dist/restore.js
vendored
|
|
@ -332343,7 +332343,7 @@ async function exists(path) {
|
|||
}
|
||||
}
|
||||
|
||||
const SAVE_TARGETS = new Set(["lib", "proc-macro"]);
|
||||
const SAVE_TARGETS = new Set(["lib", "cdylib", "dylib", "rlib", "staticlib", "proc-macro"]);
|
||||
class Workspace {
|
||||
root;
|
||||
target;
|
||||
|
|
@ -332682,10 +332682,10 @@ function digest(hasher) {
|
|||
async function getCargoBins() {
|
||||
const bins = new Set();
|
||||
try {
|
||||
const { installs } = JSON.parse(await fs$2.readFile(path__default.join(CARGO_HOME, ".crates2.json"), "utf8"));
|
||||
for (const pkg of Object.values(installs)) {
|
||||
for (const bin of pkg.bins) {
|
||||
bins.add(bin);
|
||||
const dir = await fs$2.opendir(path__default.join(CARGO_HOME, "bin"));
|
||||
for await (const dirent of dir) {
|
||||
if (dirent.isFile()) {
|
||||
bins.add(dirent.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -332803,7 +332803,7 @@ async function cleanProfileTarget(profileDir, packages, checkTimestamp = false)
|
|||
}
|
||||
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
|
||||
await rmExcept(profileDir, keepProfile);
|
||||
const keepPkg = new Set(packages.map((p) => p.name));
|
||||
const keepPkg = new Set(packages.flatMap((p) => [p.name, ...p.targets.map((t) => t.replace(/-/g, "_"))]));
|
||||
await rmExcept(path__default.join(profileDir, "build"), keepPkg, checkTimestamp);
|
||||
await rmExcept(path__default.join(profileDir, ".fingerprint"), keepPkg, checkTimestamp);
|
||||
const keepDeps = new Set(packages.flatMap((p) => {
|
||||
|
|
|
|||
19
dist/save.js
vendored
19
dist/save.js
vendored
|
|
@ -332310,7 +332310,7 @@ async function exists(path) {
|
|||
}
|
||||
}
|
||||
|
||||
const SAVE_TARGETS = new Set(["lib", "proc-macro"]);
|
||||
const SAVE_TARGETS = new Set(["lib", "cdylib", "dylib", "rlib", "staticlib", "proc-macro"]);
|
||||
class Workspace {
|
||||
root;
|
||||
target;
|
||||
|
|
@ -332657,10 +332657,10 @@ function digest(hasher) {
|
|||
async function getCargoBins() {
|
||||
const bins = new Set();
|
||||
try {
|
||||
const { installs } = JSON.parse(await fs$2.readFile(path__default.join(CARGO_HOME, ".crates2.json"), "utf8"));
|
||||
for (const pkg of Object.values(installs)) {
|
||||
for (const bin of pkg.bins) {
|
||||
bins.add(bin);
|
||||
const dir = await fs$2.opendir(path__default.join(CARGO_HOME, "bin"));
|
||||
for await (const dirent of dir) {
|
||||
if (dirent.isFile()) {
|
||||
bins.add(dirent.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -332778,7 +332778,7 @@ async function cleanProfileTarget(profileDir, packages, checkTimestamp = false)
|
|||
}
|
||||
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
|
||||
await rmExcept(profileDir, keepProfile);
|
||||
const keepPkg = new Set(packages.map((p) => p.name));
|
||||
const keepPkg = new Set(packages.flatMap((p) => [p.name, ...p.targets.map((t) => t.replace(/-/g, "_"))]));
|
||||
await rmExcept(path__default.join(profileDir, "build"), keepPkg, checkTimestamp);
|
||||
await rmExcept(path__default.join(profileDir, ".fingerprint"), keepPkg, checkTimestamp);
|
||||
const keepDeps = new Set(packages.flatMap((p) => {
|
||||
|
|
@ -332798,13 +332798,10 @@ async function cleanProfileTarget(profileDir, packages, checkTimestamp = false)
|
|||
* @param oldBins The binaries that existed when the action started.
|
||||
*/
|
||||
async function cleanBin(oldBins) {
|
||||
const bins = await getCargoBins();
|
||||
for (const bin of oldBins) {
|
||||
bins.delete(bin);
|
||||
}
|
||||
const binsToRemove = new Set(oldBins);
|
||||
const dir = await fs__default.promises.opendir(path__default.join(CARGO_HOME, "bin"));
|
||||
for await (const dirent of dir) {
|
||||
if (dirent.isFile() && !bins.has(dirent.name)) {
|
||||
if (dirent.isFile() && binsToRemove.has(dirent.name)) {
|
||||
await rm(dir.path, dirent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import * as io from "@actions/io";
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
import { CARGO_HOME, getCargoBins } from "./config";
|
||||
import { CARGO_HOME } from "./config";
|
||||
import { exists } from "./utils";
|
||||
import { Packages } from "./workspace";
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ async function cleanProfileTarget(profileDir: string, packages: Packages, checkT
|
|||
let keepProfile = new Set(["build", ".fingerprint", "deps"]);
|
||||
await rmExcept(profileDir, keepProfile);
|
||||
|
||||
const keepPkg = new Set(packages.map((p) => p.name));
|
||||
const keepPkg = new Set(packages.flatMap((p) => [p.name, ...p.targets.map((t) => t.replace(/-/g, "_"))]));
|
||||
await rmExcept(path.join(profileDir, "build"), keepPkg, checkTimestamp);
|
||||
await rmExcept(path.join(profileDir, ".fingerprint"), keepPkg, checkTimestamp);
|
||||
|
||||
|
|
@ -82,15 +82,11 @@ async function cleanProfileTarget(profileDir: string, packages: Packages, checkT
|
|||
* @param oldBins The binaries that existed when the action started.
|
||||
*/
|
||||
export async function cleanBin(oldBins: Array<string>) {
|
||||
const bins = await getCargoBins();
|
||||
|
||||
for (const bin of oldBins) {
|
||||
bins.delete(bin);
|
||||
}
|
||||
const binsToRemove = new Set<string>(oldBins);
|
||||
|
||||
const dir = await fs.promises.opendir(path.join(CARGO_HOME, "bin"));
|
||||
for await (const dirent of dir) {
|
||||
if (dirent.isFile() && !bins.has(dirent.name)) {
|
||||
if (dirent.isFile() && binsToRemove.has(dirent.name)) {
|
||||
await rm(dir.path, dirent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -380,19 +380,18 @@ function digest(hasher: crypto.Hash): string {
|
|||
|
||||
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);
|
||||
const dir = await fs.opendir(path.join(CARGO_HOME, "bin"));
|
||||
for await (const dirent of dir) {
|
||||
if (dirent.isFile()) {
|
||||
bins.add(dirent.name);
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
|
||||
return bins;
|
||||
}
|
||||
|
||||
interface RustVersion {
|
||||
host: string;
|
||||
release: string;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import path from "path";
|
|||
|
||||
import { getCmdOutput } from "./utils";
|
||||
|
||||
const SAVE_TARGETS = new Set(["lib", "proc-macro"]);
|
||||
const SAVE_TARGETS = new Set(["lib", "cdylib", "dylib", "rlib", "staticlib", "proc-macro"]);
|
||||
|
||||
export class Workspace {
|
||||
constructor(public root: string, public target: string) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue