20 Commits

Author SHA1 Message Date
Arpad Borsos
f13886b937 2.8.1
Some checks failed
buildjet / Test buildjet provider on ubuntu-latest (push) Has been skipped
coverage / Test `cargo-llvm-cov` on ubuntu-latest (push) Has been skipped
git-registry / Test cargo "git" registry on ubuntu-latest (push) Has been skipped
install / Test `cargo install` on ubuntu-latest (push) Has been skipped
simple / Test `cargo check/test/build` on ubuntu-latest (push) Has been skipped
target-dir / Test custom target-dir on ubuntu-latest (push) Has been skipped
workspaces / Test multiple workspaces on ubuntu-latest (push) Has been skipped
buildjet / Test buildjet provider on macos-latest (push) Has been cancelled
buildjet / Test buildjet provider on windows-latest (push) Has been cancelled
coverage / Test `cargo-llvm-cov` on macos-latest (push) Has been cancelled
coverage / Test `cargo-llvm-cov` on windows-latest (push) Has been cancelled
git-registry / Test cargo "git" registry on macos-latest (push) Has been cancelled
git-registry / Test cargo "git" registry on windows-latest (push) Has been cancelled
install / Test `cargo install` on macos-latest (push) Has been cancelled
install / Test `cargo install` on windows-latest (push) Has been cancelled
simple / Test `cargo check/test/build` on macos-latest (push) Has been cancelled
simple / Test `cargo check/test/build` on windows-latest (push) Has been cancelled
target-dir / Test custom target-dir on macos-latest (push) Has been cancelled
target-dir / Test custom target-dir on windows-latest (push) Has been cancelled
workspaces / Test multiple workspaces on macos-latest (push) Has been cancelled
workspaces / Test multiple workspaces on windows-latest (push) Has been cancelled
2025-09-18 08:38:04 +02:00
Arpad Borsos
5abb1e2a95 update dependencies, prepare for release 2025-09-18 08:37:35 +02:00
dependabot[bot]
3c68c31fe5 Bump @types/node from 24.2.1 to 24.3.0 in the dev-minor group (#258)
Bumps the dev-minor group with 1 update: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node).


Updates `@types/node` from 24.2.1 to 24.3.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 24.3.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dev-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-18 08:32:13 +02:00
Luiz Miguel
5467cca14c Update README.md (#234) 2025-09-18 08:31:58 +02:00
dependabot[bot]
94b28bf00e Bump actions/setup-node from 4 to 5 in the actions group (#259)
Bumps the actions group with 1 update: [actions/setup-node](https://github.com/actions/setup-node).


Updates `actions/setup-node` from 4 to 5
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-09 19:38:10 +02:00
dependabot[bot]
cb8ffc21fa Bump typescript from 5.8.3 to 5.9.2 in the dev-minor group (#256)
Bumps the dev-minor group with 1 update: [typescript](https://github.com/microsoft/TypeScript).


Updates `typescript` from 5.8.3 to 5.9.2
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release-publish.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.8.3...v5.9.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-version: 5.9.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dev-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-15 13:56:56 +02:00
dependabot[bot]
c4f0bbdf58 Bump @types/node from 22.16.3 to 24.2.1 in the dev-major group (#255)
Bumps the dev-major group with 1 update: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node).


Updates `@types/node` from 22.16.3 to 24.2.1
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 24.2.1
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: dev-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-15 13:56:46 +02:00
Rene Leonhardt
d8c5063361 chore(dependabot): regenerate and commit dist/ (#257) 2025-08-15 13:56:20 +02:00
github-actions[bot]
267a8a94c9 Merge pull request #254 from Swatinem/dependabot/npm_and_yarn/prd-patch-d0e2e2b032
Bump the prd-patch group with 2 updates
2025-08-14 11:19:25 +00:00
dependabot[bot]
46cb408fba Bump the prd-patch group with 2 updates
Bumps the prd-patch group with 2 updates: [@actions/cache](https://github.com/actions/toolkit/tree/HEAD/packages/cache) and [smol-toml](https://github.com/squirrelchat/smol-toml).


Updates `@actions/cache` from 4.0.3 to 4.0.5
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/cache/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/cache)

Updates `smol-toml` from 1.4.1 to 1.4.2
- [Release notes](https://github.com/squirrelchat/smol-toml/releases)
- [Commits](https://github.com/squirrelchat/smol-toml/compare/v1.4.1...v1.4.2)

---
updated-dependencies:
- dependency-name: "@actions/cache"
  dependency-version: 4.0.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prd-patch
- dependency-name: smol-toml
  dependency-version: 1.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: prd-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-14 11:14:50 +00:00
Rene Leonhardt
203c9eb82a chore: fix dependabot groups (#253) 2025-08-14 13:12:32 +02:00
Rene Leonhardt
a8b36e3f74 chore(deps): update dependencies (#251) 2025-07-26 20:53:41 +02:00
Arsenii Lyashenko
7e1e2d0a10 Set empty CARGO_ENCODED_RUSTFLAGS in workspace metadata retrieval (#249) 2025-06-27 19:56:05 +02:00
Arpad Borsos
98c8021b55 2.8.0
Some checks failed
buildjet / Test buildjet provider on ubuntu-latest (push) Failing after 0s
coverage / Test `cargo-llvm-cov` on ubuntu-latest (push) Failing after 0s
git-registry / Test cargo "git" registry on ubuntu-latest (push) Failing after 0s
install / Test `cargo install` on ubuntu-latest (push) Failing after 0s
simple / Test `cargo check/test/build` on ubuntu-latest (push) Failing after 0s
target-dir / Test custom target-dir on ubuntu-latest (push) Failing after 0s
workspaces / Test multiple workspaces on ubuntu-latest (push) Failing after 0s
buildjet / Test buildjet provider on macos-latest (push) Has been cancelled
buildjet / Test buildjet provider on windows-latest (push) Has been cancelled
coverage / Test `cargo-llvm-cov` on macos-latest (push) Has been cancelled
coverage / Test `cargo-llvm-cov` on windows-latest (push) Has been cancelled
git-registry / Test cargo "git" registry on macos-latest (push) Has been cancelled
git-registry / Test cargo "git" registry on windows-latest (push) Has been cancelled
install / Test `cargo install` on macos-latest (push) Has been cancelled
install / Test `cargo install` on windows-latest (push) Has been cancelled
simple / Test `cargo check/test/build` on macos-latest (push) Has been cancelled
simple / Test `cargo check/test/build` on windows-latest (push) Has been cancelled
target-dir / Test custom target-dir on macos-latest (push) Has been cancelled
target-dir / Test custom target-dir on windows-latest (push) Has been cancelled
workspaces / Test multiple workspaces on macos-latest (push) Has been cancelled
workspaces / Test multiple workspaces on windows-latest (push) Has been cancelled
2025-06-25 18:29:46 +02:00
Arpad Borsos
14d3bc39c4 update Changelog 2025-06-25 18:29:46 +02:00
Sammy Harris
52ea1434f8 support warpbuild cache provider (#247) 2025-06-24 19:04:05 +02:00
Jeroen Bransen
eaa85be6b1 Add cache-workspace-crates feature (#246) 2025-06-22 10:43:50 +02:00
Arpad Borsos
901019c0f8 Update the test lockfiles 2025-06-20 09:12:23 +02:00
Arpad Borsos
9d47c6ad4b 2.7.8
Some checks failed
buildjet / Test buildjet provider on ubuntu-latest (push) Failing after 0s
coverage / Test `cargo-llvm-cov` on ubuntu-latest (push) Failing after 0s
git-registry / Test cargo "git" registry on ubuntu-latest (push) Failing after 0s
install / Test `cargo install` on ubuntu-latest (push) Failing after 0s
simple / Test `cargo check/test/build` on ubuntu-latest (push) Failing after 0s
target-dir / Test custom target-dir on ubuntu-latest (push) Failing after 0s
workspaces / Test multiple workspaces on ubuntu-latest (push) Failing after 0s
buildjet / Test buildjet provider on macos-latest (push) Has been cancelled
buildjet / Test buildjet provider on windows-latest (push) Has been cancelled
coverage / Test `cargo-llvm-cov` on macos-latest (push) Has been cancelled
coverage / Test `cargo-llvm-cov` on windows-latest (push) Has been cancelled
git-registry / Test cargo "git" registry on macos-latest (push) Has been cancelled
git-registry / Test cargo "git" registry on windows-latest (push) Has been cancelled
install / Test `cargo install` on macos-latest (push) Has been cancelled
install / Test `cargo install` on windows-latest (push) Has been cancelled
simple / Test `cargo check/test/build` on macos-latest (push) Has been cancelled
simple / Test `cargo check/test/build` on windows-latest (push) Has been cancelled
target-dir / Test custom target-dir on macos-latest (push) Has been cancelled
target-dir / Test custom target-dir on windows-latest (push) Has been cancelled
workspaces / Test multiple workspaces on macos-latest (push) Has been cancelled
workspaces / Test multiple workspaces on windows-latest (push) Has been cancelled
2025-03-19 08:16:06 +01:00
Linda_pp
27b8ea9368 Include CPU arch in the cache key (#228) 2025-02-08 15:36:01 +01:00
28 changed files with 203490 additions and 77415 deletions

50
.github/dependabot.yaml vendored Normal file
View File

@@ -0,0 +1,50 @@
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/optimizing-pr-creation-version-updates#setting-up-a-cooldown-period-for-dependency-updates
version: 2
updates:
- package-ecosystem: cargo
directories:
- tests
- tests/wasm-workspace
schedule:
interval: weekly
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference#groups--
# 1 PR per week and group
groups:
cargo-major:
update-types: ["major"]
cargo-minor:
update-types: ["minor"]
cargo-patch:
update-types: ["patch"]
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
actions:
# Combine all images of the last week
patterns: ["*"]
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
groups:
prd-major:
dependency-type: "production"
update-types: ["major"]
prd-minor:
dependency-type: "production"
update-types: ["minor"]
prd-patch:
dependency-type: "production"
update-types: ["patch"]
dev-major:
dependency-type: "development"
update-types: ["major"]
dev-minor:
dependency-type: "development"
update-types: ["minor"]
dev-patch:
dependency-type: "development"
update-types: ["patch"]

View File

@@ -4,6 +4,7 @@ on: [push, pull_request]
jobs: jobs:
buildjet: buildjet:
if: github.repository == 'Swatinem/rust-cache'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -16,7 +17,7 @@ jobs:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- run: rustup toolchain install stable --profile minimal --no-self-update - run: rustup toolchain install stable --profile minimal --no-self-update

View File

@@ -13,12 +13,13 @@ on:
jobs: jobs:
check-dist: check-dist:
if: github.repository == 'Swatinem/rust-cache'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Setup Node.js 20.x - name: Setup Node.js 20.x
uses: actions/setup-node@v4 uses: actions/setup-node@v5
with: with:
node-version: 20.x node-version: 20.x
cache: npm cache: npm

View File

@@ -4,6 +4,7 @@ on: [push, pull_request]
jobs: jobs:
coverage: coverage:
if: github.repository == 'Swatinem/rust-cache'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -16,7 +17,7 @@ jobs:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- run: rustup toolchain install stable --profile minimal --component llvm-tools-preview --no-self-update - run: rustup toolchain install stable --profile minimal --component llvm-tools-preview --no-self-update

63
.github/workflows/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,63 @@
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enabling-automerge-on-a-pull-request
name: Dependabot Automation
on: pull_request
permissions:
contents: write
pull-requests: write
jobs:
automerge:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'Swatinem/rust-cache'
steps:
- name: Fetch metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v5
with:
fetch-depth: 2
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
- name: Check if package-lock.json has been changed
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
id: npm
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
if ! git diff --quiet HEAD~1.. -- package-lock.json; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "changed=true, checking out $PR_URL to allow amend"
gh pr checkout "$PR_URL"
fi
- name: Setup node if necessary
if: steps.npm.outputs.changed != ''
uses: actions/setup-node@v5
with:
node-version: 20.x
cache: npm
- name: Re-generate and commit dist/ if changed
id: amend
if: steps.npm.outputs.changed != ''
run: |
npm ci
npm run prepare
if ! git diff --quiet dist/*/index.js; then
echo "dist/ changed, amending last commit"
export $(git log -1 --pretty=format:'GIT_COMMITTER_NAME=%cn GIT_COMMITTER_EMAIL=%ce GIT_AUTHOR_NAME=%an GIT_AUTHOR_EMAIL=%ae')
git fetch --unshallow
echo "Before amend:" && git show --name-only --pretty=
git commit --amend --no-edit --no-reset-author -- dist/*/index.js
echo "After amend:" && git show --name-only --pretty=
git push --force-with-lease origin HEAD
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Auto-merge Patch PRs
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

View File

@@ -4,6 +4,7 @@ on: [push, pull_request]
jobs: jobs:
git-registry: git-registry:
if: github.repository == 'Swatinem/rust-cache'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -17,7 +18,7 @@ jobs:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- run: rustup toolchain install stable --profile minimal --no-self-update - run: rustup toolchain install stable --profile minimal --no-self-update

View File

@@ -4,6 +4,7 @@ on: [push, pull_request]
jobs: jobs:
install: install:
if: github.repository == 'Swatinem/rust-cache'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -16,7 +17,7 @@ jobs:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- run: rustup toolchain install stable --profile minimal --no-self-update - run: rustup toolchain install stable --profile minimal --no-self-update

View File

@@ -4,6 +4,7 @@ on: [push, pull_request]
jobs: jobs:
simple: simple:
if: github.repository == 'Swatinem/rust-cache'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -16,7 +17,7 @@ jobs:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- run: rustup toolchain install stable --profile minimal --no-self-update - run: rustup toolchain install stable --profile minimal --no-self-update

View File

@@ -4,6 +4,7 @@ on: [push, pull_request]
jobs: jobs:
target-dir: target-dir:
if: github.repository == 'Swatinem/rust-cache'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -16,7 +17,7 @@ jobs:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- run: rustup toolchain install stable --profile minimal --no-self-update - run: rustup toolchain install stable --profile minimal --no-self-update

View File

@@ -4,6 +4,7 @@ on: [push, pull_request]
jobs: jobs:
workspaces: workspaces:
if: github.repository == 'Swatinem/rust-cache'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -16,7 +17,7 @@ jobs:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- run: rustup toolchain install stable --profile minimal --target wasm32-unknown-unknown --no-self-update - run: rustup toolchain install stable --profile minimal --target wasm32-unknown-unknown --no-self-update
@@ -26,8 +27,10 @@ jobs:
tests tests
tests/wasm-workspace tests/wasm-workspace
- run: cargo check - name: cargo check (tests)
working-directory: tests working-directory: tests
run: cargo check
- run: cargo check - name: cargo check (tests/wasm-workspace)
working-directory: tests/wasm-workspace working-directory: tests/wasm-workspace
run: cargo check

View File

@@ -1,5 +1,34 @@
# Changelog # Changelog
## 2.8.1
- Set empty `CARGO_ENCODED_RUSTFLAGS` when retrieving metadata
- Various dependency updates
## 2.8.0
- Add support for `warpbuild` cache provider
- Add new `cache-workspace-crates` feature
## 2.7.8
- Include CPU arch in the cache key
## 2.7.7
- Also cache `cargo install` metadata
## 2.7.6
- Allow opting out of caching $CARGO_HOME/bin
- Add runner OS in cache key
- Adds an option to do lookup-only of the cache
## 2.7.5
- Support Cargo.lock format cargo-lock v4
- Only run macOsWorkaround() on macOS
## 2.7.3 ## 2.7.3
- Work around upstream problem that causes cache saving to hang for minutes. - Work around upstream problem that causes cache saving to hang for minutes.

View File

@@ -6,7 +6,7 @@ sensible defaults.
## Example usage ## Example usage
```yaml ```yaml
- uses: actions/checkout@v4 - uses: actions/checkout@v5
# selecting a toolchain either by action or manual `rustup` calls should happen # 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 # before the plugin, as the cache uses the current rustc version as its cache key
@@ -60,6 +60,12 @@ sensible defaults.
# default: "false" # default: "false"
cache-all-crates: "" cache-all-crates: ""
# Similar to cache-all-crates.
# If `true` the workspace crates will be cached.
# Useful if the workspace contains libraries that are only updated sporadically.
# default: "false"
cache-workspace-crates: ""
# Determines whether the cache should be saved. # Determines whether the cache should be saved.
# If `false`, the cache is only restored. # If `false`, the cache is only restored.
# Useful for jobs where the matrix is additive e.g. additional Cargo features, # Useful for jobs where the matrix is additive e.g. additional Cargo features,
@@ -76,7 +82,7 @@ sensible defaults.
lookup-only: "" lookup-only: ""
# Specifies what to use as the backend providing cache # Specifies what to use as the backend providing cache
# Can be set to either "github" or "buildjet" # Can be set to "github", "buildjet", or "warpbuild"
# default: "github" # default: "github"
cache-provider: "" cache-provider: ""
@@ -95,14 +101,14 @@ This is a boolean flag that will be set to `true` when there was an exact cache
## Cache Effectiveness ## Cache Effectiveness
This action only caches the _dependencies_ of a crate, so is more effective if This action only caches the _dependencies_ of a crate, so it is more effective if
the dependency / own code ratio is higher. the dependency / own code ratio is higher.
It is also most effective for repositories with a `Cargo.lock` file. Library It is also more effective for repositories with a `Cargo.lock` file. Library
repositories with only a `Cargo.toml` file have limited benefits, as cargo will repositories with only a `Cargo.toml` file have limited benefits, as cargo will
_always_ use the most up-to-date dependency versions, which may not be cached. _always_ use the most up-to-date dependency versions, which may not be cached.
Usage with Stable Rust is most effective, as a cache is tied to the Rust version. Usage with Stable Rust is the most effective, as a cache is tied to the Rust version.
Using it with Nightly Rust is less effective as it will throw away the cache every day, Using it with Nightly Rust is less effective as it will throw away the cache every day,
unless a specific nightly build is being pinned. unless a specific nightly build is being pinned.

View File

@@ -32,12 +32,16 @@ inputs:
description: "Determines which crates are cached. If `true` all crates will be cached, otherwise only dependent crates will be cached." description: "Determines which crates are cached. If `true` all crates will be cached, otherwise only dependent crates will be cached."
required: false required: false
default: "false" default: "false"
cache-workspace-crates:
description: "Similar to cache-all-crates. If `true` the workspace crates will be cached."
required: false
default: "false"
save-if: save-if:
description: "Determiners whether the cache should be saved. If `false`, the cache is only restored." description: "Determiners whether the cache should be saved. If `false`, the cache is only restored."
required: false required: false
default: "true" default: "true"
cache-provider: cache-provider:
description: "Determines which provider to use for caching. Options are github or buildjet, defaults to github." description: "Determines which provider to use for caching. Options are github, buildjet, or warpbuild. Defaults to github."
required: false required: false
default: "github" default: "github"
cache-bin: cache-bin:

138117
dist/restore/index.js vendored

File diff suppressed because one or more lines are too long

138122
dist/save/index.js vendored

File diff suppressed because one or more lines are too long

1370
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{ {
"private": true, "private": true,
"name": "rust-cache", "name": "rust-cache",
"version": "2.7.7", "version": "2.8.1",
"description": "A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.", "description": "A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.",
"keywords": [ "keywords": [
"actions", "actions",
@@ -23,18 +23,19 @@
"homepage": "https://github.com/Swatinem/rust-cache#readme", "homepage": "https://github.com/Swatinem/rust-cache#readme",
"dependencies": { "dependencies": {
"@actions/buildjet-cache": "npm:github-actions.cache-buildjet@0.2.0", "@actions/buildjet-cache": "npm:github-actions.cache-buildjet@0.2.0",
"@actions/cache": "^4.0.0", "@actions/warpbuild-cache": "npm:github-actions.warp-cache@1.4.7",
"@actions/cache": "^4.0.5",
"@actions/core": "^1.11.1", "@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@actions/glob": "^0.5.0", "@actions/glob": "^0.5.0",
"@actions/io": "^1.1.3", "@actions/io": "^1.1.3",
"smol-toml": "^1.3.0" "smol-toml": "^1.4.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^22.7.5", "@types/node": "^24.3.0",
"@vercel/ncc": "^0.38.2", "@vercel/ncc": "^0.38.3",
"linefix": "^0.1.1", "linefix": "^0.1.1",
"typescript": "5.7.2" "typescript": "5.9.2"
}, },
"scripts": { "scripts": {
"prepare": "ncc build --target es2020 -o dist/restore src/restore.ts && ncc build --target es2020 -o dist/save src/save.ts && linefix dist" "prepare": "ncc build --target es2020 -o dist/restore src/restore.ts && ncc build --target es2020 -o dist/save src/save.ts && linefix dist"

View File

@@ -74,9 +74,10 @@ export class CacheConfig {
} }
} }
// Add runner OS to the key to avoid cross-contamination of cache // Add runner OS and CPU architecture to the key to avoid cross-contamination of cache
const runnerOS = os.type(); const runnerOS = os.type();
key += `-${runnerOS}`; const runnerArch = os.arch();
key += `-${runnerOS}-${runnerArch}`;
self.keyPrefix = key; self.keyPrefix = key;

View File

@@ -36,9 +36,14 @@ async function run() {
await macOsWorkaround(); await macOsWorkaround();
} }
const workspaceCrates = core.getInput("cache-workspace-crates").toLowerCase() || "false";
const allPackages = []; const allPackages = [];
for (const workspace of config.workspaces) { for (const workspace of config.workspaces) {
const packages = await workspace.getPackagesOutsideWorkspaceRoot(); const packages = await workspace.getPackagesOutsideWorkspaceRoot();
if (workspaceCrates === "true") {
const wsMembers = await workspace.getWorkspaceMembers();
packages.push(...wsMembers);
}
allPackages.push(...packages); allPackages.push(...packages);
try { try {
core.info(`... Cleaning ${workspace.target} ...`); core.info(`... Cleaning ${workspace.target} ...`);

View File

@@ -1,6 +1,7 @@
import * as core from "@actions/core"; import * as core from "@actions/core";
import * as exec from "@actions/exec"; import * as exec from "@actions/exec";
import * as buildjetCache from "@actions/buildjet-cache"; import * as buildjetCache from "@actions/buildjet-cache";
import * as warpbuildCache from "@actions/warpbuild-cache";
import * as ghCache from "@actions/cache"; import * as ghCache from "@actions/cache";
import fs from "fs"; import fs from "fs";
@@ -44,17 +45,32 @@ export async function getCmdOutput(
return stdout; return stdout;
} }
export interface GhCache {
isFeatureAvailable: typeof ghCache.isFeatureAvailable;
restoreCache: typeof ghCache.restoreCache;
saveCache: (paths: string[], key: string) => Promise<string | number>;
}
export interface CacheProvider { export interface CacheProvider {
name: string; name: string;
cache: typeof ghCache; cache: GhCache;
} }
export function getCacheProvider(): CacheProvider { export function getCacheProvider(): CacheProvider {
const cacheProvider = core.getInput("cache-provider"); const cacheProvider = core.getInput("cache-provider");
const cache = cacheProvider === "github" ? ghCache : cacheProvider === "buildjet" ? buildjetCache : undefined; let cache: GhCache;
switch (cacheProvider) {
if (!cache) { case "github":
throw new Error(`The \`cache-provider\` \`{cacheProvider}\` is not valid.`); cache = ghCache;
break;
case "buildjet":
cache = buildjetCache;
break;
case "warpbuild":
cache = warpbuildCache;
break;
default:
throw new Error(`The \`cache-provider\` \`${cacheProvider}\` is not valid.`);
} }
return { return {

View File

@@ -15,6 +15,7 @@ export class Workspace {
const meta: Meta = JSON.parse( const meta: Meta = JSON.parse(
await getCmdOutput("cargo", ["metadata", "--all-features", "--format-version", "1", ...extraArgs], { await getCmdOutput("cargo", ["metadata", "--all-features", "--format-version", "1", ...extraArgs], {
cwd: this.root, cwd: this.root,
env: { "CARGO_ENCODED_RUSTFLAGS": "" },
}), }),
); );
core.debug(`workspace "${this.root}" has ${meta.packages.length} packages`); core.debug(`workspace "${this.root}" has ${meta.packages.length} packages`);

1393
tests/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,10 +8,10 @@ edition = "2021"
[dependencies] [dependencies]
reqwest = "0.12.1" reqwest = "0.12.1"
jsonpath_lib_polars_vendor = "0.0.1" jsonpath_lib_polars_vendor = "0.0.1"
watto = { git = "https://github.com/getsentry/watto", rev = "d71c8218506bddba102a124a460d64da25e303dc", features = ["strings"] } watto = { git = "https://github.com/getsentry/watto", rev = "39ccb9add289c1f23c89f40506f4a80b2f4011b9", features = ["strings"] }
[dev-dependencies] [dev-dependencies]
trybuild = "1" trybuild = "1"
[target.'cfg(not(target_env = "msvc"))'.dependencies] [target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = "0.5.4" tikv-jemallocator = "0.6.0"

View File

@@ -2,4 +2,4 @@ error[E0599]: no method named `foobar` found for reference `&'static str` in the
--> tests/trybuild/fail_to_compile.rs:2:14 --> tests/trybuild/fail_to_compile.rs:2:14
| |
2 | "foobar".foobar(); 2 | "foobar".foobar();
| ^^^^^^ method not found in `&str` | ^^^^^^ method not found in `&'static str`

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
[workspace] [workspace]
resolver = "2"
members = [ members = [
"crates/one", "crates/one",
"crates/two", "crates/two",

View File

@@ -5,7 +5,7 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
reqwest = "0.11.0" reqwest = "0.12"
async-std = "1" async-std = "1"
tracing = "0.1" tracing = "0.1"
tracing-futures = "0.2" tracing-futures = "0.2"

View File

@@ -5,4 +5,4 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
clap = "3" clap = "4"