xref: /OpenGrok/dev/main (revision 767d112dd43415435c5de068044fce96666ea99c)
1aba5f4cfSVladimir Kotal#!/bin/bash
2aba5f4cfSVladimir Kotal
3aba5f4cfSVladimir Kotal#
4cb86d517SVladimir Kotal# Do not run coverage for forks as most people do not have extra tools enabled
54ff8cd68SVladimir Kotal# for their fork. Avoid it also for release builds as that can fail such
64ff8cd68SVladimir Kotal# build unnecessarily.
7aba5f4cfSVladimir Kotal#
8bf78b550SVladimir Kotal
9bf78b550SVladimir Kotalif [[ -n $OPENGROK_REF && $OPENGROK_REF == refs/heads/* ]]; then
10bf78b550SVladimir Kotal	OPENGROK_BRANCH=${OPENGROK_REF#"refs/heads/"}
11bf78b550SVladimir Kotalfi
12bf78b550SVladimir Kotal
13aba5f4cfSVladimir Kotalextra_args=""
14bf78b550SVladimir Kotalif [[ "x$OPENGROK_REPO_SLUG" == "xoracle/opengrok" && "x$OPENGROK_BRANCH" == "xmaster" ]]; then
153db07792SVladimir Kotal	echo "Enabling Coveralls"
16d5980033SVladimir Kotal	if [[ -n $OPENGROK_COVERALLS_TOKEN ]]; then
17d5980033SVladimir Kotal		extra_args="$extra_args -DrepoToken=$OPENGROK_COVERALLS_TOKEN"
18d5980033SVladimir Kotal	fi
19d5980033SVladimir Kotal	extra_args="$extra_args jacoco:report coveralls:report"
2064cffec5SVladimir Kotal
2164cffec5SVladimir Kotal	#
2264cffec5SVladimir Kotal	# Sonar seems to only work on master branch commits.
2364cffec5SVladimir Kotal	#
2415712e9aSVladimir Kotal	if [[ -z "${OPENGROK_PULL_REQUEST}" ]]; then
2564cffec5SVladimir Kotal		echo "Enabling Sonar"
26*767d112dSVladimir Kotal		extra_args="$extra_args -P sonar -Dsonar.login=$OPENGROK_SONAR_TOKEN sonar:sonar"
27aba5f4cfSVladimir Kotal	fi
2864cffec5SVladimir Kotalfi
29aba5f4cfSVladimir Kotal
30d5d2ac4cSVladimir Kotal./mvnw -B -V verify $extra_args
31