feat: make ci/cd pipeline multi-target

This commit is contained in:
Chance 2025-04-13 19:34:30 -04:00 committed by BitSyndicate
parent 2767d45b5a
commit fe79838bc4
Signed by: bitsyndicate
GPG key ID: 443E4198D6BBA6DE

View file

@ -1,20 +1,68 @@
stages:
- test
- build
- publish
tests:
stage: test
image: rust
script:
- cargo test
variables:
RUSTUP_TOOLCHAIN: stable
build:
stage: build
image: rust
image: rust:latest
services:
- name: docker:24.0.5dind
alias: docker
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
DOCKER_DRIVER: overlay2
privileged: true
parallel:
matrix:
- 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: 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
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"
cache:
key: "${CI_JOB_NAME}-${TARGET}-${CI_COMMIT_SHA}"
policy: pull-push
paths:
- "$HOME/.cargo/registry"
- "$HOME/.cargo/git"
- target
before_script:
- apt-get update && apt-get install -y docker.io
- rustup target add "$TARGET"
- cargo install cross --locked
script:
- cargo build --release
- cross build --target "$TARGET" --release
- mkdir -p artifacts
- cp "target/$TARGET/release/zenyx$EXT" "artifacts/$BINARY_NAME"
artifacts:
paths:
- target/release/zenyx
- artifacts/*
expire_in: 1 week