2025-04-18 23:59:21 -04:00
|
|
|
name: Build Zenyx ⚡
|
2025-04-18 16:44:52 -04:00
|
|
|
|
2025-04-18 23:59:21 -04:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
2025-04-18 16:44:52 -04:00
|
|
|
|
2025-04-18 23:59:21 -04:00
|
|
|
jobs:
|
2025-04-19 00:00:46 -04:00
|
|
|
setup:
|
|
|
|
name: 🔧 Setup Environment
|
2025-04-18 23:59:21 -04:00
|
|
|
runs-on: ubuntu-latest
|
2025-04-19 00:00:46 -04:00
|
|
|
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
|
2025-04-20 18:26:14 -04:00
|
|
|
key: cargo-tools-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
cargo-tools-
|
2025-04-18 23:22:32 -04:00
|
|
|
|
2025-04-19 00:00:46 -04:00
|
|
|
- name: 🦀 Install Rust toolchain
|
2025-04-21 17:38:19 -04:00
|
|
|
if: steps.cache-tools.outputs.cache-hit != 'true'
|
2025-04-19 00:00:46 -04:00
|
|
|
uses: https://github.com/actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
components: rust-src
|
|
|
|
override: true
|
|
|
|
|
2025-04-21 17:38:19 -04:00
|
|
|
- name: 📦 Install Build Tools
|
2025-04-19 00:00:46 -04:00
|
|
|
if: steps.cache-tools.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
|
|
|
mkdir -p /tmp/zig
|
2025-04-20 15:24:14 -04:00
|
|
|
cd /tmp/zig
|
2025-04-20 15:28:27 -04:00
|
|
|
curl -Lo zig-linux-x86_64.tar.xz https://ziglang.org/builds/zig-linux-x86_64-0.15.0-dev.377+f01833e03.tar.xz
|
2025-04-20 15:32:42 -04:00
|
|
|
tar -Jxf zig-linux-x86_64.tar.xz -C /tmp/zig --strip-components=1
|
2025-04-21 17:38:19 -04:00
|
|
|
cargo install cargo-zigbuild cargo-xwin --force
|
2025-04-19 00:00:46 -04:00
|
|
|
|
2025-04-20 18:26:14 -04:00
|
|
|
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: 🦀 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
|
|
|
|
|
2025-04-21 17:38:19 -04:00
|
|
|
- name: 🌋 Install Vulkan tools
|
2025-04-20 18:26:14 -04:00
|
|
|
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
|
|
|
|
|
2025-04-19 00:00:46 -04:00
|
|
|
build:
|
|
|
|
name: 🏗️ Build ${{ matrix.target }}
|
2025-04-20 18:26:14 -04:00
|
|
|
needs: [setup, cargo-test]
|
2025-04-19 00:00:46 -04:00
|
|
|
runs-on: ubuntu-latest
|
2025-04-18 23:59:21 -04:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2025-04-19 00:00:46 -04:00
|
|
|
target:
|
|
|
|
- x86_64-unknown-linux-gnu
|
|
|
|
- aarch64-unknown-linux-gnu
|
2025-04-21 17:38:19 -04:00
|
|
|
- x86_64-pc-windows-msvc
|
2025-04-18 23:59:21 -04:00
|
|
|
include:
|
|
|
|
- target: x86_64-unknown-linux-gnu
|
|
|
|
binary_name: zenyx-x86_64-linux
|
|
|
|
ext: ""
|
2025-04-21 17:38:19 -04:00
|
|
|
command: zigbuild
|
|
|
|
args: --target x86_64-unknown-linux-gnu --release
|
2025-04-18 23:59:21 -04:00
|
|
|
- target: aarch64-unknown-linux-gnu
|
|
|
|
binary_name: zenyx-aarch64-linux
|
|
|
|
ext: ""
|
2025-04-21 17:38:19 -04:00
|
|
|
command: zigbuild
|
|
|
|
args: --target aarch64-unknown-linux-gnu --release
|
|
|
|
- target: x86_64-pc-windows-msvc
|
|
|
|
binary_name: zenyx-x86_64-windows-msvc.exe
|
|
|
|
ext: ".exe"
|
|
|
|
command: xwin
|
|
|
|
args: build --target x86_64-pc-windows-msvc --release
|
2025-04-18 16:44:52 -04:00
|
|
|
|
2025-04-18 23:59:21 -04:00
|
|
|
steps:
|
|
|
|
- name: 📥 Checkout source
|
|
|
|
uses: https://github.com/actions/checkout@v4
|
2025-04-18 16:44:52 -04:00
|
|
|
|
2025-04-19 00:00:46 -04:00
|
|
|
- name: 🗄️ Restore tool cache
|
2025-04-18 23:59:21 -04:00
|
|
|
uses: https://github.com/actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: |
|
2025-04-19 00:00:46 -04:00
|
|
|
~/.cargo/bin
|
|
|
|
/tmp/zig
|
2025-04-20 18:26:14 -04:00
|
|
|
key: cargo-tools-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
cargo-tools-
|
|
|
|
|
2025-04-18 23:06:10 -04:00
|
|
|
|
2025-04-19 00:00:46 -04:00
|
|
|
- name: 📍 Add Zig to PATH
|
|
|
|
run: echo "/tmp/zig" >> $GITHUB_PATH
|
|
|
|
|
|
|
|
- name: 🎯 Install Rust target
|
2025-04-18 23:59:21 -04:00
|
|
|
uses: https://github.com/actions-rs/toolchain@v1
|
|
|
|
with:
|
2025-04-19 00:00:46 -04:00
|
|
|
toolchain: stable
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
override: true
|
2025-04-18 16:44:52 -04:00
|
|
|
|
2025-04-19 00:00:46 -04:00
|
|
|
- name: 🗄️ Restore Cargo cache
|
|
|
|
uses: https://github.com/actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
2025-04-20 18:26:14 -04:00
|
|
|
key: cargo-${{ hashFiles('**/Cargo.lock') }}
|
2025-04-19 00:00:46 -04:00
|
|
|
restore-keys: |
|
2025-04-20 18:26:14 -04:00
|
|
|
cargo-
|
2025-04-21 17:38:19 -04:00
|
|
|
- name: 🌋 Install Vulkan tools
|
2025-04-20 18:26:14 -04:00
|
|
|
run: |
|
|
|
|
apt update
|
|
|
|
apt install -y vulkan-tools glslc
|
2025-04-18 16:44:52 -04:00
|
|
|
|
2025-04-19 00:00:46 -04:00
|
|
|
- name: 🚀 Build release binary
|
2025-04-20 18:26:14 -04:00
|
|
|
uses: https://github.com/actions-rs/cargo@v1
|
|
|
|
with:
|
2025-04-21 17:38:19 -04:00
|
|
|
command: ${{ matrix.command }}
|
|
|
|
args: ${{ matrix.args }}
|
2025-04-18 16:44:52 -04:00
|
|
|
|
2025-04-18 23:59:21 -04:00
|
|
|
- name: 📦 Package artifact
|
2025-04-19 00:00:46 -04:00
|
|
|
run: |
|
|
|
|
mkdir -p artifacts
|
|
|
|
cp target/${{ matrix.target }}/release/zenyx${{ matrix.ext }} artifacts/${{ matrix.binary_name }}
|
2025-04-18 16:44:52 -04:00
|
|
|
|
2025-04-18 23:59:21 -04:00
|
|
|
- name: ⬆️ Upload artifact
|
|
|
|
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
|
|
|
with:
|
2025-04-20 18:26:14 -04:00
|
|
|
name: ${{ matrix.binary_name }}.zip
|
|
|
|
path: artifacts
|