forked from korbit-ai/codejail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
76 lines (70 loc) · 2.17 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
pipeline {
agent { label "codejail-worker" }
options {
timeout(30)
}
stages {
stage('Install tox') {
steps {
withPythonEnv('PYTHON_3.5') {
sh '''
pip install -r requirements/tox.txt
'''
}
}
}
// Conditional stage: only run in quality checking context.
stage('Run code quality checks') {
when {
environment name: 'TOX_ENV', value: 'quality'
}
environment {
CODEJAIL_TEST_USER = 'sandbox'
CODEJAIL_TEST_VENV = "/home/sandbox/codejail_sandbox-python${PYTHON_VERSION}"
}
steps {
withPythonEnv('PYTHON_3.5') {
script {
sh '''
tox -e $TOX_ENV
'''
}
}
}
}
// Conditional stage: only run for unit testing context (i.e. NOT quality checking).
stage('Run the tests for each sandbox') {
when {
not {
environment name: 'TOX_ENV', value: 'quality'
}
}
parallel {
stage('Run unit tests without proxy') {
environment {
CODEJAIL_TEST_USER = 'sandbox'
CODEJAIL_TEST_VENV = "/home/sandbox/codejail_sandbox-python${PYTHON_VERSION}"
}
steps {
withPythonEnv('PYTHON_3.5') {
script {
try {
sh '''
tox -e $TOX_ENV
'''
} finally {
junit testResults: '**/reports/pytest*.xml'
}
}
}
}
}
}
}
}
post {
always {
deleteDir()
}
}
}