forked from IntelLabs/nlp-architect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
109 lines (105 loc) · 2.66 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
/*
* NLP Architect Jenkinsfile
*/
def virt_env = '.nlp_env'
def createVirtualEnv(String name) {
sh "python3 -m venv ${name}"
}
def executeIn(String environment, String script) {
sh ". ${environment}/bin/activate && " + script
}
pipeline {
agent {
node {
label 'metal-node'
}
}
options {
timestamps()
}
stages {
stage('Checkout') {
steps {
deleteDir()
checkout scm
}
}
stage('Build environment') {
steps {
createVirtualEnv virt_env
executeIn virt_env, 'pip3 install -U pip setuptools'
executeIn virt_env, 'pip3 install -U -e .[all,dev]'
executeIn virt_env, 'python -m spacy download en'
}
}
stage('Tests') {
steps {
executeIn virt_env, 'pytest ./ -rs -v -n 20 --dist=loadfile --cov=nlp_architect --junit-xml=pytest_unit.xml'
}
post {
always {
junit 'pytest_unit.xml'
}
failure {
script {
currentBuild.result = 'FAILURE'
}
}
}
}
stage('flake8') {
steps {
executeIn virt_env, 'flake8 examples nlp_architect tests solutions --config setup.cfg'
}
post {
failure {
script {
currentBuild.result = 'FAILURE'
}
}
}
}
stage('pylint') {
steps {
executeIn virt_env, './scripts/check_pylint.sh'
}
post {
failure {
script {
currentBuild.result = 'FAILURE'
}
}
}
}
stage('Code Style') {
steps {
executeIn virt_env, 'black --check --line-length 100 --target-version py36 examples nlp_architect solutions tests'
}
post {
failure {
script {
currentBuild.result = 'FAILURE'
}
}
}
}
}
post {
aborted {
script {
currentBuild.result = 'FAILURE'
}
}
failure {
script {
currentBuild.result = 'FAILURE'
}
}
always {
deleteDir()
}
cleanup {
deleteDir()
}
}
}