darling/ci/Jenkinsfile
Ariel Abreu a0ca392876 [ci] Build both DEBs and RPMs by default
The build is now fast enough that we can build both faster than we used
to build each individual type.

For context, the fully cached (with `ccache`) build for both takes a
total of about 7 minutes, whereas a non-cached full build of just the
DEBs used to take about 12 minutes. I expect that on average, building
them both when there are source changes (i.e. when only part of the
build is cached) would likely take a total of about 10 minutes.
2023-05-12 10:05:41 -07:00

129 lines
2.8 KiB
Groovy

pipeline {
agent {
docker {
image 'registry.git.facekapow.dev/darling-build-image-top:latest'
registryUrl 'https://registry.git.facekapow.dev'
alwaysPull true
args '-u ci:ci -v /var/run/docker.sock:/var/run/docker.sock --group-add docker'
label 'darling'
}
}
parameters {
booleanParam(name: 'DEB', defaultValue: true, description: 'If true, build Debian packages.')
booleanParam(name: 'RPM', defaultValue: true, description: 'If true, build RPM packages.')
}
triggers {
githubPush()
}
environment {
ESCAPED_JOB_NAME = sh(script: 'echo "${JOB_NAME}" | sed \'s/\\//-/g\'', returnStdout: true).trim()
CCACHE_DIR = credentials('darling-ccache-dir')
}
options {
skipDefaultCheckout()
disableConcurrentBuilds abortPrevious: true
}
stages {
stage('Start Job') {
steps {
scmSkip(deleteBuild: true, skipPattern:'.*\\[ci skip\\].*')
dir('source') {
checkout scm
}
}
}
stage('Prepare') {
steps {
dir('source') {
sh 'git submodule update --init --recursive'
sh 'cd src/external/swift && git lfs install && git lfs pull'
touch '../.submodules-cloned'
}
}
}
stage('Build Debian') {
when { expression { params.DEB } }
agent {
docker {
image 'registry.git.facekapow.dev/darling-build-image:latest'
registryUrl 'https://registry.git.facekapow.dev'
alwaysPull true
args '-u ci:ci -v ${WORKSPACE}/source:/src/mnt:rw -v ${CCACHE_DIR}:/ccache:rw'
label 'darling'
reuseNode true
}
}
environment {
DEB_DISTRO = sh(script: 'lsb_release -cs', returnStdout: true).trim()
CCACHE_DIR = '/ccache'
CCACHE_BASEDIR = '/src/mnt'
}
steps {
//sh 'tools/debian/make-deb --dsc'
sh '''#!/bin/bash
pushd /src/mnt
tools/debian/make-deb
popd
'''
sh 'rm -rf out-deb'
sh 'mkdir out-deb'
dir('out-deb') {
sh 'mv /src/*.deb ./'
}
archiveArtifacts artifacts: 'out-deb/**/*', fingerprint: true
}
}
stage('Build RPM') {
when { expression { params.RPM } }
agent {
docker {
image 'registry.git.facekapow.dev/darling-build-image-fedora:latest'
registryUrl 'https://registry.git.facekapow.dev'
alwaysPull true
args '-v ${WORKSPACE}/source:/src:ro -v ${CCACHE_DIR}:/ccache:rw'
label 'darling'
reuseNode true
}
}
environment {
CCACHE_DIR = '/ccache'
CCACHE_BASEDIR = '/home/ci/rpmbuild/BUILD/darling'
}
steps {
sh 'bash -xv /src/rpm/build.bsh'
sh 'rm -rf out-rpm'
sh 'mkdir out-rpm'
dir('out-rpm') {
sh 'mv ${HOME}/rpmbuild/RPMS/x86_64/*.rpm ./'
}
archiveArtifacts artifacts: 'out-rpm/**/*', fingerprint: true
}
}
}
post {
cleanup {
script {
if (!fileExists('.submodules-cloned')) {
sh 'rm -rf source'
}
}
}
}
}