-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix github actions build failure #1054
Changes from 17 commits
9b3bd26
59c5995
73281a2
266890d
67b6a34
7a15fd9
e5d45f8
fe8b32d
e19a0c4
9d37ad5
e98200f
230f675
6f6e90d
8f69377
00f0842
1697e0b
b4de760
426ed3f
ae804f6
be919bb
bc58f7e
b697a05
3a91408
11ab4d5
c6fb425
30b7fc0
0b6b4c3
2564b30
b089632
343d2d3
537db4c
855dfaa
717e671
c2a0aa0
34e2018
6664c0f
b3f2aa4
dbcf157
a31d7cb
68692c9
f04ee49
65a734f
4b93e0e
66f1021
584c10e
d55f66d
6b284c4
34995d0
f9b079b
4eabc42
8cce300
9f8fa55
9494794
d6a32e9
d5ead6a
8b14f4e
3f038bf
8d77355
531e180
eb50a09
23c6a26
00d6c3b
0c72878
49bd794
c3777b6
1a9e163
d25d209
3c41edb
0e63735
502d59a
10fbd06
696e9a5
0e6bf04
3134798
98dbbd1
06ba485
33ff2ed
fdcda5e
8e0e323
19e8602
fe92872
4e293a7
823dd3e
2c8ee76
41f356d
8bed5c3
ed2bf4b
878d76a
9a470c7
1fe5b15
81b49a8
46117cf
0e538d7
c579d48
4c5d89b
a139085
7c223ae
9f7be4b
45ebe0f
2943c9d
79bcb89
f2795b5
c733c24
640f1bf
0419451
45624ab
a7cc9d7
619e74c
020f117
f715e97
a9fe5ad
0e27c68
22bbd24
795f0a5
24419d0
1db6394
76873ba
f921c73
94468af
8d49413
6e37088
a536330
aa7c81d
8ee5b3a
ecbe35f
b068344
40d72df
111ac26
305aecd
5c57db4
e5923a8
b16152e
cfffc6d
0ac03f0
9923b01
fb81fee
765b77c
609ffa3
2be3a26
c6c9489
ca3a1c4
8d6dba5
d158e88
35f8fbc
04c04f9
aad6c37
a7a37ad
1407fc5
2ed5072
0f4c477
6b6fe6f
dcde155
2a1ef4a
b507c5e
fdf148a
de31f65
3a3522d
3d52745
249ed84
df27866
a201e93
9340505
cc6bde5
0032a14
6dc5c42
bebdb7c
cad4be0
39c3c68
28f0618
1479efd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,12 +26,6 @@ jobs: | |
shell: bash | ||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_HEAD_REF})" | ||
|
||
# if this is the first build, this is a NOOP and every dependency is downloaded. | ||
# if this is != first build, cache is restored. We then issue mvn clean install with "-U", | ||
# and thus update any third party snapshots; also we build the project, thus update | ||
# any inter-module snapshot dependencies. | ||
# only after that is the cache saved, which is what we want. Any subsequent restores as such | ||
# will have the latest versions of snapshots available. | ||
- name: Cache local Maven repository | ||
id: cache-maven-repo | ||
uses: actions/cache@v2 | ||
|
@@ -89,6 +83,7 @@ jobs: | |
test: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
|
||
strategy: | ||
fail-fast: true | ||
|
@@ -118,26 +113,63 @@ jobs: | |
CURRENT_INDEX: ${{ matrix.current_index }} | ||
NUMBER_OF_JOBS: ${{ matrix.number_of_jobs }} | ||
run: | | ||
# find all tests | ||
# exclude Fabric8IstionIT | ||
# only take classes that have @Test inside them | ||
# drop the "begining" xxx/src/test/java | ||
# replace / with . | ||
# drop last ".java" | ||
# replace newline with space | ||
# sort | ||
|
||
CLASSNAMES=($(find . -name '*.java' \ | ||
| grep 'src/test/java' \ | ||
| grep -v 'Fabric8IstioIT' \ | ||
| xargs grep -l '@Test' \ | ||
| sed 's/.*src.test.java.//g' \ | ||
| sed 's@/@.@g' \ | ||
| sed 's/.\{5\}$//' \ | ||
| sort \ | ||
| tr '\n' ' ')) | ||
|
||
number_of_tests=${#CLASSNAMES[@]} | ||
# - find all tests | ||
# - exclude Fabric8IstionIT | ||
# - only take classes that have @Test inside them | ||
# - ignore the ones that have 'abstract class'. we do this because otherwise we would pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this small comment explains the problem, I noticed this by accident and could reproduce locally too... fixed via this logic. |
||
# to -DtestsToRun an abstract class, and it will not run anything. | ||
# - drop the "begining" xxx/src/test/java | ||
# - replace / with . | ||
# - drop last ".java" | ||
# - replace newline with space | ||
# - replace '\n' with ' ' | ||
|
||
PLAIN_TEST_CLASSNAMES=($(find . -name '*.java' \ | ||
| grep 'src/test/java' \ | ||
| grep -v 'Fabric8IstioIT' \ | ||
| xargs grep -l '@Test' \ | ||
| xargs grep -L 'abstract class' \ | ||
| sed 's/.*src.test.java.//g' \ | ||
| sed 's@/@.@g' \ | ||
| sed 's/.\{5\}$//' \ | ||
| tr '\n' ' ')) | ||
|
||
# classes that have @Test and are abstract, for example: "LabeledSecretWithPrefixTests" | ||
# - exclude Fabric8IstionIT | ||
# - only take classes that have @Test inside them | ||
# - only take classes that are abstract | ||
# - drop everything up until the last "/" | ||
# - drop ".java" | ||
|
||
ABSTRACT_TEST_CLASSNAMES_COMMAND="find . -name '*.java' \ | ||
| grep 'src/test/java' \ | ||
| grep -v 'Fabric8IstioIT' \ | ||
| xargs grep -l '@Test' \ | ||
| xargs grep -l 'abstract class' \ | ||
| sed 's/.*\///g' \ | ||
| sed 's/.java//g'" | ||
|
||
# find classes that extend abstract test classes | ||
DERIVED_FROM_ABSTRACT_CLASSES_COMMAND="find . -name '*.java' \ | ||
| grep 'src/test/java' \ | ||
| grep -v 'Fabric8IstioIT' \ | ||
| xargs grep -l 'extends replace_me ' \ | ||
| sed 's/.*src.test.java.//g' \ | ||
| sed 's@/@.@g' \ | ||
| sed 's/.\{5\}$//' \ | ||
| tr '\n' ' '" | ||
|
||
while read class_name; do | ||
replaced=$(echo ${DERIVED_FROM_ABSTRACT_CLASSES_COMMAND/replace_me/"$class_name"}) | ||
result=($(eval $replaced)) | ||
PLAIN_TEST_CLASSNAMES+=(${result[@]}) | ||
done < <(eval $ABSTRACT_TEST_CLASSNAMES_COMMAND) | ||
|
||
IFS=$'\n' | ||
PLAIN_TEST_CLASSNAMES=$(sort <<< "${PLAIN_TEST_CLASSNAMES[*]}") | ||
unset IFS | ||
|
||
number_of_tests=${#PLAIN_TEST_CLASSNAMES[@]} | ||
number_of_jobs=${NUMBER_OF_JOBS} | ||
current_index=${CURRENT_INDEX} | ||
|
||
|
@@ -188,11 +220,17 @@ jobs: | |
|
||
diff=$((right_bound - left_bound)) | ||
sliced_array=("${CLASSNAMES[@]:$left_bound:$diff}") | ||
TEST_ARG=$(echo $sliced_array | sed 's/ /,/g') | ||
TEST_ARG=$(echo ${sliced_array[@]} | sed 's/ /,/g') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had a bug here, I was only running the first test from a |
||
|
||
./mvnw -s .settings.xml -DfailIfNoTests=false -DtestsToRun=$TEST_ARG -e clean org.jacoco:jacoco-maven-plugin:prepare-agent install \ | ||
echo "will run tests : ${TEST_ARG[@]}" | ||
|
||
./mvnw -s .settings.xml -DtestsToRun=${TEST_ARG[@]} -e clean org.jacoco:jacoco-maven-plugin:prepare-agent install \ | ||
-U -P sonar -nsu --batch-mode -Dmaven.test.redirectTestOutputToFile=true \ | ||
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | ||
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ | ||
-Dhttp.keepAlive=false \ | ||
-Dmaven.wagon.http.pool=false \ | ||
-Dmaven.wagon.http.retryHandler.class=standard \ | ||
-Dmaven.wagon.http.retryHandler.count=3 | ||
|
||
- name: Publish Test Report | ||
uses: mikepenz/action-junit-report@v2 | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restore cache for tests