zenyx-engine/.forgejo/workflows/rust.yml

85 lines
No EOL
2.7 KiB
YAML

name: Build Zenyx ⚡
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-pc-windows-gnu
- aarch64-apple-darwin
include:
- target: x86_64-unknown-linux-gnu
binary_name: zenyx-x86_64-linux
deps: libwayland-dev wayland-protocols
pkg_config: ""
triple: x86_64-linux-gnu
- target: aarch64-unknown-linux-gnu
binary_name: zenyx-aarch64-linux
deps: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libwayland-dev:arm64 wayland-protocols
pkg_config: aarch64-linux-gnu-pkg-config
triple: aarch64-linux-gnu
- target: x86_64-pc-windows-gnu
binary_name: zenyx-x86_64-windows.exe
deps: mingw-w64
pkg_config: x86_64-w64-mingw32-pkg-config
triple: x86_64-w64-mingw32
runs-on: ubuntu-latest
steps:
- name: 📥 Clone repository
uses: actions/checkout@v4
- name: 🛠️ Install dependencies
run: |
apt-get update
apt-get install -y \
${{ matrix.deps }} \
pkg-config \
${{ matrix.pkg_config }}
- name: 🔧 Setup pkg-config
if: matrix.pkg_config != ''
run: |
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/usr/lib/${{ matrix.triple }}/pkgconfig" >> $GITHUB_ENV
echo "PKG_CONFIG_SYSROOT_DIR=/usr/${{ matrix.triple }}" >> $GITHUB_ENV
- name: 🦀 Install Rust target
uses: https://github.com/actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: 🏗️ Build
uses: https://github.com/actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
env:
CARGO_TARGET_${{ matrix.target }}_LINKER: ${{ matrix.triple }}-gcc
PKG_CONFIG_ALLOW_CROSS: 1
PKG_CONFIG_PATH: /usr/lib/${{ matrix.triple }}/pkgconfig
PKG_CONFIG_SYSROOT_DIR: /usr/${{ matrix.triple }}
- name: 📦 Package artifact
run: |
mkdir -p artifacts
cp target/${{ matrix.target }}/release/zenyx* artifacts/${{ matrix.binary_name }}
chmod +x 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 }}