diff --git a/.forgejo/workflows/build-release.yml b/.forgejo/workflows/build-release.yml index f7c8b29..0c64943 100644 --- a/.forgejo/workflows/build-release.yml +++ b/.forgejo/workflows/build-release.yml @@ -21,7 +21,9 @@ jobs: path: | ~/.cargo/bin /tmp/zig - key: cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + key: cargo-tools-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + cargo-tools- - name: ๐Ÿฆ€ Install Rust toolchain uses: https://github.com/actions-rs/toolchain@v1 @@ -39,9 +41,31 @@ jobs: tar -Jxf zig-linux-x86_64.tar.xz -C /tmp/zig --strip-components=1 cargo install cargo-zigbuild + cargo-test: + name: ๐Ÿงช Run Cargo Tests + needs: setup + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ“ฅ Checkout source + uses: https://github.com/actions/checkout@v4 + + - name: ๐Ÿ—„๏ธ Restore Cargo cache + uses: https://github.com/actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + cargo- + + - name: ๐Ÿš€ Run tests + run: cargo test --release + build: name: ๐Ÿ—๏ธ Build ${{ matrix.target }} - needs: setup + needs: [setup, cargo-test] runs-on: ubuntu-latest strategy: fail-fast: false @@ -71,7 +95,9 @@ jobs: path: | ~/.cargo/bin /tmp/zig - key: cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + key: cargo-tools-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + cargo-tools- - name: ๐Ÿ“ Add Zig to PATH run: echo "/tmp/zig" >> $GITHUB_PATH @@ -90,9 +116,9 @@ jobs: ~/.cargo/registry ~/.cargo/git target - key: cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + key: cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - cargo-${{ matrix.target }}- + cargo- - name: ๐Ÿš€ Build release binary run: cargo zigbuild --target ${{ matrix.target }} --release