-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
61 lines (58 loc) · 2.03 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
pipeline {
agent any
environment {
TEMP_DIR="/tmp/${env.JOB_NAME}/${env.ghprbActualCommit}"
}
stages {
stage('Setting up env') {
steps {
echo "[[ Start virtual environment ]]"
sh """
echo "[ Current directory ] : " `pwd`
echo "[ Environment Variables ] "
env
# Each stage needs custom setting done again. By default /bin/python is used.
source /home/qcadmin/py310/bin/activate
mkdir -p $TEMP_DIR
python -m venv $TEMP_DIR/venv
# activate new virtual env
source $TEMP_DIR/venv/bin/activate
echo "[ Python used ] : " `which python`
cd ${env.WORKSPACE}
echo "[ Install dependencies ]"
pip install -r requirements.txt
echo "[ Install qcore ]"
cd $TEMP_DIR
rm -rf qcore
git clone https://github.com/ucgmsim/qcore.git
cd qcore
pip install -r requirements.txt
pip install -e .
"""
}
}
stage('Run regression tests') {
steps {
echo '[[ Run pytest ]]'
sh """
# activate virtual environment again
source $TEMP_DIR/venv/bin/activate
echo "[ Python used ] : " `which python`
cd ${env.WORKSPACE}
echo "[ Installing ${env.JOB_NAME} ]"
pip install -e .
echo "[ Run test now ]"
pytest --black --ignore=geoNet --ignore=NonUniformGrid --ignore=RegionalSeismicityTectonics --ignore=SrfGen/NHM/deprecated --ignore=test
"""
}
}
}
post {
always {
echo 'Tear down the environments'
sh """
rm -rf $TEMP_DIR
"""
}
}
}