forked from Kopano-dev/grapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
91 lines (88 loc) · 2.44 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
#!/usr/bin/env groovy
def buildNumber = env.BUILD_NUMBER as int
if (buildNumber > 1) milestone(buildNumber - 1)
milestone(buildNumber)
pipeline {
agent none
environment {
CI = 'true'
DEBIAN_FRONTEND = 'noninteractive'
REPO_URL = 'https://download.kopano.io/supported/core:/master/Ubuntu_18.04/'
PYTHONDONTWRITEBYTECODE = '1'
}
stages {
stage('Lint/Test') {
agent {
docker {
image 'ubuntu:bionic'
args '-u 0 -e PYTHONDONTWRITEBYTECODE=1'
label 'docker'
}
}
stages {
stage('Bootstrap') {
steps {
echo 'Bootstrapping'
sh 'apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
isort \
libcap-dev \
libdb-dev \
libev-dev \
libldap2-dev \
libpcap-dev \
libsasl2-dev \
python3-dev \
python3-pip \
python3-pytest \
python3-pytest-cov \
python3-wheel \
flake8 \
'
sh 'echo "deb [trusted=yes] ${REPO_URL} ./" > /etc/apt/sources.list.d/kopano.list'
sh 'apt-get update'
sh 'apt-get install -y python3-kopano'
// Filter out already installed dependencies
sh 'grep -Ev "kopano|MAPI" requirements.txt > /tmp/jenkins_requirements.txt'
sh 'pip3 install -r /tmp/jenkins_requirements.txt'
}
}
stage('Lint') {
steps {
echo 'Linting..'
sh 'make lint > pylint.log || true'
recordIssues tool: pyLint(pattern: 'pylint.log'), qualityGates: [[threshold: 40, type: 'TOTAL', unstable: true]]
echo 'Isort..'
sh 'make test-isort'
}
}
stage('Test') {
steps {
echo 'Testing..'
sh 'make test'
}
}
}
}
stage('Integration Test') {
agent { label 'docker' }
stages {
stage('Run test') {
steps {
echo 'Integration testing..'
sh 'make -C test test-backend-kopano-ci-run 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/coverage || true'
junit 'test/coverage/integration/backend.kopano/integration.xml'
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: true, reportDir: 'test/coverage/integration/backend.kopano', reportFiles: 'index.html', reportName: 'Kopano Backend Coverage Report', reportTitles: ''])
}
}
}
post {
always {
sh 'make -C test test-backend-kopano-ci-clean'
}
}
}
}
}