2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-01 18:19:56 +00:00
pict-rs/.forgejo/actions/prepare-rust/action.yaml

71 lines
1.9 KiB
YAML
Raw Normal View History

2024-02-07 22:27:23 +00:00
name: Prepare Rust
description: Prepare an environment to build or test rust packages
inputs:
targets:
description: "Targets to add to rustup, comma separated"
required: false
default: ''
runs:
using: "composite"
steps:
-
name: Fetch rust cache
id: cache
uses: https://github.com/actions/cache/restore@v4
with:
2024-02-07 22:31:01 +00:00
path: |
2024-02-07 22:27:23 +00:00
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
~/.rustup
target/
key: rust-${{ inputs.targets }}-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('Cargo.lock')}}
-
name: Install rustup and rust
if: steps.cache.outputs.cache-hit != 'true'
uses: https://github.com/dtolnay/rust-toolchain@1.75.0
with:
components: clippy
2024-02-07 22:33:26 +00:00
targets: ${{ inputs.targets }}
2024-02-07 22:27:23 +00:00
-
name: Install cargo-binstall
if: steps.cache.outputs.cache-hit != 'true'
uses: https://github.com/taiki-e/install-action@v2
with:
tool: cargo-binstall
-
name: Install cargo-zigbuild
2024-02-07 22:45:12 +00:00
if: steps.cache.outputs.cache-hit != 'true'
2024-02-07 22:27:23 +00:00
run: yes | cargo binstall cargo-zigbuild
2024-02-07 22:45:12 +00:00
-
name: Check
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "GOT HERE"
which cargo
2024-02-07 22:27:23 +00:00
-
name: Fetch dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: cargo fetch
-
name: Export path
if: steps.cache.outputs.cache-hit == 'true'
run: |
export PATH=$PATH:$HOME/.cargo/bin
export PATH=$PATH:$HOME/.rustup/bin
-
name: Populate rust cache
2024-02-07 22:39:53 +00:00
uses: https://github.com/actions/cache/save@v4
2024-02-07 22:27:23 +00:00
with:
2024-02-07 22:31:01 +00:00
path: |
2024-02-07 22:27:23 +00:00
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
~/.rustup
target/
key: ${{ steps.cache.outputs.cache-primary-key }}