-
Notifications
You must be signed in to change notification settings - Fork 9
/
Jenkinsfile
94 lines (74 loc) · 2.48 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
def git_user_email = "[email protected]"
def git_user_name = "Tobor"
def ssh_sh(String action) {
sh """
ssh-agent sh -c 'ssh-add ; $action'
"""
}
// the order of the formulae is very important: snips-platform-common must be first
def formulae = [
"snips-platform-common.rb",
"libsnips_megazord.rb",
"snips-analytics.rb",
"snips-asr-google.rb",
"snips-asr.rb",
"snips-audio-server.rb",
"snips-dialogue.rb",
"snips-hotword.rb",
"snips-injection.rb",
"snips-nlu.rb",
"snips-skill-server.rb",
"snips-tts.rb",
"snips-watch.rb",
]
node("macos-elcapitan-homebrew") {
def platformTag = "${params.tag}"
def formulaPaths = formulae.collect { formula -> "Formula/${formula}" }.join(" ")
def formulaPathsToAudit = formulae.findAll{ it != "libsnips_megazord.rb" }.collect { formula -> "Formula/${formula}" }.join(" ")
def git_url = "[email protected]:snipsco/snips-platform.git"
properties([
parameters([
string(defaultValue: 'NONE', description: 'tag to build', name: 'tag'),
booleanParam(defaultValue: false, description: 'merge,upload and push to prod', name: 'push_to_prod'),
])
])
stage('Checkout') {
deleteDir()
checkout scm
}
stage('Audit Formula') {
ssh_sh """
set -e
git config --global user.email ${git_user_email}
git config --global user.name ${git_user_name}
git clone --branch $platformTag --depth 1 ${git_url}
revision=\$(cd snips-platform && git rev-parse $platformTag)
.ci/bump.sh $platformTag \$revision $formulaPaths
.ci/audit.sh $formulaPathsToAudit
"""
}
formulae.each{ formula ->
def formulaPath = "Formula/${formula}"
stage("Make ${formula}") {
ssh_sh """
set -e
.ci/make_bottles.sh $formulaPath
"""
}
}
if(params.push_to_prod.toBoolean()) {
stage('Release') {
ssh_sh """
set -e
git config --global user.email ${git_user_email}
git config --global user.name ${git_user_name}
.ci/rename_bottles.sh '*.bottle.json'
.ci/merge.sh '*.bottle.json'
.ci/upload_bottles.sh
git checkout master
git commit -am "[Release] ${platformTag}"
git push origin master
"""
}
}
}