-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
92 lines (89 loc) · 3.56 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
/*
* ingenialogger
*
* Copyright (c) 2020 Ingenia Motion Control.
*/
def SW_NODE = "windows-slave"
pipeline {
agent none
stages {
stage('Build wheels and documentation') {
agent {
docker {
label SW_NODE
image 'ingeniacontainers.azurecr.io/win-python-builder:1.0'
}
}
stages {
stage('Clone repository') {
steps {
bat """
cd C:\\Users\\ContainerAdministrator
git clone https://github.com/ingeniamc/ingenialogger.git
cd ingenialogger
git checkout ${env.GIT_COMMIT}
"""
}
}
stage('Install deps') {
steps {
bat '''
cd C:\\Users\\ContainerAdministrator\\ingenialogger
python -m venv venv
venv\\Scripts\\python.exe -m pip install -r requirements\\dev-requirements.txt
venv\\Scripts\\python.exe -m pip install -e .
'''
}
}
stage('Check formatting') {
steps {
bat """
cd C:\\Users\\ContainerAdministrator\\ingenialogger
venv\\Scripts\\python.exe -m black -l 100 --check ingenialogger tests
"""
}
}
stage('Run unit tests') {
steps {
bat """
cd C:\\Users\\ContainerAdministrator\\ingenialogger
venv\\Scripts\\python.exe -m pytest tests --junitxml=pytest_report.xml
venv\\Scripts\\python.exe -m coverage xml --include=ingenialogger/*
COPY pytest_report.xml ${env.WORKSPACE}\\pytest_report.xml
COPY coverage.xml ${env.WORKSPACE}\\coverage.xml
"""
junit 'pytest_report.xml'
publishCoverage adapters: [coberturaReportAdapter('coverage.xml')]
}
}
stage('Generate documentation') {
steps {
bat '''
cd C:\\Users\\ContainerAdministrator\\ingenialogger
venv\\Scripts\\python.exe -m sphinx -b html docs _docs
'''
}
}
stage('Build wheels') {
steps {
bat '''
cd C:\\Users\\ContainerAdministrator\\ingenialogger
venv\\Scripts\\python.exe setup.py bdist_wheel
'''
}
}
stage('Archive') {
steps {
bat """
cd C:\\Users\\ContainerAdministrator\\ingenialogger
"C:\\Program Files\\7-Zip\\7z.exe" a -r docs.zip -w _docs -mem=AES256
XCOPY dist ${env.WORKSPACE}\\dist /i
XCOPY docs.zip ${env.WORKSPACE}
"""
archiveArtifacts artifacts: "dist\\*, docs.zip"
}
}
}
}
}
}