forked from apache/ozone
373 lines (373 loc) · 12.2 KB
/
post-commit.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
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# 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: build-branch
on:
pull_request:
push:
schedule:
- cron: 30 0,12 * * *
jobs:
build:
name: compile
runs-on: ubuntu-18.04
strategy:
matrix:
java: [ 8, 11 ]
fail-fast: false
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Cache for npm dependencies
uses: actions/cache@v2
with:
path: |
~/.pnpm-store
**/node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Cache for maven dependencies
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: maven-repo-${{ hashFiles('**/pom.xml') }}
restore-keys: maven-repo-
- name: Setup java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Run a full build
run: hadoop-ozone/dev-support/checks/build.sh
bats:
runs-on: ubuntu-18.04
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Install bats
run: |
cd /tmp
curl -LSs https://github.com/bats-core/bats-core/archive/v1.2.1.tar.gz | tar xzf -
cd bats-core-1.2.1
sudo ./install.sh /usr/local
- name: Execute tests
run: ./hadoop-ozone/dev-support/checks/${{ github.job }}.sh
- name: Summary of failures
run: cat target/${{ github.job }}/summary.txt
if: always()
- name: Archive build results
uses: actions/upload-artifact@v2
if: always()
with:
name: ${{ github.job }}
path: target/${{ github.job }}
continue-on-error: true
rat:
runs-on: ubuntu-18.04
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Execute tests
uses: ./.github/buildenv
with:
args: ./hadoop-ozone/dev-support/checks/rat.sh
- name: Summary of failures
run: cat target/${{ github.job }}/summary.txt
if: always()
- name: Archive build results
uses: actions/upload-artifact@v2
if: always()
with:
name: rat
path: target/rat
continue-on-error: true
author:
runs-on: ubuntu-18.04
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Execute tests
run: hadoop-ozone/dev-support/checks/author.sh
- name: Summary of failures
run: cat target/${{ github.job }}/summary.txt
if: always()
- name: Archive build results
uses: actions/upload-artifact@v2
if: always()
with:
name: author
path: target/author
continue-on-error: true
unit:
runs-on: ubuntu-18.04
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Execute tests
uses: ./.github/buildenv
with:
args: ./hadoop-ozone/dev-support/checks/unit.sh
- name: Summary of failures
run: cat target/${{ github.job }}/summary.txt
if: always()
- name: Archive build results
uses: actions/upload-artifact@v2
if: always()
with:
name: unit
path: target/unit
continue-on-error: true
checkstyle:
runs-on: ubuntu-18.04
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Execute tests
uses: ./.github/buildenv
with:
args: ./hadoop-ozone/dev-support/checks/checkstyle.sh
- name: Summary of failures
run: cat target/${{ github.job }}/summary.txt
if: always()
- name: Archive build results
uses: actions/upload-artifact@v2
if: always()
with:
name: checkstyle
path: target/checkstyle
continue-on-error: true
findbugs:
runs-on: ubuntu-18.04
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Execute tests
uses: ./.github/buildenv
with:
args: ./hadoop-ozone/dev-support/checks/findbugs.sh
- name: Summary of failures
run: cat target/${{ github.job }}/summary.txt
if: always()
- name: Archive build results
uses: actions/upload-artifact@v2
if: always()
with:
name: findbugs
path: target/findbugs
continue-on-error: true
acceptance:
runs-on: ubuntu-18.04
strategy:
matrix:
suite:
- secure
- unsecure
- misc
fail-fast: false
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Cache for maven dependencies
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: maven-repo-${{ hashFiles('**/pom.xml') }}
restore-keys: maven-repo-
- name: Cache for npm dependencies
uses: actions/cache@v2
with:
path: |
~/.pnpm-store
**/node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Checkout to /mnt/ozone
run: |
sudo chmod 777 /mnt
git clone 'https://github.com/${{ github.repository }}.git' /mnt/ozone
cd /mnt/ozone
if [[ '${{ github.event_name }}' == 'pull_request' ]]; then
git fetch --verbose origin '${{ github.ref }}'
else
git fetch --verbose origin '${{ github.sha }}'
fi
git checkout FETCH_HEAD
git reset --hard
- name: Run a full build
run: |
cd /mnt/ozone
hadoop-ozone/dev-support/checks/build.sh -Pcoverage
- name: Install robotframework
run: sudo pip install robotframework
- name: Execute tests
run: |
cd /mnt/ozone/hadoop-ozone/dist/target/ozone-* && sudo mkdir .aws && sudo chmod 777 .aws && sudo chown 1000 .aws
cd /mnt/ozone && hadoop-ozone/dev-support/checks/acceptance.sh
env:
KEEP_IMAGE: false
OZONE_ACCEPTANCE_SUITE: ${{ matrix.suite }}
OZONE_WITH_COVERAGE: true
OZONE_VOLUME_OWNER: 1000
- name: Archive build results
uses: actions/upload-artifact@v2
if: always()
with:
name: acceptance-${{ matrix.suite }}
path: /mnt/ozone/target/acceptance
continue-on-error: true
- name: Delete temporary build artifacts before caching
run: |
#Never cache local artifacts
rm -rf ~/.m2/repository/org/apache/hadoop/hdds
rm -rf ~/.m2/repository/org/apache/hadoop/ozone
if: always()
integration:
runs-on: ubuntu-18.04
strategy:
matrix:
profile:
- client
- filesystem-hdds
- ozone
fail-fast: false
steps:
- name: Setup link to SSD
run: sudo mkdir mnt && sudo mount --bind /mnt `pwd`/mnt && sudo chmod 777 mnt
- name: Checkout project
uses: actions/checkout@v2
with:
path: mnt/ozone
- name: Execute tests
uses: ./mnt/ozone/.github/buildenv
with:
args: ./mnt/ozone/hadoop-ozone/dev-support/checks/integration.sh -P${{ matrix.profile }}
- name: Summary of failures
run: cat mnt/ozone/target/${{ github.job }}/summary.txt
if: always()
- name: Archive build results
uses: actions/upload-artifact@v2
if: always()
with:
name: it-${{ matrix.profile }}
path: mnt/ozone/target/integration
continue-on-error: true
coverage:
runs-on: ubuntu-18.04
needs:
- acceptance
- integration
- unit
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Run a full build
uses: ./.github/buildenv
with:
args: ./hadoop-ozone/dev-support/checks/build.sh
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: target/artifacts
- name: Calculate combined coverage
run: ./hadoop-ozone/dev-support/checks/coverage.sh
- name: Upload coverage to Sonar
uses: ./.github/buildenv
if: github.repository == 'apache/hadoop-ozone' && github.event_name != 'pull_request'
with:
args: ./hadoop-ozone/dev-support/checks/sonar.sh
env:
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: github.repository == 'apache/hadoop-ozone' && github.event_name != 'pull_request'
with:
file: ./target/coverage/all.xml
name: codecov-umbrella
fail_ci_if_error: false
- name: Archive build results
uses: actions/upload-artifact@v2
with:
name: coverage
path: target/coverage
continue-on-error: true
kubernetes:
runs-on: ubuntu-18.04
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Cache for maven dependencies
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: maven-repo-${{ hashFiles('**/pom.xml') }}
restore-keys: maven-repo-
- name: Cache for npm dependencies
uses: actions/cache@v2
with:
path: |
~/.pnpm-store
**/node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Checkout to /mnt/ozone
run: |
sudo chmod 777 /mnt
git clone 'https://github.com/${{ github.repository }}.git' /mnt/ozone
cd /mnt/ozone
if [[ '${{ github.event_name }}' == 'pull_request' ]]; then
git fetch --verbose origin '${{ github.ref }}'
else
git fetch --verbose origin '${{ github.sha }}'
fi
git checkout FETCH_HEAD
git reset --hard
- name: Install robotframework
run: sudo pip install robotframework
- name: Install k3s
run: curl -sfL https://get.k3s.io | sh -
- name: Copy Kubernetes config file
run: |
sudo mkdir ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown $(id -u) ~/.kube/config
- name: Install flekszible
run: |
cd /tmp
wget https://github.com/elek/flekszible/releases/download/v1.8.1/flekszible_1.8.1_Linux_x86_64.tar.gz -O - | tar -zx
chmod +x flekszible
sudo mv flekszible /usr/bin/flekszible
- name: Run a full build
run: |
cd /mnt/ozone
hadoop-ozone/dev-support/checks/build.sh -Pcoverage
- name: Execute tests
run: |
cd /mnt/ozone/hadoop-ozone/dist/target/ozone-* && sudo mkdir .aws && sudo chmod 777 .aws && sudo chown 1000 .aws
cd /mnt/ozone && hadoop-ozone/dev-support/checks/kubernetes.sh
- name: Archive build results
uses: actions/upload-artifact@v2
if: always()
with:
name: kubernetes
path: /mnt/ozone/target/kubernetes
continue-on-error: true
- name: Delete temporary build artifacts before caching
run: |
#Never cache local artifacts
rm -rf ~/.m2/repository/org/apache/hadoop/hdds
rm -rf ~/.m2/repository/org/apache/hadoop/ozone
if: always()