forked from IDAES/idaes-pse
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
148 lines (142 loc) · 5.16 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
###############################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES).
#
# Copyright (c) 2018-2023 by the software owners: The Regents of the
# University of California, through Lawrence Berkeley National Laboratory,
# National Technology & Engineering Solutions of Sandia, LLC, Carnegie Mellon
# University, West Virginia University Research Corporation, et al.
# All rights reserved. Please see the files COPYRIGHT.md and LICENSE.md
# for full copyright and license information.
###############################################################################
This file defines the build/test/post steps for Jenkins.
Dependencies: failed-test-email.template // This parses the output of Jenkins and formats the email that Jenkins sends
*/
def email_to = "[email protected]" // The email address that the build email will go to
def email_reply_to = "[email protected]" // The email address that will be in the reply-to
pipeline {
agent {
docker {
image 'conda/miniconda3-centos7:latest'
}
}
stages {
// Commented out for an example until we start using these parameters
// stage('cron-nightly-test') {
// when {
// expression { params.BUILD_SCHEDULE == 'Nightly'}
// }
// steps {
// sh 'echo "nightly works"'
// }
// }
// stage('cron-weekly-test') {
// when {
// expression { params.BUILD_SCHEDULE == 'Weekly'}
// }
// steps {
// sh 'echo "weekly works"'
// }
// }
stage('root-setup') {
steps {
// slackSend (message: "Build Started - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)")
sh 'mkdir -p $JENKINS_HOME/email-templates'
sh 'cp failed-test-email.template $JENKINS_HOME/email-templates'
sh 'yum install -y gcc g++ git gcc-gfortran libboost-dev make'
sh 'pwd'
}
}
stage('3.6-setup') {
when {
expression { params.PYTHON_VERSION == '3.6'}
}
steps {
sh '''
conda create -n idaes3.6 python=3.6 pytest
source activate idaes3.6
pip install -r requirements-dev.txt --user jenkins
export TEMP_LC_ALL=$LC_ALL
export TEMP_LANG=$LANG
export LC_ALL=en_US.utf-8
export LANG=en_US.utf-8
python setup.py install
idaes get-extensions
export LC_ALL=$TEMP_LC_ALL
export LANG=$TEMP_LANG
source deactivate
'''
}
}
stage('3.7-setup') {
when {
expression { params.PYTHON_VERSION == '3.7'}
}
steps {
sh '''
conda create -n idaes3.7 python=3.7 pytest
source activate idaes3.7
pip install -r requirements-dev.txt --user jenkins
export TEMP_LC_ALL=$LC_ALL
export TEMP_LANG=$LANG
export LC_ALL=en_US.utf-8
export LANG=en_US.utf-8
python setup.py install
idaes get-extensions
export LC_ALL=$TEMP_LC_ALL
export LANG=$TEMP_LANG
source deactivate
'''
}
}
stage('3.6-test') {
when {
expression { params.PYTHON_VERSION == '3.6'}
}
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh '''
source activate idaes3.6
pylint -E --ignore-patterns="test_.*" idaes || true
pytest --junitxml=results.xml -c pytest.ini idaes
source deactivate
'''
}
}
}
stage('3.7-test') {
when {
expression { params.PYTHON_VERSION == '3.7'}
}
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh '''
source activate idaes3.7
pylint -E --ignore-patterns="test_.*" idaes || true
pytest --junitxml=results.xml -c pytest.ini idaes
source deactivate
'''
}
}
}
}
post {
always {
junit allowEmptyResults: true, testResults: 'results.xml'
emailext attachLog: true, body: '''${SCRIPT, template="failed-test-email.template"}''', replyTo: '${email_reply_to}',
subject: "${JOB_NAME} ${params.PYTHON_VERSION} - Build ${BUILD_NUMBER} ${currentBuild.result}", to: '${email_to}'
}
// success {
// slackSend (color: '#00FF00', message: "SUCCESSFUL - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)")
// emailext attachLog: true, body: "${currentBuild.result}: ${BUILD_URL}", compressLog: true, replyTo: '[email protected]',
// subject: "Build Log: ${JOB_NAME} - Build ${BUILD_NUMBER} ${currentBuild.result}", to: '[email protected]'
// }
// failure {
// slackSend (color: '#FF0000', message: "FAILED - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)")
// emailext attachLog: true, body: "${currentBuild.result}: ${env.BUILD_URL}", compressLog: true, replyTo: '[email protected]',
// subject: "Build Log: ${env.JOB_NAME} - Build ${env.BUILD_NUMBER} ${currentBuild.result}", to: '[email protected]'
// }
}
}