forked from Komet/MediaElch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
105 lines (97 loc) · 2.77 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
pipeline {
agent {
docker {
image 'mediaelch/mediaelch-ci-linux:latest'
alwaysPull true
}
}
options {
ansiColor('xterm')
timestamps()
timeout(60)
buildDiscarder logRotator(numToKeepStr: '5')
}
stages {
stage('Lint') {
failFast true
parallel {
stage('Shellcheck') {
steps {
sh './scripts/run_shellcheck.sh'
}
}
stage('clang-format') {
steps {
sh '''
./scripts/run_clang_format.sh
git diff --diff-filter=M --color | cat
git diff --diff-filter=M --quiet || (echo "Found unformatted C++ files! Use clang-format!"; exit 1)
'''
}
}
stage('CMake Format') {
steps {
sh '''
./scripts/run_cmake_format.sh
git diff --diff-filter=M --color | cat
git diff --diff-filter=M --quiet || (echo "Found unformatted CMakeLists.txt! Use cmake-format!"; exit 1)
'''
}
}
}
}
stage('Build Qt5') {
steps {
sh '''
cmake --preset ci --fresh
cmake --build --preset ci
'''
}
}
stage('Build Qt6') {
steps {
sh '''
cmake --preset ci-qt6 --fresh
cmake --build --preset ci-qt6
'''
}
}
// Requires MOC files created during build
stage('cppcheck') {
steps {
sh './scripts/run_cppcheck.sh || echo "Cppcheck Failed"'
}
}
stage('Test') {
steps {
// Because our tests require a GUI (even unit tests at the moment) we need a
// display. We can accomplish this by using `xvfb`.
sh '''
export ASAN_OPTIONS=detect_leaks=0
mkdir -p ./build/ci/reports
xvfb-run ./build/ci/test/unit/mediaelch_unit_test -r junit --use-colour yes --warn NoTests --out build/ci/reports/mediaelch_unit_test.xml
xvfb-run ./build/ci/test/integration/mediaelch_test_integration -r junit --durations yes --use-colour yes --warn NoTests --resource-dir ./test/resources --temp-dir ./build/ci/test/resources --out ./build/ci/reports/mediaelch_test_integration.xml
'''
}
}
}
post {
always {
recordIssues enabledForFailure: true, tool: gcc()
recordIssues enabledForFailure: true, tool: cmake()
junit 'build/ci/reports/*.xml'
}
failure {
// In case of failure, just delete everything. Sometime CMake gets messed up.
deleteDir()
}
cleanup {
// Delete report and binaries
sh '''
rm -rf ./build/ci/reports
rm -f ./build/ci/test/unit/mediaelch_unit_test
rm -f ./build/ci/test/integration/mediaelch_test_integration
'''
}
}
}