-
Notifications
You must be signed in to change notification settings - Fork 29
/
Jenkinsfile
132 lines (129 loc) · 2.83 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
#!/usr/bin/env groovy
pipeline {
agent none
environment {
CHROME_BIN = 'chromium-browser'
NPM_CONFIG_CACHE = '/tmp/npm-cache'
}
options { buildDiscarder(logRotator(numToKeepStr: '50')) }
stages {
stage('Check which files changed') {
agent {
label "master"
}
steps {
script {
gitChanges = sh(returnStdout: true, script: 'git diff origin/master --name-only')
}
}
}
stage('Test') {
parallel {
stage('JS Lint') {
when {
expression {
return env.BRANCH_NAME == 'master' || gitChanges.contains('.js')
}
}
agent {
dockerfile {
label 'docker'
}
}
steps {
sh 'make lintci'
junit allowEmptyResults: true, testResults: 'eslint.xml'
}
post {
always {
cleanWs()
}
}
}
stage('Unittest') {
when {
expression {
return env.BRANCH_NAME == 'master' || gitChanges.contains('.js')
}
}
agent {
dockerfile {
label 'docker'
}
}
steps {
sh 'make jstestci'
junit 'test/js/result/**/unit.xml'
}
post {
always {
cleanWs()
}
}
}
stage('PHP Lint') {
when {
expression {
return env.BRANCH_NAME == 'master' || gitChanges.contains('.php')
}
}
agent {
dockerfile {
label 'docker'
}
}
steps {
sh 'make phplintci'
junit allowEmptyResults: true, testResults: 'phpmd.xml'
}
post {
always {
cleanWs()
}
}
}
}
}
stage('PHP Unit tests') {
when {
expression {
return env.BRANCH_NAME == 'master' || gitChanges.contains('.php')
}
}
agent {
label "master"
}
steps {
sh 'make -C test/php test EXTRA_LOCAL_ADMIN_USER=$(id -u) DOCKERCOMPOSE_UP_ARGS=--build DOCKERCOMPOSE_EXEC_ARGS="-T -u $(id -u) -e HOME=/workspace" || true'
sh 'chown -R $(id -u) test/php || true'
junit testResults: 'test/php/webapp-phptests.xml'
publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'test/php/htmlcov', reportFiles: 'index.html', reportName: 'PHP HTML Report', reportTitles: ''])
}
post {
always {
sh 'make -C test/php test-kopano-ci-clean'
}
}
}
stage('JS Coverage') {
agent {
dockerfile {
label 'docker'
}
}
when {
branch 'master'
}
steps {
sh 'make jstestcov'
cobertura coberturaReportFile: 'test/js/coverage/cobertura.xml', failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 10
publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'test/js/coverage/report-html', reportFiles: 'index.html', reportName: 'JS HTML Report', reportTitles: ''])
}
post {
always {
cleanWs()
}
}
}
}
}