forked from pytition/Pytition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
49 lines (41 loc) · 1.55 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
#!groovy
// This deployment script assumes that there is only a single Jenkins server (master) and there are no agents.
// If the setup includes agents, then the stages should be reconfigured to take advantage of additional remote nodes.
// This script is assuming that you're using a multi-branch project but the majority directly translates to a regular pipeline project.
node {
checkout scm
sh '''
cd $WORKSPACE
rm -rf venv && virtualenv -p python3 venv
source venv/bin/activate
pip3 install -r requirements_dev.txt
cat <<ENDOFFILE > my.cnf
[client]
database = pytition
user = pytition
password = pytition
default-character-set = utf8
ENDOFFILE
echo "Updating settings to use your my.cnf"
sed -i -e "s@/home/petition/www/@$PWD/@" pytition/pytition/settings/base.py
echo "Running database migrations"
cd pytition && python3 ./manage.py migrate && cd -
echo "Running tests"
coverage erase
coverage run ./pytition/manage.py test --noinput petition
coverage xml --include='pytition/*'
deactivate
'''
step([$class: 'CoberturaPublisher',
autoUpdateHealth: false,
autoUpdateStability: false,
coberturaReportFile: 'coverage.xml',
failNoReports: false,
failUnhealthy: false,
failUnstable: false,
maxNumberOfBuilds: 10,
onlyStable: false,
sourceEncoding: 'ASCII',
zoomCoverageChart: false]
)
}