summaryrefslogtreecommitdiffstats
path: root/Jenkinsfile
diff options
context:
space:
mode:
authorThomas Müller <DeepDiver1975@users.noreply.github.com>2016-08-14 12:48:29 +0200
committerGitHub <noreply@github.com>2016-08-14 12:48:29 +0200
commit57fd46184978f36a9e217aea1705cf9b0bef9519 (patch)
tree8896d7039500f638875be3cf54be98234e1ad666 /Jenkinsfile
parent646a3bb9818b90d088b4f16b048ee0fea274f7f4 (diff)
downloadnextcloud-server-57fd46184978f36a9e217aea1705cf9b0bef9519.tar.gz
nextcloud-server-57fd46184978f36a9e217aea1705cf9b0bef9519.zip
[stable8.1] Test jenkins pipeline (#25401) (#25504)
* [stable8.1] Test jenkins pipeline (#25401) * Use phantomjs-prebuilt as warning is telling us * Php7.0 is not supported and there are no primary storage tests on stable8.2 * [Stable8.2] fix unit test on new jenkins setup and adjust Jenkinsfile (#25772) (#25775) (#25783) * Next step jenkinsfile (#25622) * Adding timestamper and evaluation of test results even in case of failure * Adding build timeout * use fixed value 120 minutes as timeout for each test executing for now * Terminate the build as soon as test execution fails * Adjust external testing as well * Finalize use of executeAndReport * Array sort order is of no relevance
Diffstat (limited to 'Jenkinsfile')
-rw-r--r--Jenkinsfile87
1 files changed, 87 insertions, 0 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 00000000000..502dc9a1665
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,87 @@
+#!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'
+ executeAndReport('tests/autotest-results-sqlite.xml') {
+ sh '''
+ export NOCOVERAGE=1
+ unset USEDOCKER
+ phpenv local 5.6
+ ./autotest.sh sqlite
+ '''
+ }
+ executeAndReport('tests/autotest-results-mysql.xml') {
+ sh '''
+ export NOCOVERAGE=1
+ unset USEDOCKER
+ phpenv local 5.4
+ ./autotest.sh mysql
+ '''
+ }
+ executeAndReport('tests/autotest-results-pgsql.xml') {
+ sh '''
+ export NOCOVERAGE=1
+ unset USEDOCKER
+ phpenv local 5.6
+ ./autotest.sh pgsql
+ '''
+ }
+ executeAndReport('tests/autotest-results-oci.xml') {
+ sh '''
+ export NOCOVERAGE=1
+ unset USEDOCKER
+ phpenv local 5.5
+ ./autotest.sh oci
+ '''
+ }
+
+ stage 'Files External Testing'
+ executeAndReport('tests/autotest-external-results-sqlite-webdav-ownCloud.xml') {
+ sh '''phpenv local 5.6
+ export NOCOVERAGE=1
+ unset USEDOCKER
+ ./autotest-external.sh sqlite webdav-ownCloud
+ '''
+ }
+}
+
+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) {
+ 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()
+ }
+ }
+}