-
Notifications
You must be signed in to change notification settings - Fork 1
199 lines (170 loc) · 6.8 KB
/
ship2qa.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
name: "Ship - QA"
on:
pull_request:
branches:
- trunk
types:
- opened
- synchronize
- ready_for_review
paths:
- 'frontend/**'
- 'src/**'
- 'pom.xml'
- 'Dockerfile*'
jobs:
ship2qa:
name: Ship::QA
runs-on: self-hosted
if: github.event.pull_request.draft == false
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to kio.ee
run: cat ${{ secrets.KIO_TOKEN_FILE }} | docker login -u "${{ secrets.KIO_ROBOT }}" --password-stdin kio.ee
- name: Resolve Dependencies
run: mvn --batch-mode --update-snapshots dependency:tree
- name: Compile JAR
run: mvn --batch-mode --update-snapshots clean package -P production-mode,noTesting
- name: Pull latest base and build images
run: for img in kio.ee/base/go:1.19 kio.ee/base/java:17-jdk kio.ee/base/java:17-jre; do docker pull $img; done
- name: Docker build and tag
run: docker build -f Dockerfile.PROD -t kio.ee/kyberorg/axe:qa .
- name: Docker push
run: docker push kio.ee/kyberorg/axe:qa > qa.sha
- name: Get Docker image SHA256
id: docker_image_sha
run: echo "imageSha=$(cat qa.sha | tail -n 1 | awk '{print $3}')" >> $GITHUB_OUTPUT
- name: Debug image SHA256
run: echo ${{ steps.docker_image_sha.outputs.imageSha }}
- name: Delete pushed image to prevent mess
run: docker rmi kio.ee/kyberorg/axe:qa
continue-on-error: true
- name: Delete SHA file to prevent mess
run: rm -f qa.sha
continue-on-error: true
- name: Run Harbor Scan Report
uses: kyberorg/[email protected]
with:
harbor-host: kio.ee
harbor-robot: ${{ secrets.KIO_USER }}
harbor-token: ${{ secrets.KIO_PASS }}
image: kio.ee/kyberorg/axe:qa
digest: ${{ steps.docker_image_sha.outputs.imageSha }}
max-allowed-severity: critical
report-sort-by: score
timeout: 100
github-url: ${{ github.event.pull_request.comments_url }}
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-mode: update_last
if: ${{ false }}
- name: Deploy
uses: wei/curl@master
with:
args: -X POST ${{ secrets.QA_DEPLOY_HOOK }}?tag=qa@${{ steps.docker_image_sha.outputs.imageSha }}
- name: Get deployed commit SHA
id: deployed_commit
run: echo "sha=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_OUTPUT
- name: Wait for site appears online
uses: kyberorg/wait_for_new_version@v3
with:
url: https://qa.axe.pm
responseCode: 200
timeout: 120
interval: 1.5
hasActuator: true
commitSha: ${{ steps.deployed_commit.outputs.sha }}
test-qa:
name: Test::QA
needs: ship2qa
runs-on: self-hosted
if: github.event.pull_request.draft == false
outputs:
rerunFlag: ${{ steps.runTests.outcome }}
steps:
- name: Get current date
id: date
run: echo "date=$(date +'%y%m%d-%H%M')" >> $GITHUB_OUTPUT
- name: Test App
id: runTests
continue-on-error: true
run: mvn -Ptesting-only -Dtest.url=https://qa.axe.pm -Dgrid.hostname=http://grid.kio.ee -Dselenide.browser=chrome -Dtest.buildName=axe-qa-${{ steps.date.outputs.date }} -Dapp.shortUrl=https://q.axe.pm -Dtest.masterToken=${{ secrets.QA_MASTER_TOKEN }} -Dtest.report.failed-tests-filename=target/test-fails.txt clean test
env:
JAVA_HOME: /srv/java17
- name: Publish List of failing tests (if any)
uses: actions/upload-artifact@v3
continue-on-error: true
with:
name: test-fails
path: target/test-fails.txt
if-no-files-found: ignore
- name: Publish Screenshots of failing tests (if any)
uses: actions/upload-artifact@v3
continue-on-error: true
with:
name: failedTests
path: target/reports/**/*.png
if-no-files-found: ignore
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
check_name: QA Test Results
comment_title: QA Test Statistics
comment_mode: 'always'
test_changes_limit: 5
junit_files: target/surefire-reports/**/*.xml
report_individual_runs: true
deduplicate_classes_by_file_name: false
check_run_annotations: all tests, skipped tests
- name: Delete Test Video (No failed tests)
if: steps.runTests.outcome == 'success'
uses: wei/curl@master
continue-on-error: true
with:
args: -X DELETE -H "X-Token:${{ secrets.GRID_API_TOKEN }}" ${{ secrets.GRID_API_ENDPOINT }}/videos/axe-qa-${{ steps.date.outputs.date }}
rerun-tests-qa:
name: Test::ReRun::QA
needs: test-qa
runs-on: self-hosted
if: needs.test-qa.outputs.rerunFlag == 'failure'
steps:
- name: Download file with failed tests
uses: actions/download-artifact@v3
with:
name: test-fails
- name: Get current date
id: date
run: echo "date=$(date +'%y%m%d-%H%M')" >> $GITHUB_OUTPUT
- name: ReRun Tests with mvn-rr
id: reRunTests
continue-on-error: true
run: ./mvn-rr -file="test-fails.txt" -profiles="testing-only" -params="-Dtest.url=https://qa.axe.pm -Dgrid.hostname=http://grid.kio.ee -Dselenide.browser=chrome -Dtest.buildName=axe-qa-rerun-${{ steps.date.outputs.date }} -Dapp.shortUrl=https://q.axe.pm -Dtest.masterToken=${{ secrets.QA_MASTER_TOKEN }} -Dtest.show-test-names-in-video=true"
env:
JAVA_HOME: /srv/java17
- name: Publish Screenshots of still failing tests (if any)
uses: actions/upload-artifact@v3
continue-on-error: true
with:
name: stillFailedTests
path: target/reports/**/*.png
if-no-files-found: ignore
- name: Publish New Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
check_name: QA Test Results
comment_title: QA Test Statistics
test_changes_limit: 0
junit_files: target/surefire-reports/**/*.xml
report_individual_runs: true
deduplicate_classes_by_file_name: false
check_run_annotations: all tests, skipped tests
- name: Delete Test Video (No failed tests)
if: steps.reRunTests.outcome == 'success'
uses: wei/curl@master
continue-on-error: true
with:
args: -X DELETE -H "X-Token:${{ secrets.GRID_API_TOKEN }}" ${{ secrets.GRID_API_ENDPOINT }}/videos/axe-qa-rerun-${{ steps.date.outputs.date }}