kokoro: Pretty test results

Previously, only Windows had the plumbing to rename test results for
the Kokoro result viewers to pretty-print.

macos.cfg was the only CI that lacked a corresponding .sh, which maked
unix.sh harder to reason about. Created macos.sh so that unix.sh is now
just a helper script and will not be called directly by Kokoro.

We now avoid "gradle clean" to avoid wiping results. Still clean compiler
since we do re-run the build multiple times with varying platforms.
Shouldn't be necessary, but "just in case" since I want this commit to
be low risk. This improves Windows to produce detailed results even
if the CI was successful.
This commit is contained in:
Eric Anderson 2022-01-12 15:44:01 -08:00 committed by GitHub
parent 7a23fb27fe
commit 39cc44e38c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 38 additions and 11 deletions

9
buildscripts/kokoro/kokoro.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
spongify_logs() {
local f
while read -r f; do
mkdir "${f%.xml}"
cp "$f" "${f%.xml}/sponge_log.xml"
done < <(find "${KOKORO_ARTIFACTS_DIR:-.}" -name 'TEST-*.xml')
}

View File

@ -6,6 +6,7 @@ timeout_mins: 60
action {
define_artifacts {
regex: "github/grpc-java/**/build/test-results/**/sponge_log.xml"
regex: "github/grpc-java/mvn-artifacts/**"
regex: "github/grpc-java/artifacts/**"
}

View File

@ -5,6 +5,11 @@ if [[ -f /VERSION ]]; then
cat /VERSION
fi
readonly GRPC_JAVA_DIR="$(cd "$(dirname "$0")"/../.. && pwd)"
. "$GRPC_JAVA_DIR"/buildscripts/kokoro/kokoro.sh
trap spongify_logs EXIT
cd github/grpc-java
buildscripts/qemu_helpers/prepare_qemu.sh

View File

@ -6,6 +6,7 @@ timeout_mins: 60
action {
define_artifacts {
regex: "github/grpc-java/**/build/test-results/**/sponge_log.xml"
regex: "github/grpc-java/mvn-artifacts/**"
regex: "github/grpc-java/artifacts/**"
}

View File

@ -7,6 +7,9 @@ fi
readonly GRPC_JAVA_DIR="$(cd "$(dirname "$0")"/../.. && pwd)"
. "$GRPC_JAVA_DIR"/buildscripts/kokoro/kokoro.sh
trap spongify_logs EXIT
"$GRPC_JAVA_DIR"/buildscripts/build_docker.sh
"$GRPC_JAVA_DIR"/buildscripts/run_in_docker.sh /grpc-java/buildscripts/build_artifacts_in_docker.sh

View File

@ -1,7 +1,7 @@
# Config file for internal CI
# Location of the continuous shell script in repository.
build_file: "grpc-java/buildscripts/kokoro/unix.sh"
build_file: "grpc-java/buildscripts/kokoro/macos.sh"
timeout_mins: 45
# We had problems with random tests timing out because it took seconds to do
@ -15,7 +15,7 @@ env_vars {
# We always build mvn artifacts.
action {
define_artifacts {
regex: "github/grpc-java/**/build/reports/**"
regex: "github/grpc-java/**/build/test-results/**/sponge_log.xml"
regex: "github/grpc-java/mvn-artifacts/**"
}
}

13
buildscripts/kokoro/macos.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
set -veux -o pipefail
if [[ -f /VERSION ]]; then
cat /VERSION
fi
readonly GRPC_JAVA_DIR="$(cd "$(dirname "$0")"/../.. && pwd)"
. "$GRPC_JAVA_DIR"/buildscripts/kokoro/kokoro.sh
trap spongify_logs EXIT
"$GRPC_JAVA_DIR"/buildscripts/kokoro/unix.sh

View File

@ -16,10 +16,6 @@ set -exu -o pipefail
# It would be nicer to use 'readlink -f' here but osx does not support it.
readonly GRPC_JAVA_DIR="$(cd "$(dirname "$0")"/../.. && pwd)"
if [[ -f /VERSION ]]; then
cat /VERSION
fi
# cd to the root dir of grpc-java
cd $(dirname $0)/../..
@ -48,7 +44,7 @@ export LD_LIBRARY_PATH=/tmp/protobuf/lib
export LDFLAGS=-L/tmp/protobuf/lib
export CXXFLAGS="-I/tmp/protobuf/include"
./gradlew clean $GRADLE_FLAGS
./gradlew grpc-compiler:clean $GRADLE_FLAGS
if [[ -z "${SKIP_TESTS:-}" ]]; then
# Ensure all *.proto changes include *.java generated code
@ -62,7 +58,6 @@ if [[ -z "${SKIP_TESTS:-}" ]]; then
# Run tests
./gradlew build :grpc-all:jacocoTestReport $GRADLE_FLAGS
pushd examples
./gradlew clean $GRADLE_FLAGS
./gradlew build $GRADLE_FLAGS
# --batch-mode reduces log spam
mvn verify --batch-mode

View File

@ -7,7 +7,7 @@ timeout_mins: 45
# We always build mvn artifacts.
action {
define_artifacts {
regex: "**/build/test-results/**/*.xml"
regex: "github/grpc-java/**/build/test-results/**/sponge_log.xml"
regex: "github/grpc-java/mvn-artifacts/**"
}
}

View File

@ -32,4 +32,4 @@ SET GRADLE_FLAGS=-PtargetArch=%TARGET_ARCH% -PfailOnWarnings=%FAIL_ON_WARNINGS%
@rem make sure no daemons have any files open
cmd.exe /C "%WORKSPACE%\gradlew.bat --stop"
cmd.exe /C "%WORKSPACE%\gradlew.bat %GRADLE_FLAGS% -Dorg.gradle.parallel=false -PrepositoryDir=%WORKSPACE%\artifacts clean grpc-compiler:build grpc-compiler:publish" || exit /b 1
cmd.exe /C "%WORKSPACE%\gradlew.bat %GRADLE_FLAGS% -Dorg.gradle.parallel=false -PrepositoryDir=%WORKSPACE%\artifacts grpc-compiler:clean grpc-compiler:build grpc-compiler:publish" || exit /b 1