def buildTarget(String path, String rpmArch, String debArch, boolean isPackageArchDeb = true) { String packageArch = isPackageArchDeb ? debArch : rpmArch; // Note: CMake 3.20 or higher is needed cmakeBuild buildDir: "cmake-build-${packageArch}", buildType: 'release', cleanBuild: true, installation: 'Latest', cmakeArgs: "-DCMAKE_C_COMPILER=/usr/bin/${path}-gcc -DCMAKE_CXX_COMPILER=/usr/bin/${path}-g++ -DCMAKE_LINKER=/usr/bin/${path}-ld.gold -DCMAKE_AR=/usr/bin/${path}-ar -DCPACK_RPM_PACKAGE_ARCHITECTURE=${rpmArch} -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=${debArch} -DCXX_TARGET=${packageArch} -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS=/usr/${path}/lib/ -DCCACHE_PRESENT=False" cmake arguments: "--build ./cmake-build-${packageArch} --target ybcon", installation: 'Latest' sh "/usr/bin/${path}-strip ./cmake-build-${packageArch}/ybcon" cpack installation: 'Latest', workingDir: "cmake-build-${packageArch}" } pipeline { // Multi-branch pipeline script for Yerbacon. agent any options { buildDiscarder(logRotator(numToKeepStr: '48', artifactNumToKeepStr: '96')) timeout(time: 8, unit: 'MINUTES') sidebarLinks([ [displayName: 'Gitea Repository', iconFileName: '/userContent/Yerbacon.png', urlName: 'https://gits.username404.fr/Username404-59/Yerbacon/src/branch/' + env.BRANCH_NAME] ]) } triggers { pollSCM('*/10 * * * *') } stages { stage('Build') { steps { echo "Building the ${env.BRANCH_NAME} branch.." buildTarget('x86_64-linux-gnu', 'x86_64', 'amd64') buildTarget('i686-linux-gnu', 'i386', 'i386') buildTarget('arm-linux-gnueabi', 'armv4l', 'armel') buildTarget('arm-linux-gnueabihf', 'armv7hl', 'armhf') buildTarget('aarch64-linux-gnu', 'aarch64', 'arm64', false) } } stage('Build for other platforms') { steps { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { cmakeBuild buildDir: 'cmake-build-release-win32', buildType: 'release', cleanBuild: true, installation: 'Latest', cmakeArgs: '-DCMAKE_C_COMPILER=/usr/bin/i686-w64-mingw32-gcc-posix -DCMAKE_CXX_COMPILER=/usr/bin/i686-w64-mingw32-c++-posix -DCMAKE_SYSTEM_PROCESSOR=i686 -DCCACHE_PRESENT=False' cpack installation: 'Latest', workingDir: 'cmake-build-release-win32' dir('cmake-build-release-win32') { archiveArtifacts artifacts:'*.exe', fingerprint: false } } } } stage('Deploy') { steps { echo 'Deploying....' archiveArtifacts artifacts: 'cmake-build-*/*.deb, cmake-build-*/*.rpm, cmake-build-*/*.tar.gz, cmake-build-*/*.sh', fingerprint: false } } } }