2023-08-08 12:06:06 +00:00
#!/usr/bin/env groovy
2024-12-06 12:52:55 +00:00
library 'status-jenkins-lib@v1.9.16'
2022-06-07 10:58:06 +00:00
2022-09-21 10:06:45 +00:00
/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
2022-06-07 10:58:06 +00:00
pipeline {
agent {
dockerfile {
label 'linux'
dir 'ci/cpp'
filename 'Dockerfile-linux'
/* allows jenkins use cat and mounts '/dev/fuse' for linuxdeployqt */
args '--entrypoint="" --cap-add SYS_ADMIN --security-opt apparmor:unconfined --device /dev/fuse'
}
}
parameters {
booleanParam(
name: 'RELEASE',
2024-02-23 09:19:57 +00:00
description: 'Decides whether release credentials are used.',
2022-06-07 10:58:06 +00:00
defaultValue: params.RELEASE ?: false
)
2024-02-23 09:19:57 +00:00
booleanParam(
name: 'INCLUDE_DEBUG_SYMBOLS',
description: 'Decides whether binaries are built with debug symbols.',
defaultValue: params.INCLUDE_DEBUG_SYMBOLS ?: false
)
2022-06-07 10:58:06 +00:00
}
options {
timestamps()
/* Prevent Jenkins jobs from running forever */
timeout(time: 20, unit: 'MINUTES')
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '30',
2024-02-28 14:56:40 +00:00
artifactNumToKeepStr: '1',
2022-06-07 10:58:06 +00:00
))
2022-09-21 10:06:45 +00:00
/* Abort old PR builds. */
disableConcurrentBuilds(
abortPrevious: isPRBuild
)
2022-06-07 10:58:06 +00:00
}
environment {
2024-03-27 12:23:31 +00:00
PLATFORM = 'linux-cpp'
2022-06-07 10:58:06 +00:00
/* Control output the filename */
STATUS_CLIENT_APPIMAGE = "pkg/${utils.pkgFilename(ext: 'AppImage')}"
2022-06-30 11:13:14 +00:00
CONAN_USER_HOME = "${env.WORKSPACE}/build/conan/conan_home"
CONAN_NON_INTERACTIVE = 1
2022-06-07 10:58:06 +00:00
}
// TODO: Move all stages to the Makefile as targets "*-linux-using-docker"
stages {
stage('CMake Build') {
steps {
2022-06-30 11:13:14 +00:00
sh "conan install ${env.WORKSPACE}/ --profile=${env.WORKSPACE}/vendor/conan-configs/linux.ini -s build_type=Release --build=missing -if=${env.WORKSPACE}/build/conan -of=${env.WORKSPACE}/build"
2022-07-04 21:14:13 +00:00
// TODO: This fails compiling status-go with Jenkins user but not when run with docker's user. Fix go installation to work for all users or build docker with jenkin's
2022-08-10 10:08:21 +00:00
sh "CC=gcc-10 CXX=g++-10 qt-cmake ${env.WORKSPACE}/ -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${env.WORKSPACE}/build/conan/conan_toolchain.cmake"
sh "cmake --build ${env.WORKSPACE}/build"
2022-06-07 10:58:06 +00:00
}
}
2022-08-10 10:08:21 +00:00
// stage('Run Tests') {
// steps {
// sh "CTEST_OUTPUT_ON_FAILURE=1 QT_QPA_PLATFORM=offscreen ctest --test-dir ${env.WORKSPACE}/build"
// }
// }
2022-06-07 10:58:06 +00:00
stage('Package') {
steps {
2024-05-07 21:11:20 +00:00
sh "linuxdeploy --plugin qt --executable=${env.WORKSPACE}/build/status-desktop --appdir ${env.WORKSPACE}/build/AppDir --desktop-file=${env.WORKSPACE}/status.desktop --icon-file=${env.WORKSPACE}/status.png --custom-apprun=${env.WORKSPACE}/AppRun-cpp"
2022-06-07 10:58:06 +00:00
sh "cmake --install ${env.WORKSPACE}/build --prefix=${env.WORKSPACE}/build/install"
sh "cp ${env.WORKSPACE}/build/install/lib/* ${env.WORKSPACE}/build/AppDir/usr/lib/"
// TODO enable after deploying appimage plugin in the corresponding docker
//sh "linuxdeploy --appdir ${env.WORKSPACE}/build/AppDir --output=appimage"
// sh "mkdir pkg && cp \"\$(find ${env.WORKSPACE}/build/AppDir -maxdepth 2 -type f -iname \"*.AppImage\")\" ${env.STATUS_CLIENT_APPIMAGE}"
}
}
2022-09-21 10:35:48 +00:00
stage('Upload') {
steps { script {
/* TODO: Enable after generating the AppImage. */
env.PKG_URL = "${currentBuild.absoluteUrl}/consoleText"
} }
}
2022-06-07 10:58:06 +00:00
}
post {
success { script { github.notifyPR(true) } }
failure { script { github.notifyPR(false) } }
2022-11-22 12:40:45 +00:00
cleanup { sh './scripts/clean-git.sh' }
2022-06-07 10:58:06 +00:00
}
}