zenyx-engine/.forgejo/workflows/build-release.yml
Chance 17d8bec181
All checks were successful
Build Zenyx ⚡ / 🔧 Setup Environment (push) Successful in 36s
Build Zenyx ⚡ / 🧪 Run Cargo Tests (push) Successful in 57s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (push) Successful in 5m7s
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (push) Successful in 5m9s
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (pull_request) Successful in 4m32s
Build Zenyx ⚡ / 🔧 Setup Environment (pull_request) Successful in 34s
Build Zenyx ⚡ / 🧪 Run Cargo Tests (pull_request) Successful in 1m9s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (pull_request) Successful in 3m12s
fix(ci): caching and vulkan builds, add tests
2025-04-21 17:08:22 -04:00

164 lines
No EOL
4.6 KiB
YAML

name: Build Zenyx ⚡
on:
push:
pull_request:
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
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
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
build:
name: 🏗️ Build ${{ matrix.target }}
needs: [setup, cargo-test]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
# - x86_64-pc-windows-msvc
include:
- target: x86_64-unknown-linux-gnu
binary_name: zenyx-x86_64-linux
ext: ""
- 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"
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
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
- 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
- name: ⬆️ Upload artifact
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: ${{ matrix.binary_name }}.zip
path: artifacts