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 - main
jobs: 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: clippy:
needs: [cache-rust]
runs-on: docker runs-on: docker
container: container:
image: docker.io/node:20-bookworm image: docker.io/node:20-bookworm
@ -14,10 +47,15 @@ jobs:
name: Checkout pict-rs name: Checkout pict-rs
uses: https://github.com/actions/checkout@v4 uses: https://github.com/actions/checkout@v4
- -
name: Install rustup and rust name: Fetch rust cache
uses: https://github.com/dtolnay/rust-toolchain@1.75.0 uses: https://github.com/actions/cache/restore@v4
with: 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 name: Clippy
run: | run: |
@ -25,6 +63,7 @@ jobs:
cargo clippy --no-default-features --features io-uring -- -D warnings cargo clippy --no-default-features --features io-uring -- -D warnings
tests: tests:
needs: [cache-rust]
runs-on: docker runs-on: docker
container: container:
image: docker.io/node:20-bookworm image: docker.io/node:20-bookworm
@ -40,6 +79,7 @@ jobs:
run: cargo test run: cargo test
check: check:
needs: [cache-rust]
strategy: strategy:
matrix: matrix:
target: target:
@ -54,10 +94,15 @@ jobs:
name: Checkout pict-rs name: Checkout pict-rs
uses: https://github.com/actions/checkout@v4 uses: https://github.com/actions/checkout@v4
- -
name: Install rustup and rust name: Fetch rust cache
uses: https://github.com/dtolnay/rust-toolchain@1.75.0 uses: https://github.com/actions/cache/restore@v4
with: 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 name: Install cargo-binstall
uses: https://github.com/taiki-e/install-action@v2 uses: https://github.com/taiki-e/install-action@v2
@ -68,9 +113,6 @@ jobs:
uses: https://github.com/goto-bus-stop/setup-zig@v2 uses: https://github.com/goto-bus-stop/setup-zig@v2
with: with:
version: 0.11.0 version: 0.11.0
-
name: Install cargo-zigbuild
run: yes | cargo binstall cargo-zigbuild
- -
name: Debug builds name: Debug builds
run: cargo zigbuild --target ${{ matrix.target }} run: cargo zigbuild --target ${{ matrix.target }}