-
Notifications
You must be signed in to change notification settings - Fork 5
98 lines (79 loc) · 1.97 KB
/
test.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
name: Test
on:
pull_request:
branches:
- main
push:
branches:
- main
env:
GO_VERSION: 1.23
permissions:
checks: write
contents: read
jobs:
test:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:latest
ports:
- 27017:27017
redis:
image: redis:latest
ports:
- 6379:6379
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v4
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- name: Install mockgen
run: go install github.com/golang/mock/mockgen@latest
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Generate Mocks
run: make gen-mocks
- name: Generate TLS certificates
run: make gen-cert
- name: Go mod tidy
run: go mod tidy
- name: Make test
run: make test
- name: Publish test results
uses: actions/upload-artifact@v4
if: always()
with:
name: gotest.out
path: gotest.out
- name: Publish JUnit report
uses: actions/upload-artifact@v4
if: always()
with:
name: junit.xml
path: junit.xml
- name: JUnit report action
uses: mikepenz/action-junit-report@v4
if: always()
with:
report_paths: junit.xml
job_name: test
check_name: JUnit Test Report
- name: Coverage Report
uses: codecov/codecov-action@v4
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: coverage.out
verbose: true