forked from infinispan/infinispan
-
Notifications
You must be signed in to change notification settings - Fork 5
259 lines (228 loc) · 9.19 KB
/
on_build_do_test.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
name: Test
run-name: ${{ github.event.workflow_run.display_title }}
on:
workflow_run:
workflows: [Build]
types: [completed]
permissions:
contents: read
packages: read
# Needed to write commit status
statuses: write
concurrency:
# Cancel jobs same head_branch same repo, works
# both for pull_request and push
group: >
${{ github.workflow }}-${{ github.event.workflow_run.head_repository.full_name }}-
${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true
jobs:
get-info:
if: github.event.workflow_run.conclusion == 'success'
name: Get Origin Workflow Info
runs-on: ubuntu-latest
outputs:
source-head-sha: ${{ github.event.workflow_run.head_sha }}
pull-request-number: ${{ steps.workflow-run-info.outputs.pull-request-number }}
source-head-branch: ${{ steps.workflow-run-info.outputs.source-head-branch }}
source-event: ${{ github.event.workflow_run.event }}
steps:
- uses: actions/checkout@v4
- id: workflow-run-info
uses: ./.github/actions/get-origin-info
with:
head-sha: ${{ github.event.workflow_run.head_sha }}
head-branch: ${{ github.event.workflow_run.head_branch }}
event: ${{ github.event.workflow_run.event }}
ci-build-test-pr:
needs: get-info
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Maven Test
runs-on: ubuntu-latest
env:
MAVEN_OPTS: "-Xmx1500m -XX:+HeapDumpOnOutOfMemoryError"
GH_TOKEN: ${{ github.token }}
steps:
- name: set-commit-status-pending
uses: myrotvorets/set-commit-status-action@v2.0.1
with:
context: Test mvn verify
status: pending
sha: ${{ needs.get-info.outputs.source-head-sha }}
targetUrl: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- uses: actions/checkout@v4
- name: Setup Java
uses: ./.github/actions/setup-java
- uses: graalvm/setup-graalvm@v1
with:
java-version: 21
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Maven Artifacts
uses: ./.github/actions/extract-maven-artifacts
with:
run-id: ${{ github.event.workflow_run.id }}
- name: Download Infinispan Server
id: dis
uses: ./.github/actions/download-infinispan
with:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
- name: Extract Infinispan Source
run: |
mkdir test_dir && cd test_dir
unzip ${GITHUB_WORKSPACE}/infinispan-${{ steps.dis.outputs.server-version }}-src.zip
mv infinispan-${{ steps.dis.outputs.server-version }}-src infinispan
- name: Maven Test
id: maven-test
shell: bash
run: >
cd test_dir/infinispan &&
./mvnw verify -V -B -e -DrerunFailingTestsCount=2
-Dmaven.test.failure.ignore=true -Dansi.strip=true -Pnative
- name: set-commit-status-conclusion
if: success()
uses: myrotvorets/set-commit-status-action@v2.0.1
with:
context: Test mvn verify
status: success
sha: ${{ needs.get-info.outputs.source-head-sha }}
targetUrl: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: set-commit-status-conclusion
if: always() && failure()
uses: myrotvorets/set-commit-status-action@v2.0.1
with:
context: Test mvn verify
status: failure
sha: ${{ needs.get-info.outputs.source-head-sha }}
targetUrl: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Archive commit sha PR
if: >
(success() || failure()) &&
needs.get-info.outputs.source-event == 'pull_request'
run: |
echo -n ${{ needs.get-info.outputs.source-head-sha }} > github-sha.txt
- name: Archive commit sha push
if: >
(success() || failure()) &&
needs.get-info.outputs.source-event == 'push'
run: |
echo -n ${{ needs.get-info.outputs.source-head-sha }} > github-sha.txt
- name: Archive surefire test report
if: (success() || failure())
uses: actions/upload-artifact@v4
with:
name: surefire-test-report
path: |
test_dir/infinispan/**/surefire-reports/TEST-*.xml
test_dir/infinispan/**/*.dump*
test_dir/infinispan/**/hs_err_*
github-sha.txt
!test_dir/infinispan/**/*-reports*/**/TEST-*FLAKY.xml
!test_dir/infinispan/**/*-reports*/TEST-*RocksDB*.xml
# Create artifact with branch name and surefile flaky test report
- name: Check flaky report existence
if: success() || failure()
id: check_flaky_report
uses: andstor/file-existence-action@v3
with:
files: "test_dir/infinispan/**/target/*-reports*/**/TEST-*FLAKY.xml"
- name: Archive base_ref
if: (success() || failure()) && steps.check_flaky_report.outputs.files_exists == 'true'
env:
TARGET_BRANCH: ${{ needs.get-info.outputs.source-head-sha }}
EVENT_NAME: ${{ needs.get-info.outputs.source-event }}
PR_NUMBER: ${{ needs.get-info.outputs.pull-request-number }}
EVENT_NUMBER: ${{ github.event.workflow_run.id }}
run: |
echo -n $TARGET_BRANCH > target-branch.txt
echo -n $EVENT_NAME > event-name.txt
echo -n $EVENT_NUMBER > event-number.txt
echo -n $PR_NUMBER > pr-number.txt
- name: Archive flaky test report
if: (success() || failure()) && steps.check_flaky_report.outputs.files_exists == 'true'
uses: actions/upload-artifact@v4
with:
name: flaky-test-report
path: |
test_dir/infinispan/**/target/*-reports*/**/TEST-*FLAKY.xml
target-branch.txt
event-name.txt
event-number.txt
pr-number.txt
db:
needs: get-info
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dbs:
- mssql
- oracle
steps:
- name: set-commit-status-pending
uses: myrotvorets/set-commit-status-action@v2.0.1
with:
context: Test DB ${{ matrix.dbs }}
status: pending
sha: ${{ needs.get-info.outputs.source-head-sha }}
targetUrl: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- uses: actions/checkout@v4
- name: Setup Java
uses: ./.github/actions/setup-java
- name: Extract Maven Artifacts
uses: ./.github/actions/extract-maven-artifacts
with:
run-id: ${{ github.event.workflow_run.id }}
- name: Download Infinispan Server
id: dis
uses: ./.github/actions/download-infinispan
with:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
- name: Extract Infinispan Server
run: |
cd /tmp
unzip ${GITHUB_WORKSPACE}/infinispan-server-${{ steps.dis.outputs.server-version }}.zip
- name: Extract Infinispan Source
run: |
mkdir test_dir && cd test_dir
unzip ${GITHUB_WORKSPACE}/infinispan-${{ steps.dis.outputs.server-version }}-src.zip
mv infinispan-${{ steps.dis.outputs.server-version }}-src infinispan
- name: Test
run: |
cd test_dir/infinispan &&
./mvnw verify -B -e -pl server/tests -Dmaven.test.failure.ignore=true \
-Dansi.strip=true \
-DdefaultTestGroup=database \
-Dorg.infinispan.test.database.types=${{ matrix.dbs }} \
-Dorg.infinispan.test.server.dir=/tmp/infinispan-server-${{ steps.dis.outputs.server-version }}
- name: Archive surefire test report
if: (success() || failure())
uses: actions/upload-artifact@v4
with:
name: surefire-test-report-${{ matrix.dbs }}
path: |
test_dir/infinispan/**/failsafe-reports/TEST-*.xml
test_dir/infinispan/**/*.dump*
test_dir/infinispan/**/hs_err_*
test_dir/infinispan/**/failsafe-summary.xml
github-sha.txt
!test_dir/infinispan/**/target/*-reports*/**/TEST-*FLAKY.xml
- name: set-commit-status-conclusion
if: success()
uses: myrotvorets/set-commit-status-action@v2.0.1
with:
context: Test DB ${{ matrix.dbs }}
status: success
sha: ${{ needs.get-info.outputs.source-head-sha }}
targetUrl: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: set-commit-status-conclusion
if: always() && failure()
uses: myrotvorets/set-commit-status-action@v2.0.1
with:
context: Test DB ${{ matrix.dbs }}
status: failure
sha: ${{ needs.get-info.outputs.source-head-sha }}
targetUrl: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}