From 2d704652b542af4054a80e6e0d7fb9d87d00247a Mon Sep 17 00:00:00 2001 From: BitSyndicate Date: Tue, 22 Apr 2025 21:59:46 +0200 Subject: [PATCH] fix(ci): add windows and broken macOS builds --- .forgejo/workflows/build-release.yml | 169 ++++++++------------------- 1 file changed, 49 insertions(+), 120 deletions(-) diff --git a/.forgejo/workflows/build-release.yml b/.forgejo/workflows/build-release.yml index 5ef6aba..91efadd 100644 --- a/.forgejo/workflows/build-release.yml +++ b/.forgejo/workflows/build-release.yml @@ -3,162 +3,91 @@ name: Build Zenyx โšก on: push: pull_request: + types: [opened, synchronize, reopened] jobs: - setup: - name: ๐Ÿ”ง Setup Environment - runs-on: ubuntu-latest - outputs: - cache-hit: ${{ steps.cache-tools.outputs.cache-hit }} - steps: - - name: ๐Ÿ“ฅ Checkout source - uses: https://github.com/actions/checkout@v4 - - - name: ๐Ÿ—„๏ธ Cache tools - uses: https://github.com/actions/cache@v4 - id: cache-tools - with: - path: | - ~/.cargo/bin - /tmp/zig - key: cargo-tools-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - cargo-tools- - - - 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 - if: steps.cache-tools.outputs.cache-hit != 'true' - run: | - mkdir -p /tmp/zig - cd /tmp/zig - curl -Lo zig-linux-x86_64.tar.xz https://ziglang.org/builds/zig-linux-x86_64-0.15.0-dev.377+f01833e03.tar.xz - 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 + runs-on: nixos-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: ๐Ÿฆ€ Install Rust toolchain - if: steps.restore-cargo-cache.outputs.cache-hit != 'true' - uses: https://github.com/actions-rs/toolchain@v1 - with: - toolchain: stable - components: rust-src - override: true - - - name: ๐Ÿฆ€ Install Vulkan tools + - name: ๐Ÿš€ Setup & Run tests run: | - apt update - apt install -y vulkan-tools glslc - - - - name: ๐Ÿš€ Run tests - uses: https://github.com/actions-rs/cargo@v1 - with: - command: test - args: --release --all + nix-shell --run " + git-lfs fetch + git-lfs pull + cargo test --release --all + " build: name: ๐Ÿ—๏ธ Build ${{ matrix.target }} - needs: [setup, cargo-test] - runs-on: ubuntu-latest + needs: [cargo-test] + runs-on: nixos-latest strategy: fail-fast: false matrix: target: - x86_64-unknown-linux-gnu + - x86_64-pc-windows-msvc + - x86_64-apple-darwin - aarch64-unknown-linux-gnu - # - x86_64-pc-windows-msvc + - aarch64-pc-windows-msvc + - aarch64-apple-darwin include: - target: x86_64-unknown-linux-gnu binary_name: zenyx-x86_64-linux ext: "" + command: zigbuild + args: --target x86_64-unknown-linux-gnu --release - target: aarch64-unknown-linux-gnu binary_name: zenyx-aarch64-linux ext: "" - # - target: x86_64-pc-windows-msvc - # binary_name: zenyx-x86_64-windows-msvc.exe - # ext: ".exe" + command: zigbuild + args: --target aarch64-unknown-linux-gnu --release + - target: x86_64-pc-windows-msvc + binary_name: zenyx-x86_64-windows + ext: ".exe" + command: xwin build + args: --target x86_64-pc-windows-msvc --release + - target: aarch64-pc-windows-msvc + binary_name: zenyx-aarch64-windows + ext: ".exe" + command: xwin build + args: --target aarch64-pc-windows-msvc --release + - target: x86_64-apple-darwin + binary_name: zenyx-x86_64-macos + ext: "" + command: zigbuild + args: --target x86_64-apple-darwin --release + - target: aarch64-apple-darwin + binary_name: zenyx-aarch64-macos + ext: "" + command: zigbuild + args: --target aarch64-apple-darwin --release steps: - name: ๐Ÿ“ฅ Checkout source uses: https://github.com/actions/checkout@v4 - - name: ๐Ÿ—„๏ธ Restore tool cache - uses: https://github.com/actions/cache@v4 - with: - path: | - ~/.cargo/bin - /tmp/zig - key: cargo-tools-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - cargo-tools- - - - - name: ๐Ÿ“ Add Zig to PATH - run: echo "/tmp/zig" >> $GITHUB_PATH - - - name: ๐ŸŽฏ Install Rust target - uses: https://github.com/actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.target }} - override: true - - - 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: ๐Ÿฆ€ Install Vulkan tools + - name: ๐Ÿš€ Install Target & Build release binary run: | - apt update - apt install -y vulkan-tools glslc - - - name: ๐Ÿš€ Build release binary - uses: https://github.com/actions-rs/cargo@v1 - with: - command: zigbuild - args: --target ${{ matrix.target }} --release + nix-shell --run " + git-lfs fetch --all + git-lfs pull + cargo ${{ matrix.command }} ${{ matrix.args }} + " - name: ๐Ÿ“ฆ Package artifact run: | mkdir -p artifacts - cp target/${{ matrix.target }}/release/zenyx${{ matrix.ext }} artifacts/${{ matrix.binary_name }} - ls - du -sh artifacts - ls -lah artifacts - ls -lah target/${{ matrix.target }}/release + cp target/${{ matrix.target }}/release/zenyx${{ matrix.ext }} artifacts/${{ matrix.binary_name }}${{ matrix.ext }} - name: โฌ†๏ธ Upload artifact uses: https://code.forgejo.org/forgejo/upload-artifact@v4 with: - name: ${{ matrix.binary_name }}.zip - path: artifacts \ No newline at end of file + name: ${{ matrix.binary_name }}${{ matrix.ext }}.zip + path: artifacts/${{ matrix.binary_name }}${{ matrix.ext }} + compression-level: 9 + if-no-files-found: error \ No newline at end of file