Skip to content

Commit a932868

Browse files
committed
Extracting unit test error logs
1 parent d8aeba3 commit a932868

File tree

3 files changed

+57
-47
lines changed

3 files changed

+57
-47
lines changed

.github/workflows/build-and-test-pr.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ env:
1616
spring.version:5.3.24;
1717
spring-boot.version:2.7.6;
1818
'
19+
MAVEN_OPTS: >-
20+
-XX:+UseG1GC
21+
-XX:InitiatingHeapOccupancyPercent=45
22+
-XX:+UseStringDeduplication
23+
-XX:-TieredCompilation
24+
-XX:TieredStopAtLevel=1
1925
2026
jobs:
2127
check-format:
@@ -98,11 +104,13 @@ jobs:
98104
with:
99105
distribution: 'zulu'
100106
java-version: 21
107+
- name: Set current date as env variable
108+
run: echo "DATE_NOW=$(date +'%Y%m%d')" >> $GITHUB_ENV
101109
- uses: actions/cache@v3
102110
name: "Cache local Maven repository"
103111
with:
104112
path: ~/.m2/repository
105-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }}
113+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ env.DATE_NOW }}
106114
restore-keys: |
107115
${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
108116
${{ runner.os }}-maven-
@@ -114,7 +122,7 @@ jobs:
114122
- name: "Build Dubbo with Maven"
115123
run: |
116124
cd ./dubbo
117-
./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast clean source:jar install -Pjacoco,checkstyle -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.test.skip=true -Dmaven.test.skip.exec=true -DembeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper
125+
./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast clean install -Psources,skip-spotless,checkstyle -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.test.skip=true -Dmaven.test.skip.exec=true -DembeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper
118126
- name: "Pack class result"
119127
run: |
120128
shopt -s globstar
@@ -211,7 +219,11 @@ jobs:
211219
- name: "Test with Maven"
212220
timeout-minutes: 90
213221
run: |
214-
./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast clean test verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Pjacoco,jdk15ge-simple,'!jdk15ge',jacoco089 -DtrimStackTrace=false -Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false -DskipIntegrationTests=false -Dcheckstyle.skip=false -Dcheckstyle_unix.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true -DembeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper
222+
set -o pipefail
223+
./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress --fail-fast clean test verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Pjacoco,jdk15ge-simple,'!jdk15ge',jacoco089 -DtrimStackTrace=false -Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false -DskipIntegrationTests=false -Dcheckstyle.skip=false -Dcheckstyle_unix.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true -DembeddedZookeeperPath=${{ github.workspace }}/.tmp/zookeeper 2>&1 | tee >(grep -n -B 1 -A 200 "FAILURE! -- in" > test_errors.log)
224+
- name: "Print test error log"
225+
if: failure()
226+
run: cat test_errors.log
215227
- name: "Upload coverage result"
216228
uses: actions/upload-artifact@v3
217229
with:

build

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ print_help() {
5050
echo "Fast local compilation with incremental build and caching"
5151
echo "Options:"
5252
echo " -c Execute clean goal (removes build artifacts)"
53-
echo " -i Execute install goal (builds and installs the project)"
5453
echo " -p Execute compile goal (compiles the source code)"
54+
echo " -i Execute install goal (builds and installs the project)"
5555
echo " -t Execute test goal (runs the tests)"
5656
echo " -s Execute spotless:apply (format the code)"
5757
echo " -d Execute dependency:tree (displays the dependency tree)"
@@ -60,38 +60,40 @@ print_help() {
6060
echo " -h Display this help message"
6161
echo ""
6262
echo "Examples:"
63-
echo " $0 -ci Execute clean, install goals"
63+
echo " $0 Execute install goal compilation"
64+
echo " $0 -m Execute a minimal compilation"
65+
echo " $0 -ci Execute clean, install goals compilation"
6466
echo " $0 -s Execute spotless:apply"
67+
echo " $0 -d Display the dependency tree"
6568
echo " $0 -t -m dubbo-config Execute test goal for dubbo-config module"
6669
echo " $0 -cp -m dubbo-common Execute clean, compile the dubbo-common module"
67-
echo " $0 -d Display the dependency tree"
6870
exit 0
6971
}
7072

71-
while getopts ":ciptdsm:f:h" opt; do
73+
while getopts ":cpitstdm:f:h" opt; do
7274
case $opt in
7375
c)
7476
ARGS="$ARGS clean"
7577
;;
76-
i)
77-
ARGS="$ARGS install"
78-
;;
7978
p)
8079
ARGS="$ARGS compile"
8180
;;
81+
i)
82+
ARGS="$ARGS install"
83+
;;
8284
t)
8385
ARGS="$ARGS test"
8486
export MAVEN_OPTS=$(echo "$MAVEN_OPTS" | sed 's/-Dmaven\.test\.skip=true/-Dmaven.test.skip=false/')
8587
;;
86-
d)
87-
ARGS="$ARGS dependency:tree"
88-
;;
8988
s)
9089
ARGS="$ARGS spotless:apply"
9190
PROFILES="sources"
9291
;;
92+
d)
93+
ARGS="$ARGS dependency:tree"
94+
;;
9395
m)
94-
MODULES="-pl $OPTARG -am"
96+
MODULES=" -pl $OPTARG -am"
9597
;;
9698
f)
9799
PROFILES="$OPTARG"
@@ -103,23 +105,15 @@ while getopts ":ciptdsm:f:h" opt; do
103105
if [ "$OPTARG" = "m" ]; then
104106
MODULES=" -pl $DEFAULT_MODULES -am"
105107
else
106-
echo "Error: Unknown option -$OPTARG" >&2
107-
print_help
108-
exit 1
108+
ARGS="$ARGS $@"
109109
fi
110110
;;
111111
esac
112112
done
113113

114-
shift $((OPTIND -1))
115-
116-
if [ -z "$ARGS" ] && [ -z "$@" ]; then
117-
ARGS="install"
118-
fi
119-
120-
if [ -n "$@" ]; then
121-
ARGS="$ARGS $@"
114+
if [ -z "$ARGS" ] ; then
115+
ARGS=" install"
122116
fi
123117

124118
set -x
125-
$CMD $ARGS$MODULES -P $PROFILES
119+
$CMD$ARGS$MODULES -P $PROFILES

build.cmd

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ set TEST_SKIP=true
4444
goto parse_args
4545

4646
:print_help
47-
echo Usage: %0 [options]
47+
echo Usage: %~n0 [options]
4848
echo Fast local compilation with incremental build and caching
4949
echo Options:
5050
echo -c Execute clean goal (removes build artifacts)
51-
echo -i Execute install goal (builds and installs the project)
5251
echo -p Execute compile goal (compiles the source code)
52+
echo -i Execute install goal (builds and installs the project)
5353
echo -t Execute test goal (runs the tests)
5454
echo -s Execute spotless:apply (format the code)
5555
echo -d Execute dependency:tree (displays the dependency tree)
@@ -58,44 +58,48 @@ echo -f Specify profiles, default is %PROFILES%
5858
echo -h Display this help message
5959
echo.
6060
echo Examples:
61-
echo %0 -c -i Execute clean, install goals
62-
echo %0 -s Execute spotless:apply
63-
echo %0 -t -m dubbo-config Execute test goal for dubbo-config module
64-
echo %0 -c -p -m dubbo-common Execute clean, compile the dubbo-common module
65-
echo %0 -d Display the dependency tree
61+
echo %~n0 Execute install goal compilation
62+
echo %~n0 -m Execute a minimal compilation
63+
echo %~n0 -c -i Execute clean, install goals compilation
64+
echo %~n0 -s Execute spotless:apply
65+
echo %~n0 -d Display the dependency tree
66+
echo %~n0 -t -m dubbo-config Execute test goal for dubbo-config module
67+
echo %~n0 -c -p -m dubbo-common Execute clean, compile the dubbo-common module
6668
exit /b
6769

6870
:parse_args
6971
set ARG=%~1
7072
if "%ARG%"=="" goto check_args
71-
if "%ARG%"=="-c" set ARGS=%ARGS% clean
72-
if "%ARG%"=="-i" set ARGS=%ARGS% install
73-
if "%ARG%"=="-p" set ARGS=%ARGS% compile
74-
if "%ARG%"=="-t" (
73+
if "%ARG%"=="-c" (
74+
set ARGS=%ARGS% clean
75+
) else if "%ARG%"=="-p" (
76+
set ARGS=%ARGS% compile
77+
) else if "%ARG%"=="-i" (
78+
set ARGS=%ARGS% install
79+
) else if "%ARG%"=="-t" (
7580
set ARGS=%ARGS% test
7681
set TEST_SKIP=false
77-
)
78-
if "%ARG%"=="-s" (
82+
) else if "%ARG%"=="-s" (
7983
set ARGS=%ARGS% spotless:apply
8084
set PROFILES=sources
81-
)
82-
if "%ARG%"=="-d" set ARGS=%ARGS% dependency:tree
83-
if "%ARG%"=="-m" (
85+
) else if "%ARG%"=="-d" (
86+
set ARGS=%ARGS% dependency:tree
87+
) else if "%ARG%"=="-m" (
8488
if "%~2"=="" (
8589
set MODULES= -pl %DEFAULT_MODULES% -am
8690
) else (
8791
set MODULES= -pl %~2 -am
8892
shift
8993
)
90-
)
91-
if "%ARG%"=="-f" (
94+
) else if "%ARG%"=="-f" (
9295
set PROFILES=%~2
9396
shift
94-
)
95-
if "%ARG%"=="-h" goto print_help
96-
if "%ARG:~0,1%" neq "-" (
97+
) else if "%ARG%"=="-h" (
98+
goto print_help
99+
) else (
97100
set ARGS=%ARGS% %ARG%
98101
)
102+
99103
shift
100104
goto parse_args
101105

0 commit comments

Comments
 (0)