mirror of
https://github.com/antos-rde/antos.git
synced 2025-04-29 20:26:45 +02:00
Some checks failed
gitea-sync/antos/pipeline/head There was a failure building this commit
223 lines
5.4 KiB
Groovy
223 lines
5.4 KiB
Groovy
def build_rust_and_frontend() {
|
|
sh '''#!/bin/bash
|
|
set -e
|
|
export RUSTUP_HOME=/opt/rust/rustup
|
|
export CARGO_HOME=/opt/rust/cargo
|
|
TARGET=
|
|
case "$arch" in
|
|
amd64)
|
|
TARGET="x86_64-unknown-linux-gnu"
|
|
;;
|
|
arm64)
|
|
TARGET="aarch64-unknown-linux-gnu"
|
|
;;
|
|
arm)
|
|
TARGET="armv7-unknown-linux-gnueabihf"
|
|
;;
|
|
*)
|
|
echo "unknown target for architecture $arch"
|
|
exit 1
|
|
;;
|
|
esac
|
|
mkdir -p build/$arch/
|
|
DESTDIR=$(realpath build/$arch/) \
|
|
PLATFORM=$arch \
|
|
RUST_TARGET=$TARGET \
|
|
RUSTUP_HOME=/opt/rust/rustup \
|
|
CARGO_HOME=/opt/rust/cargo \
|
|
make luafcgi frontend
|
|
'''
|
|
}
|
|
|
|
def build_server_and_backend() {
|
|
sh '''#!/bin/bash
|
|
set -e
|
|
TARGET=
|
|
case "$arch" in
|
|
amd64)
|
|
;;
|
|
arm64)
|
|
;;
|
|
arm)
|
|
;;
|
|
*)
|
|
echo "unknown target for architecture $arch"
|
|
exit 1
|
|
;;
|
|
esac
|
|
mkdir -p build/$arch/
|
|
DESTDIR=$(realpath build/$arch/) \
|
|
PLATFORM=$arch \
|
|
FRONTEND_IGNORE=true \
|
|
LUAFCGI_IGNORE=true \
|
|
make
|
|
'''
|
|
}
|
|
|
|
def build_package() {
|
|
sh '''#!/bin/bash
|
|
set -e
|
|
TARGET=
|
|
case "$arch" in
|
|
amd64)
|
|
;;
|
|
arm64)
|
|
;;
|
|
arm)
|
|
;;
|
|
*)
|
|
echo "unknown target for architecture $arch"
|
|
exit 1
|
|
;;
|
|
esac
|
|
mkdir -p build/$arch/
|
|
DESTDIR=$(realpath build/$arch/) \
|
|
PLATFORM=$arch \
|
|
make deb appimg
|
|
'''
|
|
}
|
|
|
|
pipeline {
|
|
agent { node { label'master' } }
|
|
options {
|
|
// Limit build history with buildDiscarder option:
|
|
// daysToKeepStr: history is only kept up to this many days.
|
|
// numToKeepStr: only this many build logs are kept.
|
|
// artifactDaysToKeepStr: artifacts are only kept up to this many days.
|
|
// artifactNumToKeepStr: only this many builds have their artifacts kept.
|
|
buildDiscarder(logRotator(numToKeepStr: '1'))
|
|
// Enable timestamps in build log console
|
|
timestamps()
|
|
// Maximum time to run the whole pipeline before canceling it
|
|
timeout(time: 3, unit: 'HOURS')
|
|
// Use Jenkins ANSI Color Plugin for log console
|
|
ansiColor('xterm')
|
|
// Limit build concurrency to 1 per branch
|
|
disableConcurrentBuilds()
|
|
}
|
|
stages
|
|
{
|
|
stage('Build RUST + FRONTEND AMD64') {
|
|
agent {
|
|
node { label'workstation' }
|
|
}
|
|
steps {
|
|
script {
|
|
env.arch = 'amd64'
|
|
}
|
|
build_rust_and_frontend()
|
|
}
|
|
}
|
|
stage('Build RUST + FRONTEND ARM64') {
|
|
agent {
|
|
node { label'workstation' }
|
|
}
|
|
steps {
|
|
script {
|
|
env.arch = 'arm64'
|
|
}
|
|
build_rust_and_frontend()
|
|
}
|
|
}
|
|
stage('Build RUST + FRONTEND ARM') {
|
|
agent {
|
|
node { label'workstation' }
|
|
}
|
|
steps {
|
|
script {
|
|
env.arch = 'arm'
|
|
}
|
|
build_rust_and_frontend()
|
|
}
|
|
}
|
|
|
|
stage('Build Server + backend AMD64') {
|
|
agent {
|
|
docker {
|
|
image 'xsangle/ci-tools:latest-amd64'
|
|
reuseNode true
|
|
}
|
|
}
|
|
steps {
|
|
script {
|
|
env.arch = 'amd64'
|
|
}
|
|
build_server_and_backend()
|
|
}
|
|
}
|
|
|
|
stage('Build Server + backend ARM64') {
|
|
agent {
|
|
docker {
|
|
image 'xsangle/ci-tools:latest-arm64'
|
|
reuseNode true
|
|
}
|
|
}
|
|
steps {
|
|
script {
|
|
env.arch = 'arm64'
|
|
}
|
|
build_server_and_backend()
|
|
}
|
|
}
|
|
|
|
stage('Build Server + backend ARM') {
|
|
agent {
|
|
docker {
|
|
image 'xsangle/ci-tools:latest-arm'
|
|
reuseNode true
|
|
}
|
|
}
|
|
steps {
|
|
script {
|
|
env.arch = 'arm'
|
|
}
|
|
build_server_and_backend()
|
|
}
|
|
}
|
|
|
|
stage('Build package AMD64') {
|
|
agent {
|
|
node { label'workstation' }
|
|
}
|
|
steps {
|
|
script {
|
|
env.arch = 'amd64'
|
|
}
|
|
build_package()
|
|
}
|
|
}
|
|
|
|
stage('Build package ARM64') {
|
|
agent {
|
|
node { label'workstation' }
|
|
}
|
|
steps {
|
|
script {
|
|
env.arch = 'arm64'
|
|
}
|
|
build_package()
|
|
}
|
|
}
|
|
|
|
stage('Build package ARM') {
|
|
agent {
|
|
node { label'workstation' }
|
|
}
|
|
steps {
|
|
script {
|
|
env.arch = 'arm'
|
|
}
|
|
build_package()
|
|
}
|
|
}
|
|
stage('Archive') {
|
|
steps {
|
|
script {
|
|
archiveArtifacts artifacts: 'build/', fingerprint: true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|