forked from apache/ozone
-
Notifications
You must be signed in to change notification settings - Fork 0
233 lines (230 loc) · 8.46 KB
/
intermittent-test-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: flaky-test-check
on:
workflow_dispatch:
inputs:
ref:
description: Git Ref (Branch/Commit_ID/Tag)
default: master
required: true
test-class:
description: Test Class
default: NA
required: true
test-name:
description: Test Name
default: ALL
required: false
iterations:
description: Number of Iterations per split
default: 10
required: true
splits:
description: Number of splits
default: 10
required: true
fail-fast:
description: Stop after first failure
default: false
required: true
ratis-repo:
description: Ratis repository
default: ''
required: false
ratis-ref:
description: Ratis ref (branch, tag or commit SHA)
default: ''
required: false
env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
TEST_CLASS: ${{ github.event.inputs.test-class}}
TEST_METHOD: ${{ github.event.inputs.test-name }}
ITERATIONS: ${{ github.event.inputs.iterations }}
FAIL_FAST: ${{ github.event.inputs.fail-fast }}
RATIS_REPO: ${{ github.event.inputs.ratis-repo }}
RATIS_VERSION: ${{ github.event.inputs.ratis-ref }}
run-name: ${{ github.event_name == 'workflow_dispatch' && format('{0}#{1}[{2}]-{3}x{4}', inputs.test-class, inputs.test-name, inputs.ref, inputs.splits, inputs.iterations) || '' }}
jobs:
prepare-job:
runs-on: ubuntu-20.04
outputs:
matrix: ${{steps.generate.outputs.matrix}}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- id: generate
name: Generate test matrix
run: |
splits=()
for ((i = 1; i <= ${{ github.event.inputs.splits }}; i++)); do
splits+=("$i")
done
printf -v x "%s," "${splits[@]}"
split_matrix="[${x%,}]"
echo "matrix=$split_matrix" >> $GITHUB_OUTPUT
ratis:
uses: ./.github/workflows/build-ratis.yml
if: ${{ github.event.inputs.ratis-ref != '' }}
with:
repo: ${{ github.event.inputs.ratis-repo || format('{0}/ratis', github.repository_owner) }}
ref: ${{ github.event.inputs.ratis-ref }}
build:
if: ${{ always() }}
needs:
- prepare-job
- ratis
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Cache for maven dependencies
uses: actions/cache/restore@v4
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/ozone
key: maven-repo-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-repo-
- name: Download Ratis repo
if: ${{ github.event.inputs.ratis-ref != '' }}
uses: actions/download-artifact@v4
with:
name: ratis-jars
path: |
~/.m2/repository/org/apache/ratis
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 8
- name: Build (most) of Ozone
run: |
args="-Dskip.npx -Dskip.installnpx -DskipShade -Dmaven.javadoc.skip=true"
if [[ "${{ github.event.inputs.ratis-ref }}" != "" ]]; then
args="$args -Dratis.version=${{ needs.ratis.outputs.ratis-version }}"
args="$args -Dratis.thirdparty.version=${{ needs.ratis.outputs.thirdparty-version }}"
args="$args -Dio.grpc.version=${{ needs.ratis.outputs.grpc-version }}"
args="$args -Dnetty.version=${{ needs.ratis.outputs.netty-version }}"
args="$args -Dgrpc.protobuf-compile.version=${{ needs.ratis.outputs.protobuf-version }}"
fi
hadoop-ozone/dev-support/checks/build.sh $args
- name: Store Maven repo for tests
uses: actions/upload-artifact@v4
with:
name: ozone-repo
path: |
~/.m2/repository/org/apache/ozone
retention-days: 1
run-test:
if: ${{ always() }}
needs:
- prepare-job
- ratis
- build
name: Run-Split
runs-on: ubuntu-20.04
strategy:
matrix:
split: ${{fromJson(needs.prepare-job.outputs.matrix)}} # Define splits
fail-fast: ${{ fromJson(github.event.inputs.fail-fast) }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- name: Cache for maven dependencies
uses: actions/cache/restore@v4
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/ozone
key: maven-repo-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-repo-
- name: Download Ratis repo
if: ${{ github.event.inputs.ratis-ref != '' }}
uses: actions/download-artifact@v4
with:
name: ratis-jars
path: |
~/.m2/repository/org/apache/ratis
- name: Download Ozone repo
id: download-ozone-repo
uses: actions/download-artifact@v4
with:
name: ozone-repo
path: |
~/.m2/repository/org/apache/ozone
continue-on-error: true
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 8
- name: Execute tests
run: |
if [[ -e "${{ steps.download-ozone-repo.outputs.download-path }}" ]]; then
export OZONE_REPO_CACHED=true
fi
args="-DexcludedGroups=native|slow|unhealthy"
if [[ "${{ github.event.inputs.ratis-ref }}" != "" ]]; then
args="$args -Dratis.version=${{ needs.ratis.outputs.ratis-version }}"
args="$args -Dratis.thirdparty.version=${{ needs.ratis.outputs.thirdparty-version }}"
args="$args -Dio.grpc.version=${{ needs.ratis.outputs.grpc-version }}"
args="$args -Dnetty.version=${{ needs.ratis.outputs.netty-version }}"
args="$args -Dgrpc.protobuf-compile.version=${{ needs.ratis.outputs.protobuf-version }}"
fi
if [ "$TEST_METHOD" = "ALL" ]; then
echo "Running all tests from $TEST_CLASS"
set -x
hadoop-ozone/dev-support/checks/junit.sh $args -Dtest="$TEST_CLASS,Abstract*Test*\$*"
else
echo "Running test: $TEST_METHOD from $TEST_CLASS"
set -x
hadoop-ozone/dev-support/checks/junit.sh $args -Dtest="$TEST_CLASS#$TEST_METHOD,Abstract*Test*\$*"
fi
continue-on-error: true
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
- name: Summary of failures
run: hadoop-ozone/dev-support/checks/_summary.sh target/unit/summary.txt
if: ${{ !cancelled() }}
- name: Archive build results
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: result-${{ github.run_number }}-${{ github.run_id }}-split-${{ matrix.split }}
path: target/unit
count-failures:
if: ${{ failure() }}
needs: run-test
runs-on: ubuntu-20.04
steps:
- name: Download build results
uses: actions/download-artifact@v4
- name: Count failures
run: |
failures=$(find . -name 'summary.txt' | grep -v 'iteration' | xargs grep -v 'exit code: 0' | wc -l)
echo "Total failures: $failures"
if [[ $failures -gt 0 ]]; then
echo ""
echo "Failed runs:"
grep 'exit code: 1' */summary.txt | grep -o 'split.*teration [0-9]*' | sed -e 's/.summary.txt:/ /' -e 's/-/ /' | sort -g -k2 -k4
echo ""
exit 1
fi