forked from The-OpenROAD-Project/OpenROAD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
209 lines (191 loc) · 8.02 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
@Library('[email protected]') _
def baseTests(String image) {
Map base_tests = [failFast: false];
base_tests['Unit Tests CTest'] = {
docker.image(image).inside('--user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock') {
stage('Setup CTest') {
echo 'Nothing to be done.';
}
stage('Unit Tests CTest') {
try {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
timeout(time: 10, unit: 'MINUTES') {
sh label: 'Run ctest', script: 'ctest --test-dir build -j $(nproc)';
}
}
} catch (e) {
echo 'Failed regressions';
currentBuild.result = 'FAILURE';
}
sh label: 'Save ctest results', script: 'tar zcvf results-ctest.tgz build/Testing';
archiveArtifacts artifacts: 'results-ctest.tgz';
}
}
}
base_tests['Unit Tests Tcl'] = {
node {
docker.image(image).inside('--user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock') {
stage('Setup Tcl Tests') {
sh label: 'Configure git', script: "git config --system --add safe.directory '*'";
checkout scm;
unstash 'install';
}
stage('Unit Tests TCL') {
try {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
timeout(time: 20, unit: 'MINUTES') {
sh label: 'Tcl regression', script: './test/regression';
}
}
} catch (e) {
echo 'Failed regressions';
currentBuild.result = 'FAILURE';
}
sh label: 'Save Tcl results', script: "find . -name results -type d -exec tar zcvf {}.tgz {} ';'";
archiveArtifacts artifacts: '**/results.tgz';
}
}
}
}
def flow_tests = [
'aes_nangate45',
'gcd_nangate45',
'tinyRocket_nangate45',
'aes_sky130hd',
'gcd_sky130hd',
'ibex_sky130hd',
'jpeg_sky130hd',
'aes_sky130hs',
'gcd_sky130hs',
'ibex_sky130hs',
'jpeg_sky130hs'
];
flow_tests.each { current_test ->
base_tests["Flow Test - ${current_test}"] = {
node {
docker.image(image).inside('--user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock') {
stage("Setup ${current_test}") {
sh label: 'Configure git', script: "git config --system --add safe.directory '*'";
checkout scm;
unstash 'install';
}
stage("Flow Test - ${current_test}") {
try {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
timeout(time: 1, unit: 'HOURS') {
sh label: "Flow ${current_test}", script: "./test/regression ${current_test}";
}
}
}
catch (e) {
echo 'Failed regressions';
currentBuild.result = 'FAILURE';
}
sh label: "Save ${current_test} results", script: "find . -name results -type d -exec tar zcvf ${current_test}.tgz {} ';'";
archiveArtifacts artifacts: "${current_test}.tgz";
}
}
}
}
}
return base_tests;
}
def getParallelTests(String image) {
def ret = [
'Build without GUI': {
node {
docker.image(image).inside('--user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock') {
stage('Setup no-GUI Build') {
echo "Build without GUI";
sh label: 'Configure git', script: "git config --system --add safe.directory '*'";
checkout scm;
}
stage('no-GUI Build') {
timeout(time: 20, unit: 'MINUTES') {
sh label: 'no-GUI Build', script: './etc/Build.sh -no-warnings -no-gui -dir=build-without-gui';
}
}
}
}
},
'Build without Test': {
node {
docker.image(image).inside('--user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock') {
stage('Setup no-test Build') {
echo "Build without Tests";
sh label: 'Configure git', script: "git config --system --add safe.directory '*'";
checkout scm;
}
stage('no-test Build') {
timeout(time: 20, unit: 'MINUTES') {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh label: 'no-test Build', script: 'cmake -B build_no_tests -D ENABLE_TESTS=OFF 2>&1 | tee no_test.log';
}
}
archiveArtifacts artifacts: 'no_test.log';
}
}
}
},
'Check message IDs': {
dir('src') {
sh label: 'Find duplicated message IDs', script: '../etc/find_messages.py > messages.txt';
archiveArtifacts artifacts: 'messages.txt';
}
},
'Unit Tests Ninja': {
node {
docker.image(image).inside('--user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock') {
stage('Setup Ninja Tests') {
sh label: 'Configure git', script: "git config --system --add safe.directory '*'";
checkout scm;
}
stage('C++ Unit Tests Setup') {
sh label: 'C++ Unit Tests Setup', script: 'cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -GNinja -B build .';
}
stage('C++ Unit Tests') {
sh label: 'C++ Unit Tests', script: 'cd build && CLICOLOR_FORCE=1 ninja build_and_test';
}
}
}
},
'Build and Test': {
stage('Build and Stash bins') {
buildBinsOR(image, "-no-warnings");
}
stage('Tests') {
parallel(baseTests(image));
}
},
'Compile with C++20': {
node {
docker.image('openroad/ubuntu-cpp20').inside('--user=root --privileged -v /var/run/docker.sock:/var/run/docker.sock') {
stage('Setup C++20 Compile') {
sh label: 'Configure git', script: "git config --system --add safe.directory '*'";
checkout scm;
}
stage('Compile with C++20') {
sh label: 'Compile C++20', script: "./etc/Build.sh -no-warnings -compiler='clang-16' -cmake='-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=20'";
}
}
}
}
];
return ret;
}
timeout(time: 2, unit: 'HOURS') {
node {
stage('Checkout') {
checkout scm;
}
def DOCKER_IMAGE;
stage('Build and Push Docker Image') {
DOCKER_IMAGE = dockerPush('ubuntu22.04', 'openroad');
echo "Docker image is ${DOCKER_IMAGE}";
}
parallel(getParallelTests(DOCKER_IMAGE));
stage('Send Email Report') {
sendEmail();
}
}
}