Created
March 26, 2019 15:36
-
-
Save Ben1980/4263ceaf0aa6bd244fc34cf461e05e62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent any | |
options { | |
buildDiscarder(logRotator(numToKeepStr: '10')) | |
} | |
parameters { | |
booleanParam name: 'RUN_TESTS', defaultValue: true, description: 'Run Tests?' | |
booleanParam name: 'RUN_ANALYSIS', defaultValue: true, description: 'Run Static Code Analysis?' | |
booleanParam name: 'DEPLOY', defaultValue: true, description: 'Deploy Artifacts?' | |
} | |
stages { | |
stage('Build') { | |
steps { | |
cmake arguments: '-DCMAKE_TOOLCHAIN_FILE=~/Projects/vcpkg/scripts/buildsystems/vcpkg.cmake', installation: 'InSearchPath' | |
cmakeBuild buildType: 'Release', cleanBuild: true, installation: 'InSearchPath', steps: [[withCmake: true]] | |
} | |
} | |
stage('Test') { | |
when { | |
environment name: 'RUN_TESTS', value: 'true' | |
} | |
steps { | |
ctest 'InSearchPath' | |
} | |
} | |
stage('Analyse') { | |
when { | |
environment name: 'RUN_ANALYSIS', value: 'true' | |
} | |
steps { | |
sh label: '', returnStatus: true, script: 'cppcheck . --xml --language=c++ --suppressions-list=suppressions.txt 2> cppcheck-result.xml' | |
publishCppcheck allowNoReport: true, ignoreBlankFiles: true, pattern: '**/cppcheck-result.xml' | |
} | |
} | |
stage('Deploy') { | |
when { | |
environment name: 'DEPLOY', value: 'true' | |
} | |
steps { | |
sh label: '', returnStatus: true, script: '''cp jenkinsexample ~ | |
cp test/testPro ~''' | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment