-
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (96 loc) · 2.64 KB
/
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
name: Test 🧪
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
workflow_dispatch:
concurrency:
group: test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test 🔍
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- 1.21.3
defaults:
run:
shell: bash
steps:
- name: Checkout Repo 🛎
uses: actions/checkout@v3
- name: Setup Go 🐹
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
cache: true
cache-dependency-path: go.sum
- name: Run Tests 🧨
run: make test
- name: Check whether JUnit XML report exists 🚦
id: check-junit-xml
uses: andstor/file-existence-action@v2
with:
files: junit-report.xml
- name: Publish Unit Test Summary 📑
uses: EnricoMi/publish-unit-test-result-action@v2
id: test-results
if: steps.check-junit-xml.outputs.files_exists == 'true' && github.event_name == 'pull_request'
with:
check_name: Unit Tests Summary
junit_files: junit-report.xml
- name: Check whether coverage reports exists 💭
id: check-coverage-reports
uses: andstor/file-existence-action@v2
with:
files: >-
coverage.xml,
coverage.html
- name: Post coverage report 🗞
if: steps.check-coverage-reports.outputs.files_exists == 'true'
uses: insightsengineering/coverage-action@v2
with:
path: coverage.xml
threshold: 80
fail: false
publish: true
diff: true
coverage-reduction-failure: true
new-uncovered-statements-failure: true
continue-on-error: true
- name: Upload report 🔼
if: steps.check-coverage-reports.outputs.files_exists == 'true'
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: |
coverage.html
continue-on-error: true
compilation:
name: Build 🏗
strategy:
matrix:
go-version:
- 1.21.3
runs-on: ubuntu-latest
steps:
- name: Checkout Repo 🛎
uses: actions/checkout@v3
- name: Setup Go 🐹
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
cache: true
cache-dependency-path: go.sum
- name: Check if compilation works 🧱
run: make build