forked from owncloud/core
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfile
187 lines (165 loc) · 5.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
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
#!groovy
/*
* This Jenkinsfile is intended to run on https://ci.owncloud.org and may fail anywhere else.
* It makes assumptions about plugins being installed, labels mapping to nodes that can build what is needed, etc.
*/
timestampedNode('SLAVE') {
stage 'Checkout'
checkout scm
sh '''git submodule update --init'''
stage 'JavaScript Testing'
executeAndReport('tests/autotest-results-js.xml') {
sh '''./autotest-js.sh'''
}
stage 'PHPUnit 7.0/sqlite'
executeAndReport('tests/autotest-results-sqlite.xml') {
sh '''
export NOCOVERAGE=1
unset USEDOCKER
phpenv local 7.0
./autotest.sh sqlite
'''
}
stage 'PHPUnit 7.0/mysql'
executeAndReport('tests/autotest-results-mysql.xml') {
sh '''
export NOCOVERAGE=1
unset USEDOCKER
phpenv local 7.0
./autotest.sh mysql
'''
}
stage 'PHPUnit 5.6/pgsql'
executeAndReport('tests/autotest-results-pgsql.xml') {
sh '''
export NOCOVERAGE=1
unset USEDOCKER
phpenv local 5.6
./autotest.sh pgsql
'''
}
stage 'PHPUnit 5.6/oci'
executeAndReport('tests/autotest-results-oci.xml') {
sh '''
export NOCOVERAGE=1
unset USEDOCKER
phpenv local 5.5
./autotest.sh oci
'''
}
stage 'Files External: webdav'
executeAndReport('tests/autotest-external-results-sqlite-webdav-ownCloud.xml') {
sh '''phpenv local 7.0
export NOCOVERAGE=1
unset USEDOCKER
./autotest-external.sh sqlite webdav-ownCloud
'''
}
stage 'Files External: SMB/SAMBA'
executeAndReport('tests/autotest-external-results-sqlite-smb-silvershell.xml') {
sh '''phpenv local 7.0
export NOCOVERAGE=1
unset USEDOCKER
./autotest-external.sh sqlite smb-silvershell
'''
}
stage 'Files External: swift/ceph'
executeAndReport('tests/autotest-external-results-sqlite-swift-ceph.xml') {
sh '''phpenv local 7.0
export NOCOVERAGE=1
unset USEDOCKER
./autotest-external.sh sqlite swift-ceph
'''
}
stage 'Files External: SMB/WINDOWS'
executeAndReport('tests/autotest-external-results-sqlite-smb-windows.xml') {
sh '''phpenv local 7.0
export NOCOVERAGE=1
unset USEDOCKER
./autotest-external.sh sqlite smb-windows
'''
}
step([$class: 'JUnitResultArchiver', testResults: 'tests/autotest-external-results-sqlite.xml'])
stage 'Primary Objectstore: swift'
executeAndReport('tests/autotest-results-mysql.xml') {
sh '''phpenv local 7.0
export NOCOVERAGE=1
export RUN_OBJECTSTORE_TESTS=1
export PRIMARY_STORAGE_CONFIG="swift"
unset USEDOCKER
rm tests/autotest-results-*.xml
./autotest.sh mysql
'''
}
stage 'Integration Testing'
executeAndReport('build/integration/output/*.xml') {
sh '''phpenv local 7.0
rm -rf config/config.php data/*
./occ maintenance:install --admin-pass=admin
rm -rf build/integration/{output,vendor,composer.lock}
cd build/integration && ./run.sh
'''
}
if (isOnReleaseBranch()) {
executeAndReport('build/integration/output/*.xml') {
sh '''phpenv local 7.0
rm -rf config/config.php data/*
./occ maintenance:install --admin-pass=admin
rm -rf build/integration/{output,vendor,composer.lock}
cd build/integration && OC_TEST_ALT_HOME=1 ./run.sh
'''
}
executeAndReport('build/integration/output/*.xml') {
sh '''phpenv local 7.0
rm -rf config/config.php data/*
./occ maintenance:install --admin-pass=admin
rm -rf build/integration/{output,vendor,composer.lock}
cd build/integration && OC_TEST_ENCRYPTION_ENABLED=1 ./run.sh
'''
}
executeAndReport('build/integration/output/*.xml') {
sh '''phpenv local 7.0
rm -rf config/config.php data/*
./occ maintenance:install --admin-pass=admin
rm -rf build/integration/{output,vendor,composer.lock}
cd build/integration && OC_TEST_ENCRYPTION_ENABLED=1 OC_TEST_ALT_HOME=1 ./run.sh
'''
}
}
}
def isOnReleaseBranch () {
if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'stable9.1' || env.BRANCH_NAME == 'stable9' || env.BRANCH_NAME == 'stable8.2') {
return true;
}
return false
}
void executeAndReport(String testResultLocation, def body) {
def failed = false
// We're wrapping this in a timeout - if it takes longer, kill it.
try {
timeout(time: 120, unit: 'MINUTES') {
body.call()
}
} catch (Exception e) {
failed = true
echo "Test execution failed: ${e}"
} finally {
step([$class: 'JUnitResultArchiver', testResults: testResultLocation])
}
if (failed) {
if (isOnReleaseBranch()) {
mail body: "project build error is here: ${env.BUILD_URL}" ,
subject: "Build on release branch failed: ${env.BRANCH_NAME}",
to: '[email protected]'
}
error "Test execution failed. Terminating the build"
}
}
// Runs the given body within a Timestamper wrapper on the given label.
def timestampedNode(String label, Closure body) {
node(label) {
wrap([$class: 'TimestamperBuildWrapper']) {
body.call()
}
}
}