-
Notifications
You must be signed in to change notification settings - Fork 366
269 lines (261 loc) · 8.68 KB
/
build.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
name: CI
on:
pull_request:
workflow_call:
inputs:
version:
required: true
type: string
outputs:
modules:
description: "Stream reactor collection of modules"
value: ${{ jobs.initiate.outputs.matrix }}
dep_check_modules:
description: "Modules for dependency checking"
value: ${{ jobs.initiate.outputs.dep_check_matrix }}
jobs:
initiate:
timeout-minutes: 5
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.read-mods.outputs.matrix }}
it_matrix: ${{ steps.read-mods.outputs.it-matrix }}
fun_matrix: ${{ steps.read-mods.outputs.fun-matrix }}
dep_check_matrix: ${{ steps.read-mods.outputs.dep-check-matrix }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Generate modules lists
run: sbt generateModulesList generateItModulesList generateFunModulesList generateDepCheckModulesList
env:
JVM_OPTS: -Xmx3200m
- name: Read modules lists
id: read-mods
run: |
echo "matrix=$(cat ./target/scala-2.13/resource_managed/main/modules.txt)" >> $GITHUB_OUTPUT
echo "it-matrix=$(cat ./target/scala-2.13/resource_managed/main/it-modules.txt)" >> $GITHUB_OUTPUT
echo "fun-matrix=$(cat ./target/scala-2.13/resource_managed/main/fun-modules.txt)" >> $GITHUB_OUTPUT
echo "dep-check-matrix=$(cat ./target/scala-2.13/resource_managed/main/depcheck-modules.txt)" >> $GITHUB_OUTPUT
- name: Cleanup before cache
shell: bash
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
scalafmt:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Check the project
run: sbt scalafmtCheck
env:
JVM_OPTS: -Xmx3200m
- name: Check the sbt files
run: sbt scalafmtSbtCheck
env:
JVM_OPTS: -Xmx3200m
test:
needs:
- initiate
- scalafmt
timeout-minutes: 5
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{fromJSON(needs.initiate.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Run tests
run: sbt "project ${{ matrix.module }}" test
env:
JVM_OPTS: -Xmx3200m
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: "**/target/**/test-reports/*.xml"
check_name: ${{ matrix.module }}-test-results
comment_mode: off
integration-test:
needs:
- initiate
- scalafmt
timeout-minutes: 30
continue-on-error: true
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{fromJSON(needs.initiate.outputs.it_matrix)}}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Run tests
run: sbt "project ${{ matrix.module }}" it:test
env:
JVM_OPTS: -Xmx3200m
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: "**/target/**/it-reports/*.xml"
check_name: ${{ matrix.module }}-it-results
comment_mode: off
build-and-cache-assembly:
needs:
- initiate
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{fromJSON(needs.initiate.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Get version
id: version
shell: bash
run: |
if [ "${{ inputs.version }}" != "" ]; then
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
fi
- name: Build assembly
env:
JVM_OPTS: -Xmx3200m
VERSION: ${{ steps.version.outputs.version }}
run: sbt "project ${{ matrix.module }};set assembly / test := {}" assembly
- name: Cache assembly
uses: actions/cache/save@v4
with:
path: ~/**/target/libs/*.jar
key: assembly-${{ matrix.module }}-${{ github.run_id }}
functional-test:
needs:
- initiate
- build-and-cache-assembly
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{fromJSON(needs.initiate.outputs.fun_matrix)}}
connectImageVersion: [7.3.1, 6.2.2]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Restore assembly
uses: actions/cache/restore@v4
with:
path: ~/**/target/libs/*.jar
key: assembly-${{ matrix.module }}-${{ github.run_id }}
fail-on-cache-miss: true
- name: Run tests
run: sbt "project ${{ matrix.module }}" fun:test
env:
JVM_OPTS: -Xmx3200m
CONNECT_IMAGE_VERSION: ${{matrix.connectImageVersion}}
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: "**/target/**/test-reports/*.xml"
check_name: ${{ matrix.module }}-${{ matrix.connectImageVersion }}-fun-results
comment_mode: off
dependency-check:
needs:
- initiate
- build-and-cache-assembly
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{fromJSON(needs.initiate.outputs.dep_check_matrix)}}
steps:
- name: Restore assembly
uses: actions/cache/restore@v4
with:
path: ~/**/target/libs/*.jar
key: assembly-${{ matrix.module }}-${{ github.run_id }}
fail-on-cache-miss: true
- name: Get branch names.
id: branch_name
uses: tj-actions/branch-names@v8
- name: Dependency Check
uses: dependency-check/Dependency-Check_Action@main
with:
project: kafka-connect-${{matrix.module}}-deps
path: kafka-connect-${{matrix.module}}/target/libs/
format: 'HTML'
args: >-
--failOnCVSS 5
--suppression https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.owner.login || github.event.repository.owner.login }}/${{ github.event.repository.name }}/${{ steps.branch_name.outputs.tag }}${{ steps.branch_name.outputs.current_branch }}/suppression.xml
- name: Upload Test results
uses: actions/upload-artifact@master
with:
name: ${{matrix.module}}-depcheck-results
path: ${{github.workspace}}/reports
upload-assembly:
needs:
- initiate
- functional-test
- dependency-check
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
module: ${{fromJSON(needs.initiate.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'sbt'
- name: Restore assembly
uses: actions/cache/restore@v4
with:
path: ~/**/target/libs/*.jar
key: assembly-${{ matrix.module }}-${{ github.run_id }}
fail-on-cache-miss: true
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: assembly-${{ matrix.module }}-${{ github.run_id }}
path: ~/**/target/libs/*.jar