Add action to populate and save rust dependencies

This commit is contained in:
asonix 2024-02-08 15:30:20 -06:00
commit 20293e3263

View file

@ -0,0 +1,32 @@
name: Cache Rust Dependencies
description: Fetch and Cache rust dependencies
runs:
using: "composite"
steps:
-
name: Fetch rust cache
id: cache
uses: https://github.com/actions/cache/restore@v4
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
target/
key: cargo-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock') }}
-
name: Fetch dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: cargo fetch
-
name: Populate rust cache
if: steps.cache.outputs.cache-hit != 'true'
uses: https://github.com/actions/cache/save@v4
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
target/
key: ${{ steps.cache.outputs.cache-primary-key }}