-
Notifications
You must be signed in to change notification settings - Fork 594
297 lines (257 loc) · 9.41 KB
/
check.yml
File metadata and controls
297 lines (257 loc) · 9.41 KB
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# 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.
# This reusable workflow executes a single check from `hadoop-ozone/dev-support/checks/`.
# Before and after the check, it performs various steps based on workflow inputs.
name: ci-check
on:
workflow_call:
inputs:
# REQUIRED
script:
type: string
description: "Test script to run from hadoop-ozone/dev-support/checks, without .sh extension"
required: true
sha:
type: string
description: "Commit SHA to test"
required: true
# OPTIONAL (ordered alphabetically)
checkout-fetch-depth:
type: number
description: "Fetch depth for checking out the repo (default: no history)"
default: 1
required: false
java-version:
type: string
description: "Java version to set up (default: none)"
default: ''
required: false
needs-maven-cache:
type: boolean
description: "Whether to restore Maven cache before run (default: yes)"
default: true
required: false
needs-npm-cache:
type: boolean
description: "Whether to restore NPM cache before run (default: no)"
default: false
required: false
needs-ozone-binary-tarball:
type: boolean
description: "Whether to download Ozone binary tarball created by build (default: no)"
default: false
required: false
needs-ozone-repo:
type: boolean
description: "Whether to download Ozone jars created by build (default: no)"
default: false
required: false
needs-ozone-source-tarball:
type: boolean
description: "Whether to download Ozone source tarball created by build (default: no)"
default: false
required: false
pre-script:
type: string
description: "Command to execute before the test script (default: none)"
default: ''
required: false
post-failure:
type: string
description: "Command to execute after the test script, if it failed (default: none)"
default: ''
required: false
post-success:
type: string
description: "Command to execute after the test script, if it succeeded (default: none)"
default: ''
required: false
ratis-args:
type: string
description: "Version overrides from custom Ratis build (default: none)"
default: ''
required: false
runner:
type: string
description: "GitHub Actions runner to use"
default: 'ubuntu-24.04'
required: false
script-args:
type: string
description: "Arguments for the test script, ratis-args are appended"
default: ''
required: false
split:
type: string
description: "Name of split for matrix jobs, only used in display name"
default: ''
required: false
timeout-minutes:
type: number
description: "Job timeout in minutes (default: 30)"
default: 30
required: false
with-coverage:
type: boolean
description: "The value of OZONE_WITH_COVERAGE to set"
default: true
required: false
env:
HADOOP_IMAGE: ghcr.io/apache/hadoop
MAVEN_ARGS: --batch-mode --settings ${{ github.workspace }}/dev-support/ci/maven-settings.xml
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
OZONE_IMAGE: ghcr.io/apache/ozone
OZONE_RUNNER_IMAGE: ghcr.io/apache/ozone-runner
OZONE_VOLUME_OWNER: 1000
SCRIPT: ${{ inputs.script }}
jobs:
check:
name: ${{ (inputs.split && format('{0} ({1})', inputs.script, inputs.split)) || inputs.script }}
runs-on: ${{ inputs.runner }}
timeout-minutes: ${{ inputs.timeout-minutes }}
steps:
- name: Checkout project
if: ${{ !inputs.needs-ozone-source-tarball }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}
fetch-depth: ${{ inputs.checkout-fetch-depth }}
- name: Download Ozone source tarball
if: ${{ inputs.needs-ozone-source-tarball }}
uses: actions/download-artifact@v4
with:
name: ozone-src
- name: Extract source tarball
if: ${{ inputs.needs-ozone-source-tarball }}
run: |
tar --strip-components 1 -xzvf ozone*-src.tar.gz
- name: Cache for NPM dependencies
if: ${{ inputs.needs-npm-cache }}
uses: actions/cache@v4
with:
path: |
~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Cache for Maven dependencies
if: ${{ inputs.needs-maven-cache }}
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 Ozone repo
id: download-ozone-repo
if: ${{ inputs.needs-ozone-repo }}
uses: actions/download-artifact@v4
with:
name: ozone-repo
path: |
~/.m2/repository/org/apache/ozone
- name: Download Ratis repo
if: ${{ inputs.ratis-args != '' }}
uses: actions/download-artifact@v4
with:
name: ratis-jars
path: |
~/.m2/repository/org/apache/ratis
- name: Download Ozone binary tarball
if: ${{ inputs.needs-ozone-binary-tarball }}
uses: actions/download-artifact@v4
with:
name: ozone-bin
- name: Extract binary tarball
if: ${{ inputs.needs-ozone-binary-tarball }}
run: |
mkdir -p hadoop-ozone/dist/target
tar xzvf ozone*.tar.gz -C hadoop-ozone/dist/target
rm ozone*.tar.gz
- name: Setup java ${{ inputs.java-version }}
if: ${{ inputs.java-version }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ inputs.java-version }}
- name: Execute pre-test steps
if: ${{ inputs.pre-script }}
run: |
$COMMAND
env:
COMMAND: ${{ inputs.pre-script }}
- name: Execute tests
run: |
$COMMAND
env:
COMMAND: hadoop-ozone/dev-support/checks/${{ inputs.script }}.sh ${{ inputs.script-args }} ${{ inputs.ratis-args }}
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
OZONE_WITH_COVERAGE: ${{ inputs.with-coverage }}
- name: Execute post-failure steps
if: ${{ failure() && inputs.post-failure }}
run: |
$COMMAND
env:
COMMAND: ${{ inputs.post-failure }}
- name: Execute post-success steps
if: ${{ !failure() && inputs.post-success }}
run: |
$COMMAND
env:
COMMAND: ${{ inputs.post-success }}
- name: Summary of failures
if: ${{ failure() }}
run: |
if [[ -s "target/$SCRIPT/summary.md" ]]; then
cat target/$SCRIPT/summary.md >> $GITHUB_STEP_SUMMARY
fi
hadoop-ozone/dev-support/checks/_summary.sh target/$SCRIPT/summary.txt
- name: Archive build results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ (inputs.split && format('{0}-{1}', inputs.script, inputs.split)) || inputs.script }}
# please keep path as a single item; move to that directory all files needed in the artifact
path: target/${{ inputs.script }}
continue-on-error: true
# The following steps are hard-coded to be run only for 'build' check,
# to avoid the need for 3 more inputs.
- name: Store binaries for tests
if: ${{ inputs.script == 'build' && !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ozone-bin
path: |
hadoop-ozone/dist/target/ozone-*.tar.gz
!hadoop-ozone/dist/target/ozone-*-src.tar.gz
retention-days: 1
- name: Store source tarball for compilation
if: ${{ inputs.script == 'build' && !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ozone-src
path: |
hadoop-ozone/dist/target/ozone-*-src.tar.gz
retention-days: 1
- name: Store Maven repo for tests
if: ${{ inputs.script == 'build' && !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ozone-repo
path: |
~/.m2/repository/org/apache/ozone
retention-days: 1