From 25bbbd0d04b2d7d5b2811f435141c9c38716e272 Mon Sep 17 00:00:00 2001 From: Chance Date: Sat, 19 Apr 2025 00:05:31 -0400 Subject: [PATCH] wip: fix workflow --- .forgejo/workflows/build-release.yml | 56 ++++++++++++++++------------ 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/.forgejo/workflows/build-release.yml b/.forgejo/workflows/build-release.yml index e3d7f9e..49b30ed 100644 --- a/.forgejo/workflows/build-release.yml +++ b/.forgejo/workflows/build-release.yml @@ -14,6 +14,14 @@ jobs: - name: 📥 Checkout source uses: https://github.com/actions/checkout@v4 + - name: 🦀 Install Rust toolchain + uses: https://github.com/actions-rs/toolchain@v1 + with: + toolchain: stable + components: rust-src + override: true + profile: minimal + - name: 🗄️ Cache tools uses: https://github.com/actions/cache@v4 id: cache-tools @@ -21,22 +29,16 @@ jobs: path: | ~/.cargo/bin /tmp/zig - key: tools-v1-${{ hashFiles('**/Cargo.lock') }} + /tmp/xwin + key: tools-v3-${{ hashFiles('**/Cargo.lock') }} - - name: 🦀 Install Rust toolchain - uses: https://github.com/actions-rs/toolchain@v1 - with: - toolchain: stable - components: rust-src - override: true - - - name: 📦 Install Zig and cargo-zigbuild + - name: 🔧 Install build tools if: steps.cache-tools.outputs.cache-hit != 'true' run: | - mkdir -p /tmp/zig + mkdir -p /tmp/zig /tmp/xwin + curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash + cargo binstall -y cargo-zigbuild cargo-xwin --no-confirm curl -L https://ziglang.org/builds/zig-linux-x86_64-0.11.0.tar.xz | tar -xJ -C /tmp/zig --strip-components=1 - curl -L https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash - cargo binstall -y cargo-zigbuild build: name: 🏗️ Build ${{ matrix.target }} @@ -64,23 +66,24 @@ jobs: - name: 📥 Checkout source uses: https://github.com/actions/checkout@v4 - - name: 🗄️ Restore tool cache + - name: 🛠️ Restore tool cache uses: https://github.com/actions/cache@v4 with: path: | ~/.cargo/bin /tmp/zig - key: tools-v1-${{ hashFiles('**/Cargo.lock') }} + /tmp/xwin + key: tools-v3-${{ hashFiles('**/Cargo.lock') }} - - name: 📍 Add Zig to PATH - run: echo "/tmp/zig" >> $GITHUB_PATH - - - name: 🎯 Install Rust target + - name: 📍 Add tools to PATH uses: https://github.com/actions-rs/toolchain@v1 with: - toolchain: stable + path: ~/.cargo/bin:/tmp/zig + + - name: 🎯 Install Rust target + uses: https://github.com/actions-rs/target@v1 + with: target: ${{ matrix.target }} - override: true - name: 🗄️ Restore Cargo cache uses: https://github.com/actions/cache@v4 @@ -93,10 +96,17 @@ jobs: restore-keys: | cargo-${{ matrix.target }}- - - name: 🚀 Build release binary - run: cargo zigbuild --target ${{ matrix.target }} --release + - name: 🚀 Build project + uses: https://github.com/actions-rs/cargo@v1 + with: + command: ${{ contains(matrix.target, 'windows') && 'xwin' || 'zigbuild' }} + args: build --target ${{ matrix.target }} --release - name: 📦 Package artifact + uses: https://github.com/actions-rs/clippy-check@v1 + with: + name: ${{ matrix.binary_name }} + path: artifacts/${{ matrix.binary_name }} run: | mkdir -p artifacts cp target/${{ matrix.target }}/release/zenyx${{ matrix.ext }} artifacts/${{ matrix.binary_name }} @@ -105,4 +115,4 @@ jobs: uses: https://code.forgejo.org/forgejo/upload-artifact@v4 with: name: ${{ matrix.binary_name }} - path: artifacts/${{ matrix.binary_name }} \ No newline at end of file + path: artifacts/${{ matrix.binary_name }}