Compare commits

...

3 Commits

Author SHA1 Message Date
Jason Orendorff
228dcc700d
Merge 8645982dff into 8469c94c6a 2024-10-09 10:47:51 +02:00
Jan T. Sott
8469c94c6a
Add Bun example (#1456)
* Add Bun example

* Fix Bun Windows example
2024-10-08 19:53:09 +00:00
Jason Orendorff
8645982dff rust-toolchain.toml and incremental build example
Changes to rust-toolchain.toml should invalidate the cache.
Also, add an example with incremental builds.
2023-06-12 11:14:05 -05:00
2 changed files with 42 additions and 1 deletions

View File

@ -157,6 +157,7 @@ Every programming language and framework has its own way of caching.
See [Examples](examples.md) for a list of `actions/cache` implementations for use with:
* [Bun](./examples.md#bun)
* [C# - NuGet](./examples.md#c---nuget)
* [Clojure - Lein Deps](./examples.md#clojure---lein-deps)
* [D - DUB](./examples.md#d---dub)

View File

@ -1,5 +1,6 @@
# Examples
- [Bun](#bun)
- [C# - NuGet](#c---nuget)
- [Clojure - Lein Deps](#clojure---lein-deps)
- [D - DUB](#d---dub)
@ -41,6 +42,26 @@
- [Swift - Mint](#swift---mint)
- [* - Bazel](#---bazel)
## Bun
```yaml
- uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
```
### Windows
```yaml
- uses: actions/cache@v4
with:
path: |
~\.bun
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
```
## C# - NuGet
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
@ -597,7 +618,26 @@ whenever possible:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}
```
Since Rust compile times are so long, you might want to take advantage of incremental builds. To do this, use the configuration below.
- Include the `run_id` in the key to force `actions/cache` to upload a new snapshot after every build.
- Use `restore-keys:` to load the previous build (when there are multiple partial matches, it selects the most recent).
```yaml
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.rustup/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles(**/'Cargo.lock', 'rust-toolchain.toml') }}
```
## Scala - SBT