Try to cache rust

This commit is contained in:
asonix 2024-02-07 15:45:31 -06:00
parent 673b76499e
commit 61b75049bd

View file

@ -5,7 +5,40 @@ on:
- main
jobs:
cache-rust:
runs-on: docker
container:
image: docker.io/node:20-bookworm
steps:
-
name: Install rustup and rust
id: rust
uses: https://github.com/dtolnay/rust-toolchain@1.75.0
with:
components: clippy
targets: x86_64-unknown-linux-musl,armv7-unknown-linux-musleabihf,aarch64-unknown-linux-musl
-
name: Install cargo-binstall
uses: https://github.com/taiki-e/install-action@v2
with:
tool: cargo-binstall
-
name: Install cargo-zigbuild
run: yes | cargo binstall cargo-zigbuild
-
name: Populate rust cache
uses: https://github.com/actions/cache/save@v4
with:
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
~/.rustup
key: ${{ runner.os }}-cargo-${{ steps.rust.outputs.cacheKey }}
clippy:
needs: [cache-rust]
runs-on: docker
container:
image: docker.io/node:20-bookworm
@ -14,10 +47,15 @@ jobs:
name: Checkout pict-rs
uses: https://github.com/actions/checkout@v4
-
name: Install rustup and rust
uses: https://github.com/dtolnay/rust-toolchain@1.75.0
name: Fetch rust cache
uses: https://github.com/actions/cache/restore@v4
with:
components: clippy
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
~/.rustup
key: ${{ runner.os }}-cargo-${{ jobs.cache-rust.steps.rust.outputs.cacheKey }}
-
name: Clippy
run: |
@ -25,6 +63,7 @@ jobs:
cargo clippy --no-default-features --features io-uring -- -D warnings
tests:
needs: [cache-rust]
runs-on: docker
container:
image: docker.io/node:20-bookworm
@ -40,6 +79,7 @@ jobs:
run: cargo test
check:
needs: [cache-rust]
strategy:
matrix:
target:
@ -54,10 +94,15 @@ jobs:
name: Checkout pict-rs
uses: https://github.com/actions/checkout@v4
-
name: Install rustup and rust
uses: https://github.com/dtolnay/rust-toolchain@1.75.0
name: Fetch rust cache
uses: https://github.com/actions/cache/restore@v4
with:
targets: ${{ matrix.target }}
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
~/.rustup
key: ${{ runner.os }}-cargo-${{ jobs.cache-rust.steps.rust.outputs.cacheKey }}
-
name: Install cargo-binstall
uses: https://github.com/taiki-e/install-action@v2
@ -68,9 +113,6 @@ jobs:
uses: https://github.com/goto-bus-stop/setup-zig@v2
with:
version: 0.11.0
-
name: Install cargo-zigbuild
run: yes | cargo binstall cargo-zigbuild
-
name: Debug builds
run: cargo zigbuild --target ${{ matrix.target }}