-
-
Notifications
You must be signed in to change notification settings - Fork 11
236 lines (222 loc) · 6.69 KB
/
build-test-deploy.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
name: Build and deploy project
on:
push:
branches:
- main
- develop
tags:
pull_request:
branches:
- main
- develop
workflow_dispatch:
jobs:
build:
name: Build project
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ vars.JAVA_VERSION }}
- name: Build project
uses: gradle/gradle-build-action@v2
with:
arguments: |
assemble
--scan
- name: Upload miner jar file
uses: actions/upload-artifact@v3
with:
name: miner-jar
path: |
miner/build/libs/miner-shaded.jar
if-no-files-found: error
retention-days: 14
- name: Upload viewer jar file
uses: actions/upload-artifact@v3
with:
name: viewer-jar
path: |
viewer/build/libs/viewer-*.jar
if-no-files-found: error
retention-days: 14
test-miner:
name: Run miner tests
runs-on: ubuntu-latest
needs: build
permissions:
checks: write
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ vars.JAVA_VERSION }}
- name: Run tests
uses: gradle/gradle-build-action@v2
with:
arguments: |
:miner:test
--scan
- name: Generate JaCoCo report
uses: gradle/gradle-build-action@v2
if: always()
with:
arguments: :miner:jacocoTestReport
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: always()
with:
report_paths: 'miner/build/test-results/test/*.xml'
- name: Publish coverage on CodeCov
uses: codecov/codecov-action@v3
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: miner/build/reports/jacoco/test/jacocoTestReport.xml
flags: unittests-miner
name: codecov-github-actions
- name: Upload JUnit reports
uses: actions/upload-artifact@v3
if: always()
with:
name: junit-test-results-miner
path: |
miner/build/test-results/test/*.xml
miner/build/reports/tests/tests
if-no-files-found: error
retention-days: 14
- name: Upload JaCoCo reports
uses: actions/upload-artifact@v3
if: always()
with:
name: jacoco-test-results-miner
path: |
miner/build/reports/jacoco/test/*.xml
miner/build/reports/jacoco
if-no-files-found: error
retention-days: 14
test-viewer:
name: Run viewer tests
runs-on: ubuntu-latest
needs: build
permissions:
checks: write
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ vars.JAVA_VERSION }}
- name: Run tests
uses: gradle/gradle-build-action@v2
with:
arguments: |
:viewer:test
--scan
- name: Generate JaCoCo report
uses: gradle/gradle-build-action@v2
if: always()
with:
arguments: :viewer:jacocoTestReport
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: always()
with:
report_paths: 'viewer/build/test-results/test/*.xml'
- name: Publish coverage on CodeCov
uses: codecov/codecov-action@v3
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: viewer/build/reports/jacoco/test/jacocoTestReport.xml
flags: unittests-viewer
name: codecov-github-actions
- name: Upload JUnit reports
uses: actions/upload-artifact@v3
if: always()
with:
name: junit-test-results-viewer
path: |
viewer/build/test-results/test/*.xml
viewer/build/reports/tests/tests
if-no-files-found: error
retention-days: 14
- name: Upload JaCoCo reports
uses: actions/upload-artifact@v3
if: always()
with:
name: jacoco-test-results-viewer
path: |
viewer/build/reports/jacoco/test/*.xml
viewer/build/reports/jacoco
if-no-files-found: error
retention-days: 14
publish-miner:
name: Publish Miner on DockerHub
runs-on: ubuntu-latest
needs:
- test-miner
- test-viewer
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
concurrency: miner_docker
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ vars.JAVA_VERSION }}
- name: Calculate miner image name
id: miner-image-name
run: echo "IMAGE_NAME=${{ vars.DOCKER_IMAGE_MINER }}:${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
- name: Push branch/tag on Docker Hub
uses: gradle/gradle-build-action@v2
with:
arguments: |
:miner:jib
-Djib.to.auth.username=${{ secrets.DOCKER_USERNAME }}
-Djib.to.auth.password=${{ secrets.DOCKER_TOKEN }}
-Djib.to.image=${{ steps.miner-image-name.outputs.IMAGE_NAME }}
publish-viewer:
name: Publish Viewer on DockerHub
runs-on: ubuntu-latest
needs:
- test-miner
- test-viewer
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
concurrency: viewer_docker
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ vars.JAVA_VERSION }}
- name: Calculate viewer image name
id: viewer-image-name
run: echo "IMAGE_NAME=${{ vars.DOCKER_IMAGE_VIEWER }}:${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
- name: Push branch/tag on Docker Hub
uses: gradle/gradle-build-action@v2
with:
arguments: |
:viewer:jib
-Djib.to.auth.username=${{ secrets.DOCKER_USERNAME }}
-Djib.to.auth.password=${{ secrets.DOCKER_TOKEN }}
-Djib.to.image=${{ steps.viewer-image-name.outputs.IMAGE_NAME }}