forked from Ben1980/jenkinsexample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
executable file
·51 lines (45 loc) · 1.64 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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 ~'''
}
}
}
}