|
| 1 | +#!/bin/bash |
| 2 | +# Copyright 2019 Google LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +set -eo pipefail |
| 17 | + |
| 18 | +## Get the directory of the build script |
| 19 | +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) |
| 20 | +## cd to the parent directory, i.e. the root of the git repo |
| 21 | +cd ${scriptDir}/.. |
| 22 | + |
| 23 | +# Print out Java version |
| 24 | +java -version |
| 25 | +echo ${JOB_TYPE} |
| 26 | + |
| 27 | +mvn install -B -V \ |
| 28 | + -DskipTests=true \ |
| 29 | + -Dclirr.skip=true \ |
| 30 | + -Denforcer.skip=true \ |
| 31 | + -Dmaven.javadoc.skip=true \ |
| 32 | + -Dgcloud.download.skip=true \ |
| 33 | + -T 1C |
| 34 | + |
| 35 | +# if GOOGLE_APPLICATION_CREDIENTIALS is specified as a relative path prepend Kokoro root directory onto it |
| 36 | +if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then |
| 37 | + export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_ROOT}/src/${GOOGLE_APPLICATION_CREDENTIALS}) |
| 38 | +fi |
| 39 | + |
| 40 | +case ${JOB_TYPE} in |
| 41 | +test) |
| 42 | + mvn test -B -Dclirr.skip=true -Denforcer.skip=true |
| 43 | + bash ${KOKORO_GFILE_DIR}/codecov.sh |
| 44 | + bash .kokoro/coerce_logs.sh |
| 45 | + ;; |
| 46 | +lint) |
| 47 | + mvn com.coveo:fmt-maven-plugin:check |
| 48 | + ;; |
| 49 | +javadoc) |
| 50 | + mvn javadoc:javadoc javadoc:test-javadoc |
| 51 | + ;; |
| 52 | +integration) |
| 53 | + mvn -B ${INTEGRATION_TEST_ARGS} \ |
| 54 | + -DtrimStackTrace=false \ |
| 55 | + -Dclirr.skip=true \ |
| 56 | + -Denforcer.skip=true \ |
| 57 | + -fae \ |
| 58 | + verify |
| 59 | + bash .kokoro/coerce_logs.sh |
| 60 | + ;; |
| 61 | +clirr) |
| 62 | + mvn -B -Denforcer.skip=true clirr:check |
| 63 | + ;; |
| 64 | +*) |
| 65 | + ;; |
| 66 | +esac |
0 commit comments