-
Notifications
You must be signed in to change notification settings - Fork 2
223 lines (196 loc) · 6.6 KB
/
tests.yaml
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
name: Run Tests
on:
push:
pull_request:
types: [ opened, synchronize ]
workflow_dispatch:
env:
PRIVATE_MVN_REGISTRY_TOKEN: ${{ secrets.GITLAB_PKG_REGISTRY_TOKEN }}
PRIVATE_MVN_REGISTRY_URL: ${{ secrets.GITLAB_MAVEN_REGISTRY_URL }}
PRIVATE_MVN_REGISTRY_USER: ${{ secrets.PRIVATE_MVN_REGISTRY_USER }}
PRIVATE_MVN_REGISTRY_PASS: ${{ secrets.PRIVATE_MVN_REGISTRY_PASS }}
jobs:
test:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup JDK 18
uses: actions/setup-java@v3
with:
java-version: '18'
distribution: 'temurin'
cache: maven
- name: Setup depends
run: |
pip install yq
- name: Setup maven settings.xml
run: |
envsubst < ./.m2/settings.default.xml.tpl > ./.m2/settings.xml
- name: Check Formatting
run: |
mvn spotless:check
- name: Build
run: |
mvn --batch-mode --update-snapshots clean package -DskipTests
- name: Test
run: |
mvn --batch-mode --update-snapshots test
- name: Generate JaCoCo Badge
uses: cicirello/jacoco-badge-generator@v2
with:
generate-branches-badge: true
generate-summary: true
badges-directory: build/reports/jacoco/test/html/badges
- name: Log coverage percentage
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"
- name: Publish coverage report to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
with:
BRANCH: gh-pages
folder: build/reports/jacoco/test/html
mutation-test:
needs: test
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup JDK 18
uses: actions/setup-java@v3
with:
java-version: '18'
distribution: 'temurin'
cache: maven
- name: Setup depends
run: |
pip install yq
- name: Setup maven settings.xml
run: |
envsubst < ./.m2/settings.default.xml.tpl > ./.m2/settings.xml
- name: Build
run: |
mvn --batch-mode --update-snapshots clean package -DskipTests
- name: Test
run: |
mvn test-compile org.pitest:pitest-maven:mutationCoverage -DmutationThreshold=19
- name: Publish mutation test report to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
with:
BRANCH: gh-pages
folder: target/pit-reports/
target-folder: mutation-report/
end2end:
needs: test
runs-on: self-hosted
container:
image: postman/newman
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install report library allure
run: npm install -g newman-reporter-allure
- name: Install allure
run: npm install -g allure @apideck/postman-to-k6
- name: Install report library htmlextra
run: npm install -g newman-reporter-htmlextra
- name: Migrate config
run: postman-to-k6 src/test/Postman/Cardano-Explorer-API.postman_collection.json --environment src/test/Postman/DevInt.postman_environment.json -o k6-script.js --skip-post -i 10
- name: Test
run: newman run src/test/Postman/Cardano-Explorer-API.postman_collection.json -e src/test/Postman/DevInt.postman_environment.json -r cli,htmlextra,allure --reporter-htmlextra-export=reporthtml/reporthtml.html --timeout-request 10000
- name: Allure Report action from marketplace
uses: simple-elf/allure-report-action@master
if: github.ref == 'refs/heads/main'
#id: allure-report
with:
allure_results: allure-results
- name: Archive html results
uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/main'
with:
name: html-report
path: reporthtml
- name: Archive k6 script
uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/main'
with:
name: k6-script
path: |
k6-script.js
libs/
- name: Archive allure results
uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/main'
with:
name: allure-report
path: allure-report
loadTest:
if: always()
needs: end2end
runs-on: self-hosted
#container:
# image: loadimpact/k6:latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Run local k6 test
uses: grafana/[email protected]
with:
filename: k6-script/k6-script.js
flags: --vus 10 --out csv=k6_results.csv
- name: Archive allure results
uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/main'
with:
name: loadtest-report
path: k6_results.csv
pages:
needs: [end2end,loadTest]
if: github.ref == 'refs/heads/main'
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup JDK 18
uses: actions/setup-java@v3
with:
java-version: '18'
distribution: 'temurin'
cache: maven
- name: Setup depends
run: |
pip install yq
- name: Setup maven settings.xml
run: |
envsubst < ./.m2/settings.default.xml.tpl > ./.m2/settings.xml
- name: Build
run: |
mvn --batch-mode --update-snapshots clean package -DskipTests
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Publish mutation test report to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
with:
BRANCH: gh-pages
folder: allure-report
target-folder: allure-report/
- name: Publish mutation test report to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
with:
BRANCH: gh-pages
folder: html-report
target-folder: html-report/
- name: Publish LoadTest report to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
with:
BRANCH: gh-pages
folder: loadtest-report
target-folder: loadtest-report/