feat:rework ci/cd to use cargo-cross
This commit is contained in:
parent
655a5607fe
commit
2aa5f2157a
1 changed files with 18 additions and 46 deletions
|
@ -2,15 +2,15 @@ name: Build Zenyx ⚡
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
pull_request:
|
pull_request:
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build ${{ matrix.target }}
|
name: Build ${{ matrix.target }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
target:
|
target:
|
||||||
- x86_64-unknown-linux-gnu
|
- x86_64-unknown-linux-gnu
|
||||||
- aarch64-unknown-linux-gnu
|
- aarch64-unknown-linux-gnu
|
||||||
- x86_64-pc-windows-gnu
|
- x86_64-pc-windows-gnu
|
||||||
|
@ -18,71 +18,43 @@ jobs:
|
||||||
include:
|
include:
|
||||||
- target: x86_64-unknown-linux-gnu
|
- target: x86_64-unknown-linux-gnu
|
||||||
binary_name: zenyx-x86_64-linux
|
binary_name: zenyx-x86_64-linux
|
||||||
deps: libwayland-dev wayland-protocols
|
ext: ""
|
||||||
pkg_config: ""
|
|
||||||
triple: x86_64-linux-gnu
|
|
||||||
binary_extension: ""
|
|
||||||
|
|
||||||
- target: aarch64-unknown-linux-gnu
|
- target: aarch64-unknown-linux-gnu
|
||||||
binary_name: zenyx-aarch64-linux
|
binary_name: zenyx-aarch64-linux
|
||||||
deps: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libwayland-dev:arm64 wayland-protocols
|
ext: ""
|
||||||
pkg_config: aarch64-linux-gnu-pkg-config
|
|
||||||
triple: aarch64-linux-gnu
|
|
||||||
binary_extension: ""
|
|
||||||
|
|
||||||
- target: x86_64-pc-windows-gnu
|
- target: x86_64-pc-windows-gnu
|
||||||
binary_name: zenyx-x86_64-windows.exe
|
binary_name: zenyx-x86_64-windows.exe
|
||||||
deps: mingw-w64
|
ext: ".exe"
|
||||||
pkg_config: x86_64-w64-mingw32-pkg-config
|
- target: aarch64-apple-darwin
|
||||||
triple: x86_64-w64-mingw32
|
binary_name: zenyx-aarch64-apple
|
||||||
binary_extension: ".exe"
|
ext: ""
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Clone repository
|
- name: 📥 Checkout source
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: 🛠️ Install dependencies
|
- name: 🛠️ Install Rust toolchain
|
||||||
run: |
|
uses: https://github.com/actions-rs/toolchain@v1
|
||||||
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:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
override: true
|
override: true
|
||||||
|
|
||||||
- name: 🏗️ Build
|
- name: 🚀 Build with cross
|
||||||
uses: https://github.com/actions-rs/cargo@v1
|
uses: https://github.com/actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
|
use-cross: true
|
||||||
command: build
|
command: build
|
||||||
args: --release --target ${{ matrix.target }}
|
args: --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
|
- name: 📦 Package artifact
|
||||||
run: |
|
run: |
|
||||||
mkdir -p artifacts
|
mkdir -p artifacts
|
||||||
cp target/${{ matrix.target }}/release/zenyx${{ matrix.binary_extension }} artifacts/${{ matrix.binary_name }}
|
cp target/${{ matrix.target }}/debug/zenyx${{ matrix.ext }} artifacts/${{ matrix.binary_name }}
|
||||||
chmod +x artifacts/${{ matrix.binary_name }}
|
chmod +x artifacts/${{ matrix.binary_name }}
|
||||||
|
|
||||||
- name: ⬆️ Upload artifact
|
- name: ⬆️ Upload artifact
|
||||||
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
uses: code.forgejo.org/forgejo/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.binary_name }}
|
name: ${{ matrix.binary_name }}
|
||||||
path: artifacts/${{ matrix.binary_name }}
|
path: artifacts/${{ matrix.binary_name }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue