2018-05-30 16:02:57 +02:00
|
|
|
#!/usr/bin/env bash
|
2019-05-31 15:33:40 +02:00
|
|
|
set -euo pipefail
|
2015-06-03 11:41:53 +02:00
|
|
|
|
2017-08-01 13:51:37 +02:00
|
|
|
./.travis/setup_ramdisk.sh
|
|
|
|
|
2017-02-20 21:45:22 +01:00
|
|
|
#
|
|
|
|
# Configure Maven settings and install some script utilities
|
|
|
|
#
|
2018-05-30 16:10:05 +02:00
|
|
|
configureTravis() {
|
2017-05-05 14:31:54 +02:00
|
|
|
mkdir -p ~/.local
|
2019-03-08 09:41:04 +01:00
|
|
|
curl -sSL https://github.com/SonarSource/travis-utils/tarball/v55 | tar zx --strip-components 1 -C ~/.local
|
2015-07-24 16:35:08 +02:00
|
|
|
source ~/.local/bin/install
|
2015-07-07 23:50:39 +02:00
|
|
|
}
|
2016-01-29 21:39:18 +01:00
|
|
|
configureTravis
|
2017-01-11 10:10:21 +01:00
|
|
|
|
2018-03-20 21:24:33 +01:00
|
|
|
#
|
|
|
|
# Travis fails on timeout when build does not print logs
|
2018-05-30 16:10:05 +02:00
|
|
|
# during 10 minutes. This aims to bypass this
|
2018-03-20 21:24:33 +01:00
|
|
|
# behavior when building the slow sonar-server sub-project.
|
|
|
|
#
|
2018-05-30 16:10:05 +02:00
|
|
|
keep_alive() {
|
2018-03-20 20:43:10 +01:00
|
|
|
while true; do
|
2018-03-20 21:24:33 +01:00
|
|
|
echo -en "\a"
|
|
|
|
sleep 60
|
2018-03-20 20:43:10 +01:00
|
|
|
done
|
|
|
|
}
|
|
|
|
keep_alive &
|
|
|
|
|
2017-11-24 16:28:11 +01:00
|
|
|
# When a pull request is open on the branch, then the job related
|
|
|
|
# to the branch does not need to be executed and should be canceled.
|
|
|
|
# It does not book slaves for nothing.
|
2017-04-20 09:47:11 +02:00
|
|
|
# @TravisCI please provide the feature natively, like at AppVeyor or CircleCI ;-)
|
2017-11-24 16:28:11 +01:00
|
|
|
cancel_branch_build_with_pr || if [[ $? -eq 1 ]]; then exit 0; fi
|
2017-04-20 09:47:11 +02:00
|
|
|
|
2015-11-24 17:42:32 +01:00
|
|
|
case "$TARGET" in
|
|
|
|
|
2017-02-20 21:45:22 +01:00
|
|
|
BUILD)
|
2018-11-27 11:15:37 +01:00
|
|
|
git fetch --unshallow
|
2019-05-31 15:55:56 +02:00
|
|
|
./gradlew build --no-daemon --console plain
|
2019-05-31 10:14:16 +02:00
|
|
|
|
2019-05-31 15:33:40 +02:00
|
|
|
# the '-' at the end is needed when using set -u (the 'nounset' flag)
|
|
|
|
# see https://stackoverflow.com/a/9824943/641955
|
|
|
|
if [[ -n "${SONAR_TOKEN-}" ]]; then
|
2019-05-31 15:55:56 +02:00
|
|
|
./gradlew jacocoTestReport sonarqube --no-daemon --console plain \
|
2019-05-31 10:14:16 +02:00
|
|
|
-Dsonar.projectKey=org.sonarsource.sonarqube:sonarqube \
|
|
|
|
-Dsonar.organization=sonarsource \
|
|
|
|
-Dsonar.host.url=https://sonarcloud.io \
|
|
|
|
-Dsonar.login="$SONAR_TOKEN"
|
|
|
|
fi
|
2015-06-03 11:41:53 +02:00
|
|
|
;;
|
|
|
|
|
2017-02-20 21:45:22 +01:00
|
|
|
WEB_TESTS)
|
2018-03-23 17:17:10 +01:00
|
|
|
./gradlew :server:sonar-web:yarn :server:sonar-web:yarn_validate --no-daemon --console plain
|
|
|
|
./gradlew :server:sonar-vsts:yarn :server:sonar-vsts:yarn_validate --no-daemon --console plain
|
2015-06-19 15:59:31 +02:00
|
|
|
;;
|
2018-03-12 10:48:44 +01:00
|
|
|
|
2015-11-24 17:42:32 +01:00
|
|
|
*)
|
|
|
|
echo "Unexpected TARGET value: $TARGET"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
|
2015-06-03 11:41:53 +02:00
|
|
|
esac
|
2018-03-20 16:54:19 +01:00
|
|
|
|