zenyx-engine/.forgejo/workflows/build-release.yml

91 lines
2.5 KiB
YAML
Raw Normal View History

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: |
2025-04-19 00:05:31 -04:00
~/.cargo/registry
~/.cargo/git
target
key: tools-v1-${{ hashFiles('**/Cargo.lock') }}
2025-04-18 23:22:32 -04:00
- name: 🦀 Install Rust toolchain
uses: https://github.com/actions-rs/toolchain@v1
with:
toolchain: stable
components: rust-src
override: true
build:
name: 🏗️ Build ${{ matrix.target }}
needs: setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
2025-04-19 00:05:31 -04:00
image: messense/cargo-zigbuild:latest
binary_name: zenyx-x86_64-linux
ext: ""
2025-04-19 00:05:31 -04:00
- target: aarch64-unknown-linux-gnu
2025-04-19 00:05:31 -04:00
image: messense/cargo-zigbuild:latest
binary_name: zenyx-aarch64-linux
ext: ""
2025-04-19 00:05:31 -04:00
- target: x86_64-pc-windows-msvc
2025-04-19 00:05:31 -04:00
image: messense/cargo-xwin:latest
binary_name: zenyx-x86_64-windows-msvc.exe
ext: ".exe"
2025-04-19 00:05:31 -04:00
container: ${{ matrix.image }}
steps:
- name: 📥 Checkout source
uses: https://github.com/actions/checkout@v4
- name: 🗄️ Restore Cargo cache
uses: https://github.com/actions/cache@v4
with:
path: |
2025-04-19 00:05:31 -04:00
/usr/local/cargo/registry
/usr/local/cargo/git
target
key: cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-${{ matrix.target }}-
- name: 🚀 Build release binary
2025-04-19 00:05:31 -04:00
run: |
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
cargo xwin build --target ${{ matrix.target }} --release
else
cargo zigbuild --target ${{ matrix.target }} --release
fi
- name: 📦 Package artifact
run: |
mkdir -p artifacts
cp target/${{ matrix.target }}/release/zenyx${{ matrix.ext }} artifacts/${{ matrix.binary_name }}
- name: ⬆️ Upload artifact
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: ${{ matrix.binary_name }}
path: artifacts/${{ matrix.binary_name }}