forked from geodynamics/aspect
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile.osx
136 lines (121 loc) · 3.84 KB
/
Jenkinsfile.osx
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
#!groovy
/*
This Jenkins job runs a build on OSX
See https://ci.tjhei.info/job/aspect-osx/ for details.
*/
/*
Settings to apply inside Jenkins:
- discover pull requests (remove branches/master)
- Strategy: merged PR
- enable "Disable GitHub Multibranch Status Plugin"
- trigger build on pull request comment: .* /rebuild.* (without space!)
- Jenkinsfile: choose Jenkinsfile.osx
- scan: every 4 hours
- discard: 5+ items
*/
// load library https://github.com/tjhei/jenkins-stuff to provide
// killold.killOldBuilds() function:
@Library('tjhei') _
pipeline
{
agent none
stages
{
stage("abort old")
{
agent none
steps
{
githubNotify context: 'Jenkins: OSX', description: 'initializing...', status: 'PENDING'
// kill older builds in this PR:
script { killold.killOldBuilds() }
}
}
stage("main")
{
agent
{
node
{
label 'osx'
}
}
post { cleanup { cleanWs() } }
stages
{
stage ("Check Permissions") {
when {
// check for "ready to test" if it is a PR and not by one of the people listed
allOf {
changeRequest()
not {changeRequest authorEmail: "[email protected]"}
not {changeRequest authorEmail: "[email protected]"}
not {changeRequest authorEmail: "[email protected]"}
not {changeRequest authorEmail: "[email protected]"}
not {changeRequest authorEmail: "[email protected]"}
not {changeRequest authorEmail: "[email protected]"}
not {changeRequest authorEmail: "[email protected]"}
not {changeRequest authorEmail: "[email protected]"}
not {changeRequest authorEmail: "[email protected]"}
not {changeRequest authorEmail: "[email protected]"}
}
}
steps {
// For /rebuild to work you need to:
// 1) select "issue comment" to be delivered in the github webhook setting
// 2) install "GitHub PR Comment Build Plugin" on Jenkins
// 3) in project settings select "add property" "Trigger build on pr comment" with
// the phrase ".*/rebuild.*" (without quotes)
sh '''
wget -q -O - https://api.github.com/repos/geodynamics/aspect/issues/${CHANGE_ID}/labels | grep 'ready to test' || \
{ echo "This commit will only be tested when it has the label 'ready to test'. Trigger a rebuild by adding a comment that contains '/rebuild'..."; exit 1; }
'''
}
post
{
failure
{
githubNotify context: 'Jenkins: OSX', description: 'need ready to test label and /rebuild', status: 'PENDING'
script
{
currentBuild.result='NOT_BUILT'
}
}
}
}
stage('build')
{
steps
{
timeout(time: 2, unit: 'HOURS')
{
sh "echo \"building on node ${env.NODE_NAME}\""
sh '''#!/bin/bash
set -e
set -x
mkdir build && cd build
cmake \
-D DEAL_II_CXX_FLAGS='-Werror' \
$WORKSPACE/
make -j 8
ctest --output-on-failure
'''
githubNotify context: 'Jenkins: OSX', description: 'OK', status: 'SUCCESS'
}
}
post
{
always
{
archiveArtifacts artifacts: 'build/detailed.log', fingerprint: true
}
failure
{
githubNotify context: 'Jenkins: OSX', description: 'build failed', status: 'FAILURE'
}
}
}
}
}
}
}