61
61
RATIS_REPO : ${{ github.event.inputs.ratis-repo }}
62
62
RATIS_VERSION : ${{ github.event.inputs.ratis-ref }}
63
63
JAVA_VERSION : ${{ github.event.inputs.java-version }}
64
+ # Surefire 3.0.0-M4 is used because newer versions do not reliably kill the fork on timeout
65
+ # SUREFIRE-1722, SUREFIRE-1815
66
+ SUREFIRE_VERSION : 3.0.0-M4
64
67
run-name : ${{ github.event_name == 'workflow_dispatch' && format('{0}#{1}[{2}]-{3}x{4}-java{5}', inputs.test-class, inputs.test-name, inputs.ref, inputs.splits, inputs.iterations, inputs.java-version) || '' }}
65
68
jobs :
66
69
prepare-job :
@@ -87,11 +90,54 @@ jobs:
87
90
with :
88
91
repo : ${{ github.event.inputs.ratis-repo || format('{0}/ratis', github.repository_owner) }}
89
92
ref : ${{ github.event.inputs.ratis-ref }}
93
+ find-tests :
94
+ if : ${{ always() }}
95
+ needs :
96
+ - prepare-job
97
+ runs-on : ubuntu-24.04
98
+ outputs :
99
+ modules : ${{ steps.modules.outputs.modules }}
100
+ steps :
101
+ - uses : actions/checkout@v4
102
+ with :
103
+ ref : ${{ github.event.inputs.ref }}
104
+ - name : Cache for maven dependencies
105
+ uses : actions/cache/restore@v4
106
+ with :
107
+ path : |
108
+ ~/.m2/repository/*/*/*
109
+ !~/.m2/repository/org/apache/ozone
110
+ key : maven-repo-${{ hashFiles('**/pom.xml') }}
111
+ restore-keys : |
112
+ maven-repo-
113
+ - name : Setup java
114
+ uses : actions/setup-java@v4
115
+ with :
116
+ distribution : ' temurin'
117
+ java-version : ${{ github.event.inputs.java-version }}
118
+ - name : Find tests
119
+ run : |
120
+ # find tests to be run in splits by running them with very short timeout
121
+ hadoop-ozone/dev-support/checks/junit.sh -DexcludedGroups="native|slow|unhealthy" -DskipShade \
122
+ -Dtest="$TEST_CLASS,Abstract*Test*\$*" \
123
+ -Dsurefire.fork.timeout=1 -Dmaven-surefire-plugin.version=${{ env.SUREFIRE_VERSION }} \
124
+ || true # ignore errors
125
+ env :
126
+ ITERATIONS : 1
127
+ - name : Find modules
128
+ id : modules
129
+ run : |
130
+ grep -e 'surefire:${{ env.SUREFIRE_VERSION }}:test' -e 'Running org.apache' target/unit/output.log | grep -B1 'Running org.apache'
131
+ modules=$(grep -e 'surefire:${{ env.SUREFIRE_VERSION }}:test' -e 'Running org.apache' target/unit/output.log | grep -B1 'Running org.apache' \
132
+ | grep surefire | cut -f2 -d'@' | awk '{ print $1 }' | sed 's/^/:/' | xargs | sed -e 's/ /,/g')
133
+ echo "modules=$modules" >> $GITHUB_OUTPUT
134
+ if : ${{ !cancelled() }}
90
135
build :
91
136
if : ${{ always() }}
92
137
needs :
93
138
- prepare-job
94
139
- ratis
140
+ - find-tests
95
141
runs-on : ubuntu-24.04
96
142
timeout-minutes : 60
97
143
steps :
@@ -129,6 +175,10 @@ jobs:
129
175
args="$args -Dgrpc.protobuf-compile.version=${{ needs.ratis.outputs.protobuf-version }}"
130
176
fi
131
177
178
+ if [[ -n "${{ needs.find-tests.outputs.modules }}" ]]; then
179
+ args="$args -am -pl ${{ needs.find-tests.outputs.modules }}"
180
+ fi
181
+
132
182
hadoop-ozone/dev-support/checks/build.sh $args
133
183
- name : Store Maven repo for tests
134
184
uses : actions/upload-artifact@v4
@@ -143,6 +193,7 @@ jobs:
143
193
- prepare-job
144
194
- ratis
145
195
- build
196
+ - find-tests
146
197
name : Run-Split
147
198
runs-on : ubuntu-24.04
148
199
strategy :
@@ -197,6 +248,10 @@ jobs:
197
248
args="$args -Dgrpc.protobuf-compile.version=${{ needs.ratis.outputs.protobuf-version }}"
198
249
fi
199
250
251
+ if [[ -n "${{ needs.find-tests.outputs.modules }}" ]]; then
252
+ args="$args -pl ${{ needs.find-tests.outputs.modules }}"
253
+ fi
254
+
200
255
if [ "$TEST_METHOD" = "ALL" ]; then
201
256
echo "Running all tests from $TEST_CLASS"
202
257
set -x
0 commit comments