-
Notifications
You must be signed in to change notification settings - Fork 441
212 lines (184 loc) · 7.25 KB
/
check.yaml
File metadata and controls
212 lines (184 loc) · 7.25 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
# 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 `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 dev-support/checks, without .sh extension"
required: true
# OPTIONAL (ordered alphabetically)
java-version:
type: string
description: "Java version to set up (default: 17)"
default: '17'
required: false
needs-binary-tarball:
type: boolean
description: "Whether to download Ratis binary tarball created by build (default: no)"
default: false
required: false
needs-maven-repo:
type: boolean
description: "Whether to download Ratis jars created by build (default: no)"
default: false
required: false
needs-source-tarball:
type: boolean
description: "Whether to download Ratis source tarball created by build (default: no)"
default: false
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"
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
secrets:
DEVELOCITY_ACCESS_KEY:
description: 'Token for submitting build scan to Develocity'
required: false
env:
MAVEN_ARGS: --batch-mode --show-version
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
SCRIPT: ${{ inputs.script }}
WITH_COVERAGE: ${{ github.event_name == 'push' }}
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-source-tarball }}
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Download source tarball
if: ${{ inputs.needs-source-tarball }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ratis-src
- name: Extract source tarball
if: ${{ inputs.needs-source-tarball }}
run: |
tar --strip-components 1 -xzvf ratis*-src.tar.gz
- name: Create cache for Maven dependencies
if: ${{ inputs.script == 'build' }}
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/ratis
key: maven-repo-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-repo-
- name: Restore cache for Maven dependencies
if: ${{ inputs.script != 'build' }}
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: |
~/.m2/repository/*/*/*
!~/.m2/repository/org/apache/ratis
key: maven-repo-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-repo-
- name: Download Maven repo
id: download-maven-repo
if: ${{ inputs.needs-maven-repo }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: maven-repo
path: |
~/.m2/repository/org/apache/ratis
- name: Download binary tarball
if: ${{ inputs.needs-binary-tarball }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ratis-bin
- name: Extract binary tarball
if: ${{ inputs.needs-binary-tarball }}
run: |
mkdir -p ratis-assembly/target
tar xzvf ratis-*-bin.tar.gz -C ratis-assembly/target
- name: Setup java ${{ inputs.java-version }}
if: ${{ inputs.java-version }}
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: 'temurin'
java-version: ${{ inputs.java-version }}
- name: Execute tests
run: |
$COMMAND
env:
COMMAND: dev-support/checks/${{ inputs.script }}.sh ${{ inputs.script-args }}
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
- name: Summary of failures
if: ${{ failure() }}
run: |
if [[ -s "target/$SCRIPT/summary.txt" ]]; then
cat target/$SCRIPT/summary.txt
fi
- name: Archive build results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ (inputs.split && format('{0}-{1}', inputs.script, inputs.split)) || inputs.script }}
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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ratis-bin
path: |
ratis-assembly/target/ratis-assembly-*-bin.tar.gz
retention-days: 1
- name: Store source tarball for compilation
if: ${{ inputs.script == 'build' && !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ratis-src
path: |
ratis-assembly/target/ratis-assembly-*-src.tar.gz
retention-days: 1
- name: Store Maven repo for tests
if: ${{ inputs.script == 'build' && !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: maven-repo
path: |
~/.m2/repository/org/apache/ratis
retention-days: 1