From 61b75049bd2a9d2bcf5a46e1659a953c8641bc8b Mon Sep 17 00:00:00 2001 From: asonix Date: Wed, 7 Feb 2024 15:45:31 -0600 Subject: [PATCH] Try to cache rust --- .forgejo/workflows/check.yaml | 60 +++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/.forgejo/workflows/check.yaml b/.forgejo/workflows/check.yaml index fcae97e..7574aae 100644 --- a/.forgejo/workflows/check.yaml +++ b/.forgejo/workflows/check.yaml @@ -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 }}