diff --git a/Jenkinsfile b/Jenkinsfile index aeb8846..6ed85ad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,13 @@ pipeline { // Multi-branch pipeline script for Yerbacon. agent any + def buildTarget(String path, String rpmArch, String debArch) { + cmakeBuild buildDir: 'cmake-build-${debArch}', buildType: 'release', cleanBuild: true, installation: 'Main' + cmake arguments: '--build ./cmake-build-${debArch} --target ybcon', installation: 'Main', + 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}' + cpack installation: 'Main', workingDir: 'cmake-build-{debArch}' + } + options { buildDiscarder(logRotator(numToKeepStr: '48', artifactNumToKeepStr: '96')) timeout(time: 8, unit: 'MINUTES') @@ -16,11 +23,10 @@ pipeline { // Multi-branch pipeline script for Yerbacon. steps { echo "Building the ${env.BRANCH_NAME} branch.." cmakeBuild buildDir: 'cmake-build-release', buildType: 'release', cleanBuild: true, installation: 'Main' - cmakeBuild buildDir: 'cmake-build-release-arm', buildType: 'release', cleanBuild: true, installation: 'Main', - cmakeArgs: '-DCMAKE_C_COMPILER=/usr/bin/arm-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=/usr/bin/arm-linux-gnueabi-g++ -DCMAKE_LINKER=/usr/bin/arm-linux-gnueabi-ld.gold -DCMAKE_AR=/usr/bin/arm-linux-gnueabi-ar -DCPACK_RPM_PACKAGE_ARCHITECTURE=armv4l -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=armel' cmake arguments: '--build ./cmake-build-release --target ybcon', installation: 'Main' sh 'strip ./cmake-build-release/ybcon' - cmake arguments: '--build ./cmake-build-release-arm --target ybcon', installation: 'Main' + cpack installation: 'Main', workingDir: 'cmake-build-release' + buildTarget('arm-linux-gnueabi', 'armv4l', 'armel') } } stage('Build for other platforms') { @@ -36,10 +42,7 @@ pipeline { // Multi-branch pipeline script for Yerbacon. stage('Deploy') { steps { echo 'Deploying....' - cpack installation: 'Main', workingDir: 'cmake-build-release' - dir('cmake-build-release') { archiveArtifacts artifacts:'*.deb, *.rpm, *.tar.gz, *.sh', fingerprint: false } - cpack installation: 'Main', workingDir: 'cmake-build-release-arm' - dir('cmake-build-release-arm') { zip zipFile: './Yerbacon-ARM_lpkg.zip', archive: true, glob: "*.tar.gz, *.sh, *.rpm, *.deb" } + archiveArtifacts artifacts: 'cmake-build-*/*.deb, cmake-build-*/*.rpm, cmake-build-*/*.tar.gz, cmake-build-*/*.sh', fingerprint: false } } }