chore: broaden the support of ci/cd

This commit is contained in:
Chance 2025-04-12 21:58:03 -04:00 committed by BitSyndicate
parent f0deb7951e
commit af67d9e589

View file

@ -1,4 +1,5 @@
name: Build Zenyx ⚡ name: Build Zenyx ⚡
on: on:
push: push:
pull_request: pull_request:
@ -7,14 +8,27 @@ jobs:
build: build:
name: Build ${{ matrix.target }} name: Build ${{ matrix.target }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
services:
docker:
image: docker:dind
options: >-
--privileged
--env DOCKER_TLS_CERTDIR=""
ports:
- 2375:2375
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
- powerpc64le-unknown-linux-gnu
- s390x-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
- x86_64-pc-windows-gnu - x86_64-pc-windows-gnu
# - aarch64-apple-darwin - x86_64-pc-windows-msvc
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
@ -22,32 +36,30 @@ jobs:
- target: aarch64-unknown-linux-gnu - target: aarch64-unknown-linux-gnu
binary_name: zenyx-aarch64-linux binary_name: zenyx-aarch64-linux
ext: "" ext: ""
- target: powerpc64le-unknown-linux-gnu
binary_name: zenyx-powerpc64le-linux
ext: ""
- target: s390x-unknown-linux-gnu
binary_name: zenyx-s390x-linux
ext: ""
- target: riscv64gc-unknown-linux-gnu
binary_name: zenyx-riscv64-linux
ext: ""
- 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-gnu.exe
ext: ".exe"
- target: x86_64-pc-windows-msvc
binary_name: zenyx-x86_64-windows-msvc.exe
ext: ".exe" ext: ".exe"
# - target: aarch64-apple-darwin
# binary_name: zenyx-aarch64-apple
# ext: ""
steps: steps:
- name: 📥 Checkout source - name: 📥 Checkout source
uses: actions/checkout@v4 uses: https://github.com/actions/checkout@v4
- name: 🐳 Setup Docker-in-Docker - name: 🐳 Set up Docker CLI
run: | uses: https://github.com/docker/setup-docker-action@v3
# Install Docker using the convenience script with:
curl -fsSL https://get.docker.com -o get-docker.sh docker-binaries: true
sh get-docker.sh
# Start Docker daemon directly (instead of using service)
sudo dockerd &
# Give the Docker daemon a moment to initialize
sleep 10
# Verify Docker is working
docker info || true
docker --version
- name: 🛠️ Install Rust toolchain - name: 🛠️ Install Rust toolchain
uses: https://github.com/actions-rs/toolchain@v1 uses: https://github.com/actions-rs/toolchain@v1
@ -55,24 +67,32 @@ jobs:
toolchain: stable toolchain: stable
target: ${{ matrix.target }} target: ${{ matrix.target }}
override: true override: true
components: rust-src
- name: 🧩 Restore Cargo cache
uses: https://github.com/actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.target }}-
- name: 🧰 Install Cross - name: 🧰 Install Cross
run: cargo install cross --locked run: cargo install cross --locked
- name: 🚀 Build with cross - name: 🚀 Build with cross
uses: https://github.com/actions-rs/cargo@v1
env: env:
CROSS_CONTAINER_IN_CONTAINER : true DOCKER_HOST: tcp://localhost:2375
with: CROSS_CONTAINER_IN_CONTAINER: true
use-cross: true run: cross build --target ${{ matrix.target }} --release
command: build
args: --target ${{ matrix.target }}
- name: 📦 Package artifact - name: 📦 Package artifact
run: | run: |
mkdir -p artifacts mkdir -p artifacts
cp target/${{ matrix.target }}/debug/zenyx${{ matrix.ext }} artifacts/${{ matrix.binary_name }} cp target/${{ matrix.target }}/release/zenyx${{ matrix.ext }} 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: https://code.forgejo.org/forgejo/upload-artifact@v4