luafcgi/Jenkinsfile

85 lines
2.2 KiB
Plaintext
Raw Normal View History

2023-01-26 20:15:45 +01:00
def build_luad() {
2023-01-26 21:21:47 +01:00
sh '''#!/bin/bash
2023-01-26 20:23:48 +01:00
set -e
2023-01-26 21:40:45 +01:00
export RUSTUP_HOME=/opt/rust/rustup
export CARGO_HOME=/opt/rust/cargo
. /opt/rust/cargo/env
2023-01-26 20:23:48 +01:00
cd $WORKSPACE
2023-03-20 19:39:04 +01:00
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
rustup target add $TARGET
2023-01-26 20:23:48 +01:00
mkdir -p build/$arch/opt/www/bin
DESTDIR=$WORKSPACE/build/$arch/opt/www/bin
2023-03-20 19:39:04 +01:00
cargo build --target=$TARGET --release
cp target/$TARGET/release/luad $DESTDIR
2023-01-26 21:17:06 +01:00
'''
2023-01-26 20:15:45 +01:00
}
pipeline {
2023-03-20 19:40:54 +01:00
agent { node { label'workstation' } }
2023-01-26 20:15:45 +01:00
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
{
2023-03-20 19:51:10 +01:00
stage('Build AMD64') {
steps {
script {
env.arch = 'amd64'
2023-01-26 20:15:45 +01:00
}
2023-03-20 19:51:10 +01:00
build_luad()
2023-01-26 20:15:45 +01:00
}
2023-03-20 19:51:10 +01:00
}
stage('Build ARM64') {
steps {
script {
env.arch = 'arm64'
2023-01-26 20:15:45 +01:00
}
2023-03-20 19:51:10 +01:00
build_luad()
2023-01-26 20:15:45 +01:00
}
2023-03-20 19:51:10 +01:00
}
stage('Build ARM') {
steps {
script {
env.arch = 'arm'
2023-01-26 20:15:45 +01:00
}
2023-03-20 19:51:10 +01:00
build_luad()
2023-01-26 20:15:45 +01:00
}
2023-03-20 19:51:10 +01:00
}
stage('Archive') {
steps {
script {
archiveArtifacts artifacts: 'build/', fingerprint: true
2023-01-26 20:15:45 +01:00
}
}
2023-03-20 19:51:10 +01:00
}
2023-01-26 20:15:45 +01:00
}
}