71 lines
3.6 KiB
Groovy
71 lines
3.6 KiB
Groovy
def buildTarget(String path, String rpmArch = 'noarch', String debArch = 'noarch', boolean isPackageArchDeb = true, String suffix = '') {
|
|
final String packageArch = isPackageArchDeb ? debArch : rpmArch;
|
|
final String system_name = !path.contains('mingw') ? sh(returnStdout: true, script: 'uname -s').trim() : 'Windows'
|
|
// Note: CMake 3.20 or higher is needed
|
|
cmakeBuild buildDir: "cmake-build-${packageArch}${suffix}", buildType: 'release', cleanBuild: true, installation: 'Latest',
|
|
cmakeArgs: "--no-warn-unused-cli -DCMAKE_SYSTEM_NAME=\"${system_name}\" -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 -DCMAKE_RC_COMPILER=/usr/bin/${path}-windres -DCPACK_RPM_PACKAGE_ARCHITECTURE=${rpmArch} -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=${debArch} -DCXX_TARGET=${packageArch} -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS=/usr/${path}/lib/ -DNO_CCACHE=ON",
|
|
generator: fileExists('/usr/bin/ninja') ? 'Ninja' : 'Unix Makefiles'
|
|
cmake arguments: "--build ./cmake-build-${packageArch}${suffix} --target ybcon", installation: 'Latest'
|
|
sh "/usr/bin/${path}-strip -s ./cmake-build-${packageArch}${suffix}/ybcon*"
|
|
cpack installation: 'Latest', workingDir: "cmake-build-${packageArch}${suffix}"
|
|
}
|
|
|
|
final String windowsSuffix = '-windows'
|
|
|
|
/* Required Plugins:
|
|
- CMake
|
|
- Sidebar Link
|
|
- Workspace Cleanup
|
|
*/
|
|
|
|
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)
|
|
buildTarget('riscv64-linux-gnu', 'riscv64', 'riscv64')
|
|
}
|
|
}
|
|
stage('Build for other platforms') {
|
|
steps {
|
|
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
|
|
buildTarget('x86_64-w64-mingw32', 'x86_64', 'amd64', true, windowsSuffix)
|
|
buildTarget('i686-w64-mingw32', 'i386', 'i386', true, windowsSuffix)
|
|
buildTarget('armv7-w64-mingw32', 'armv7hl', 'armhf', true, windowsSuffix)
|
|
buildTarget('aarch64-w64-mingw32', 'aarch64', 'arm64', false, windowsSuffix)
|
|
}
|
|
}
|
|
}
|
|
stage('Deploy') {
|
|
steps {
|
|
echo 'Deploying....'
|
|
archiveArtifacts artifacts: 'cmake-build-*/*.deb, cmake-build-*/*.rpm, cmake-build-*/*.tar.gz, cmake-build-*/*.sh', fingerprint: false
|
|
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
|
|
archiveArtifacts artifacts: 'cmake-build-*/*wpkg.*.exe, cmake-build-*/*.zip'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
cleanWs(cleanWhenNotBuilt: false, deleteDirs: true, disableDeferredWipeout: false, notFailBuild: true, skipWhenFailed: false)
|
|
}
|
|
}
|
|
} |