This repository has been archived by the owner on Jun 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Jenkinsfile
95 lines (93 loc) · 2.91 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
#!/usr/bin/env groovy
// Continuous Integration script for clinicadl
// Author: [email protected]
pipeline {
agent { label 'linux' }
stages {
stage('Launch in Linux') {
environment {
PATH = "$HOME/miniconda/bin:$PATH"
}
//when { changeset "requirements.txt" }
steps {
echo 'Installing clinicadl sources in Linux...'
echo 'My branch name is ${BRANCH_NAME}'
sh 'echo "My branch name is ${BRANCH_NAME}"'
sh 'printenv'
sh 'echo "Agent name: ${NODE_NAME}"'
sh '''#!/usr/bin/env bash
set +x
source $WORKSPACE/../../miniconda/etc/profile.d/conda.sh
conda create -y -n clinicadl_test python=3.7
conda activate clinicadl_test
echo "Install clinicadl using pip..."
cd $WORKSPACE/clinicadl
pip install -e .
# Show clinicadl help message
echo "Display clinicadl help message"
clinicadl --help
conda deactivate
'''
}
}
stage('CLI test Linux') {
environment {
PATH = "$HOME/miniconda/bin:$PATH"
}
steps {
echo 'Testing pipeline instantation...'
sh 'echo "Agent name: ${NODE_NAME}"'
sh '''#!/usr/bin/env bash
set +x
source $WORKSPACE/../../miniconda/etc/profile.d/conda.sh
conda activate clinicadl_test
pip install pytest
pytest --junitxml=./test-reports/report_test_cli.xml --verbose \
--disable-warnings \
$WORKSPACE/clinicadl/tests/test_cli.py
conda deactivate
'''
}
post {
always {
junit 'test-reports/*.xml'
}
}
}
stage('Classify test Linux') {
environment {
PATH = "$HOME/miniconda/bin:$PATH"
}
steps {
echo 'Testing classify...'
sh 'echo "Agent name: ${NODE_NAME}"'
sh '''#!/usr/bin/env bash
set +x
source $WORKSPACE/../../miniconda/etc/profile.d/conda.sh
conda activate clinicadl_test
cd $WORKSPACE/clinicadl/tests
ln -s /mnt/data/data_CI ./data
pytest \
--junitxml=../../test-reports/report_test_classify.xml \
--verbose \
--disable-warnings \
test_classify.py
find ./data/models/ -name 'DB-TEST_*' -type f -delete
conda deactivate
'''
}
post {
always {
junit 'test-reports/*.xml'
}
}
}
}
post {
failure {
mail to: '[email protected]',
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
body: "Something is wrong with ${env.BUILD_URL}"
}
}
}