forked from underworldcode/UWGeodynamics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkinsfile
68 lines (58 loc) · 1.59 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
#!groovy
/* A Jenkins "Declarative" Pipeline file.
See http://130.56.252.251:32779
*/
pipeline {
// define the docker environment to run the pipeline in.
agent {
docker {
image 'underworldcode/uwgeodynamics:dev'
// special label to jenkins config. See http://130.56.252.251:32779/computer/
label 'uwgeo-hector'
}
}
stages {
// Build stage: compile the code
stage('Build') {
steps {
withEnv(["HOME=${env.WORKSPACE}"]) {
sh 'pip3 install --user pytest'
sh "pip3 install . --user"
sh "cp .local/lib/python*/site-packages/UWGeodynamics/version.py UWGeodynamics/."
}
}
}
// Test stage: runs the basic tests
stage('Test') {
steps {
withEnv(["HOME=${env.WORKSPACE}"]) {
sh 'python -m pytest -v'
}
}
}
}
/* For post build analysis */
post {
failure {
// notify users when the Pipeline fails
emailext (
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
body: "Something is wrong with ${env.BUILD_URL}",
// mimeType: 'text/html',
to: '[email protected]'
)
}
success {
script {
if (currentBuild.previousBuild != null && currentBuild.previousBuild.result != 'SUCCESS') {
emailext (
subject: "Back to normal: ${currentBuild.fullDisplayName}",
body: "Project is back to normal",
// mimeType: 'text/html',
to: '[email protected]'
)
}
}
}
}
}