-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
80 lines (75 loc) · 2.09 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
pipeline {
agent any
triggers {
pollSCM('*/5 * * * 1-5')
}
options {
skipDefaultCheckout(true)
// Keep the 10 most recent builds
buildDiscarder(logRotator(numToKeepStr: '10'))
//timestamps()
}
environment {
PATH = "$WORKSPACE/miniconda/bin:$PATH"
}
//timestamps {
stages {
stage('setup miniconda') {
steps {
sh '''#!/usr/bin/env bash
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $WORKSPACE/miniconda
#hash -r
#conda config --set always_yes yes --set changeps1 no
#conda update -q conda
# Useful for debugging any issues with conda
conda info -a
#conda config --add channels defaults
#conda config --add channels conda-forge
#conda config --add channels bioconda
# create snakemake-workflows env
conda init bash
conda create -n env python=3
'''
}
}
stage('Test downloading') {
steps {
sh '''#!/usr/bin/env bash
source $WORKSPACE/miniconda/etc/profile.d/conda.sh
conda activate miniconda/envs/env/
'''
}
}
stage ("Code pull"){
steps {
checkout scm
}
}
stage('Build environment') {
steps {
sh '''conda create --yes -n ${BUILD_TAG} python
source activate ${BUILD_TAG}
pip install -r requirements.txt
'''
}
}
stage('Test environment') {
steps {
sh '''source activate ${BUILD_TAG}
cd myproject
python3 manage.py test
'''
}
}
}
post {
always {
sh 'conda remove --yes -n ${BUILD_TAG} --all'
}
failure {
echo "Send e-mail, when failed"
}
}
}
//}