-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
142 lines (141 loc) · 2.58 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
pipeline {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
metadata:
labels:
some-label: dind-agent
spec:
containers:
- name: dind
image: docker:dind
args: ["--registry-mirror","https://registry.bansci.com"]
tty: true
securityContext:
privileged: true
volumeMounts:
- name: docker-graph-storage
mountPath: /var/lib/docker
#A fix for external network access issues, see https://liejuntao001.medium.com/fix-docker-in-docker-network-issue-in-kubernetes-cc18c229d9e5
args:
- "--mtu=1440"
volumes:
- name: docker-graph-storage
emptyDir: {}
""".stripIndent()
}
}
stages {
stage('Fetch docker toolchain image') {
steps{
container('dind') {
script {
dockerBuildImage = docker.image('toastedcrumpets/autopipefit-toolchain')
dockerBuildImage.pull()
}
}
}
}
stage('C++ Configure') {
steps{
container('dind') {
script {
dockerBuildImage.inside {
dir('build') {
sh "cmake .."
}
}
}
}
}
}
stage('Build ') {
parallel {
stage('CMake build') {
steps{
container('dind') {
script {
dockerBuildImage.inside {
dir('build') {
sh "make -j2"
}
}
}
}
}
}
stage('Python build') {
steps{
container('dind') {
script {
dockerBuildImage.inside {
sh "python3 setup.py build"
}
}
}
}
}
}
}
stage('Test') {
parallel {
stage('C++ tests') {
steps{
container('dind') {
script {
dockerBuildImage.inside {
dir('build') {
sh 'ctest -j2 --no-compress-output -T Test'
}
}
}
}
}
post {
always {
archiveArtifacts (
artifacts: 'build/Testing/**/*.xml',
fingerprint: true,
)
// Process the CTest xml output with the xUnit plugin
xunit (
testTimeMargin: '3000',
thresholdMode: 1,
thresholds: [
skipped(failureThreshold: '0'),
failed(failureThreshold: '0')
],
tools: [CTest(
pattern: 'build/Testing/**/*.xml',
deleteOutputFiles: true,
failIfNotNew: false,
skipNoTestFiles: true,
stopProcessingIfError: true
)]
)
}
}
}
stage('Python tests') {
steps {
container('dind') {
script {
dockerBuildImage.inside {
sh "python3 setup.py install"
sh 'PYTHONUNBUFFERED=1 py.test --junitxml test_results.xml'
}
}
}
}
post {
always {
junit 'test_results.xml'
}
}
}
}
}
}
}