Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Swatinem/rust-cache
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.5.1
Choose a base ref
...
head repository: Swatinem/rust-cache
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.6.0
Choose a head ref
  • 12 commits
  • 26 files changed
  • 2 contributors

Commits on Jul 31, 2023

  1. Update workflow definitions

    - Use rust `--no-self-update` flag instead of separate command.
    - Add an explicit test for the `git` registry, as the sparse registry is now the default.
    Swatinem committed Jul 31, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1e604af View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4fedae9 View commit details
  3. Copy the full SHA
    cf3f882 View commit details
  4. Copy the full SHA
    fd201ad View commit details
  5. Copy the full SHA
    9de8f90 View commit details

Commits on Aug 1, 2023

  1. Copy the full SHA
    b00faf5 View commit details

Commits on Aug 2, 2023

  1. Copy the full SHA
    e97a782 View commit details
  2. Improve errors and cleanup

    - Silence errors and do not create error annotations, fixes #144
    - Implement cleanup for new sparse registry
    - Do not clean `-sys` dependencies from `registry/src`, hopefully fixes  #150
    Swatinem committed Aug 2, 2023
    Copy the full SHA
    f6987ea View commit details
  3. Slightly improve docs

    Swatinem committed Aug 2, 2023
    Copy the full SHA
    3312b3a View commit details
  4. bump test dependencies

    Swatinem committed Aug 2, 2023
    Copy the full SHA
    5ec9842 View commit details
  5. Clean up credentials.toml

    Swatinem committed Aug 2, 2023
    Copy the full SHA
    80c47cc View commit details
  6. 2.6.0

    Swatinem committed Aug 2, 2023
    Copy the full SHA
    b8a6852 View commit details
32 changes: 32 additions & 0 deletions .github/workflows/buildjet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: buildjet

on: [push, pull_request]

jobs:
buildjet:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

name: Test buildjet provider on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

env:
CARGO_TERM_COLOR: always

steps:
- uses: actions/checkout@v3

- run: rustup toolchain install stable --profile minimal --no-self-update

- uses: ./
with:
workspaces: tests
cache-provider: buildjet

- run: |
cargo check
cargo test
cargo build --release
working-directory: tests
6 changes: 1 addition & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -18,11 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v3

# When rustup is updated, it tries to replace its binary, which on Windows is somehow locked.
# This can result in the CI failure, see: https://github.com/rust-lang/rustup/issues/3029
- run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal --component llvm-tools-preview
- run: rustup toolchain install stable --profile minimal --component llvm-tools-preview --no-self-update

- uses: taiki-e/install-action@cargo-llvm-cov

31 changes: 31 additions & 0 deletions .github/workflows/git-registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: git-registry

on: [push, pull_request]

jobs:
git-registry:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

name: Test cargo "git" registry on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git

steps:
- uses: actions/checkout@v3

- run: rustup toolchain install stable --profile minimal --no-self-update

- uses: ./
with:
workspaces: tests

- run: |
cargo check
cargo test
working-directory: tests
23 changes: 0 additions & 23 deletions .github/workflows/globbed-directories.yml

This file was deleted.

6 changes: 1 addition & 5 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
@@ -18,11 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v3

# When rustup is updated, it tries to replace its binary, which on Windows is somehow locked.
# This can result in the CI failure, see: https://github.com/rust-lang/rustup/issues/3029
- run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- run: rustup toolchain install stable --profile minimal --no-self-update

- uses: ./

9 changes: 3 additions & 6 deletions .github/workflows/simple.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

name: Test `cargo check/test` on ${{ matrix.os }}
name: Test `cargo check/test/build` on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

env:
@@ -18,11 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v3

# When rustup is updated, it tries to replace its binary, which on Windows is somehow locked.
# This can result in the CI failure, see: https://github.com/rust-lang/rustup/issues/3029
- run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- run: rustup toolchain install stable --profile minimal --no-self-update

- uses: ./
with:
@@ -31,4 +27,5 @@ jobs:
- run: |
cargo check
cargo test
cargo build --release
working-directory: tests
36 changes: 0 additions & 36 deletions .github/workflows/sparse-registry.yml

This file was deleted.

6 changes: 1 addition & 5 deletions .github/workflows/target-dir.yml
Original file line number Diff line number Diff line change
@@ -18,11 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v3

# When rustup is updated, it tries to replace its binary, which on Windows is somehow locked.
# This can result in the CI failure, see: https://github.com/rust-lang/rustup/issues/3029
- run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal
- run: rustup toolchain install stable --profile minimal --no-self-update

# the `workspaces` option has the format `$workspace -> $target-dir`
# and the `$target-dir` is relative to the `$workspace`.
6 changes: 1 addition & 5 deletions .github/workflows/workspaces.yml
Original file line number Diff line number Diff line change
@@ -18,11 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v3

# When rustup is updated, it tries to replace its binary, which on Windows is somehow locked.
# This can result in the CI failure, see: https://github.com/rust-lang/rustup/issues/3029
- run: |
rustup set auto-self-update disable
rustup toolchain install stable --profile minimal --target wasm32-unknown-unknown
- run: rustup toolchain install stable --profile minimal --target wasm32-unknown-unknown --no-self-update

- uses: ./
with:
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 2.6.0

- Add "buildjet" as a second `cache-provider` backend.
- Clean up sparse registry index.
- Do not clean up src of `-sys` crates.
- Remove `.cargo/credentials.toml` before saving.

## 2.5.1

- Fix hash contribution of `Cargo.lock`.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -62,9 +62,17 @@ sensible defaults.

# Determiners whether the cache should be saved.
# 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,
# or when only runs from `master` should be saved to the cache.
# default: "true"
save-if: ""
# To only cache runs from `master`:
save-if: ${{ github.ref == 'refs/head/master' }}

# Specifies what to use as the backend providing cache
# Can be set to either "github" or "buildjet"
# default: "github"
cache-provider: ""
```
Further examples are available in the [.github/workflows](./.github/workflows/) directory.
@@ -85,7 +93,8 @@ 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.

Usage with Stable Rust is 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.

## Cache Details

@@ -101,6 +110,7 @@ This cache is automatically keyed by:
- the value of some compiler-specific environment variables (eg. RUSTFLAGS, etc), and
- a hash of all `Cargo.lock` / `Cargo.toml` files found anywhere in the repository (if present).
- a hash of all `rust-toolchain` / `rust-toolchain.toml` files in the root of the repository (if present).
- a hash of all `.cargo/config.toml` files in the root of the repository (if present).

An additional input `key` can be provided if the builtin keys are not sufficient.

1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
- better .cargo/bin handling:
- get a list of all the files on "pre"/"restore"
- move the files out of the way on "post"/"save" and move them back afterwards
- properly clean sparse registry
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -36,6 +36,10 @@ inputs:
description: "Determiners whether the cache should be saved. If `false`, the cache is only restored."
required: false
default: "true"
cache-provider:
description: "Determines which provider to use for caching. Options are github or buildjet, defaults to github."
required: false
default: "github"
outputs:
cache-hit:
description: "A boolean value that indicates an exact match was found."
Loading