-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtravis.sh
More file actions
executable file
·41 lines (35 loc) · 759 Bytes
/
travis.sh
File metadata and controls
executable file
·41 lines (35 loc) · 759 Bytes
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
#!/usr/bin/env bash
boxOut(){
local s="$*"
tput setaf 3
echo -e " =${s//?/=}=\n| $(tput setaf 4)$s$(tput setaf 3) |\n =${s//?/=}=\n"
tput sgr 0
}
isPullRequest() {
[[ "$TRAVIS_PULL_REQUEST" == "false" ]] && return 1 || return 0
}
exitOnFailedBuild() {
if [ $? -ne 0 ]; then
boxOut "BUILD FAILED: $1"
exit 1
fi
}
deployArtifacts() {
boxOut "Deploying artefact"
./gradlew :java-censor-plugin:uploadArchives
exitOnFailedBuild "Deploying artefact."
}
runTests() {
boxOut "Run tests"
./gradlew test
exitOnFailedBuild "Error running tests."
}
if isPullRequest ; then
boxOut "This is a PR."
runTests
else
boxOut "This is a branch build."
runTests
deployArtifacts
fi
exit 0