-
Notifications
You must be signed in to change notification settings - Fork 7
55 lines (45 loc) · 1.18 KB
/
unit_tests.yml
File metadata and controls
55 lines (45 loc) · 1.18 KB
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
name: Unit Test
on:
push:
branches:
- 'main'
- 'release-*'
pull_request:
branches:
- 'main'
- 'release-*'
jobs:
# Calling reusable workflow
call-fetch-go-version:
uses: ./.github/workflows/fetch-go-version.yml
unit_test:
runs-on: ubuntu-latest
needs: call-fetch-go-version
timeout-minutes: 15
defaults:
run:
working-directory: ./api
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ needs.call-fetch-go-version.outputs.go-version }}
cache: false
- name: Install dependencies
run: go mod tidy
- name: Run unit tests
run: |
mkdir -p out
go test -coverprofile=out/coverage.out -v ./...
- name: Generate HTML coverage report
run: |
go tool cover -html=out/coverage.out -o out/coverage.html
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v4
with:
name: coverage-reports
path: |
api/out/coverage.out
api/out/coverage.html