Improved Jenkinsfile structure
All checks were successful
JCS-Prod/RSE-Texture/pipeline/head This commit looks good

This commit is contained in:
JackCarterSmith 2021-07-03 15:21:31 +02:00
parent 84e0a0b904
commit 9f98830fce
Signed by: JackCarterSmith
GPG Key ID: DB362B740828F843
2 changed files with 100 additions and 65 deletions

View File

@ -7,8 +7,13 @@ cmake_minimum_required(VERSION 3.1)
cmake_policy(VERSION 3.1)
# define project
project(rse-texture VERSION 1.0.1 DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C)
set(RSE_TEX_NAME RSE_Texture-${PROJECT_VERSION})
if(DEFINED ENV{CI})
project(rse-texture VERSION 1.0.1.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C)
set(RSE_TEX_NAME $ENV{CI_OUTPUT_NAME}-${PROJECT_VERSION})
else()
project(rse-texture VERSION 1.0.1 DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C)
set(RSE_TEX_NAME RSE_Texture-${PROJECT_VERSION})
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h @ONLY)
include(CheckIncludeFile)
@ -42,8 +47,17 @@ if(MSVC)
endif()
target_link_libraries(rse-texture ${ZLIB_LIBRARIES} ${PNG_LIBRARIES})
# install executable
# add GPG signature command
#add_custom_command(
# OUTPUT ""
# COMMAND gpg --batch --detach-sign
# -o ${RSE_TEX_NAME}_${CI_SYS_TARGET}.gpg
# ${RSE_TEX_NAME}
# DEPENDS ${RSE_TEX_NAME}
# VERBATIM
#)
# install executable
install(TARGETS rse-texture
RUNTIME DESTINATION bin
)

57
Jenkinsfile vendored
View File

@ -3,38 +3,58 @@ pipeline {
options {
skipDefaultCheckout(true)
}
environment {
CI_OUTPUT_NAME = "RSE_Texture"
CI_BUILD_NUMBER = "$BUILD_NUMBER"
}
stages {
stage('Unix-Build') {
stage('Prepare') {
steps {
cleanWs()
}
}
stage('Build') {
steps {
parallel(
linux: {
dir("linux") {
checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Texture'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Texture.git']]])
echo 'Build Unix x64_86 release...'
cmakeBuild buildDir: 'build', installation: 'latest', steps: [[args: 'all']]
}
}
stage('Unix-Deploy') {
steps {
echo 'Deploying solution...'
sh 'gpg --batch --detach-sign -o build/${JOB_BASE_NAME}_x64_1.0.1-${BUILD_NUMBER}.gpg build/RSE_Texture-1.0.1'
archiveArtifacts(artifacts: 'build/RSE_Texture-*,build/*.gpg')
}
}
stage('Win-Build') {
steps {
cleanWs()
},
windows: {
dir("windows") {
checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Texture'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Texture.git']]])
echo 'Build Windows mingw64 release...'
cmakeBuild buildDir: 'build', cmakeArgs: '-DGNU_HOST=x86_64-w64-mingw32 -DCMAKE_TOOLCHAIN_FILE=../mingw_cross_toolchain.cmake -D"ZLIB_INCLUDE_DIR=/mnt/cc-libs/mingw64/zlib/1.2.11/include" -D"ZLIB_LIBRARY=/mnt/cc-libs/mingw64/zlib/1.2.11/lib/libzlib.dll.a" -D"PNG_PNG_INCLUDE_DIR=/mnt/cc-libs/mingw64/libpng/1.6.37/include" -D"PNG_LIBRARY=/mnt/cc-libs/mingw64/libpng/1.6.37/lib/libpng.dll.a"', installation: 'latest', steps: [[args: 'all']]
}
}
stage('Win-Deploy') {
)
}
}
stage('Deploy') {
steps {
echo 'Deploying solution...'
sh 'gpg --batch --detach-sign -o build/${JOB_BASE_NAME}_mingw64_1.0.1-${BUILD_NUMBER}.gpg build/RSE_Texture-1.0.1.exe'
archiveArtifacts(artifacts: 'build/RSE_Texture-*.exe,build/*.gpg')
dir("zip_linux") {
sh 'cp ../linux/build/${CI_OUTPUT_NAME}-1.0.1.${BUILD_NUMBER}* .'
}
dir("zip_win") {
sh 'cp ../windows/build/${CI_OUTPUT_NAME}-1.0.1.${BUILD_NUMBER}* /mnt/cc-libs/mingw64/zlib/1.2.11/bin/libzlib.dll /mnt/cc-libs/mingw64/libpng/1.6.37/bin/libpng16.dll .'
}
zip archive: false, dir: 'zip_linux', exclude: '', glob: '', zipFile: 'x64.zip'
sh 'mv x64.zip ${CI_OUTPUT_NAME}-1.0.1.${BUILD_NUMBER}_x64.zip'
zip archive: false, dir: 'zip_win', exclude: '', glob: '', zipFile: 'mingw64.zip'
sh 'mv mingw64.zip ${CI_OUTPUT_NAME}-1.0.1.${BUILD_NUMBER}_mingw64.zip'
}
}
stage('Sign') {
steps {
sh 'ls -l'
sh 'gpg --batch --detach-sign -o ${CI_OUTPUT_NAME}-1.0.1.${BUILD_NUMBER}_x64.zip.gpg ${CI_OUTPUT_NAME}-1.0.1.${BUILD_NUMBER}_x64.zip'
sh 'gpg --batch --detach-sign -o ${CI_OUTPUT_NAME}-1.0.1.${BUILD_NUMBER}_mingw64.zip.gpg ${CI_OUTPUT_NAME}-1.0.1.${BUILD_NUMBER}_mingw64.zip'
archiveArtifacts(artifacts: '*.zip,*.gpg')
}
}
}
/*
post {
always {
cleanWs(cleanWhenNotBuilt: false,
@ -43,4 +63,5 @@ pipeline {
notFailBuild: true)
}
}
*/
}