antos/Jenkinsfile
DanyLE 8ef0a5b7db
All checks were successful
gitea-sync/antos/pipeline/head This commit looks good
feat: Support CI and cross compile for amd64, arm64, arm
2024-03-10 17:10:58 +01:00

91 lines
2.7 KiB
Groovy

pipeline {
agent {
docker {
image 'xsangle/ci-tools:latest'
reuseNode true
args ' --device /dev/fuse --privileged '
}
}
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('Prepare dependencies') {
agent {
node { label'workstation' }
}
steps {
sh'''
cd antd/luasocket && git stash || true
cd $WORKSPACE
git submodule update --init
make clean || true
rm -rf build/* || true
mkdir build || true
'''
}
}
stage('Build AMD64)') {
steps {
sh'''
DESTDIR=$(realpath build) \
ARCH=amd64 \
RUSTUP_HOME=/opt/rust/rustup \
CARGO_HOME=/opt/rust/cargo \
make all deb appimg
'''
}
}
stage('Build ARM64)') {
steps {
sh'''
DESTDIR=$(realpath build) \
ARCH=arm64 \
RUSTUP_HOME=/opt/rust/rustup \
CARGO_HOME=/opt/rust/cargo \
make all deb appimg
'''
}
}
stage('Build ARM)') {
steps {
sh'''
DESTDIR=$(realpath build) \
ARCH=arm \
RUSTUP_HOME=/opt/rust/rustup \
CARGO_HOME=/opt/rust/cargo \
make all deb appimg
'''
}
}
stage('Checking build)') {
steps {
sh'''
./scripts/ckarch.sh build
'''
}
}
stage('Archive') {
steps {
script {
archiveArtifacts artifacts: 'build/', fingerprint: true
}
}
}
}
}