generated from telekom/reuse-template
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 1.4 KB
/
go-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
# Copyright 2024 Deutsche Telekom IT GmbH
#
# SPDX-License-Identifier: Apache-2.0
name: Go Test
on: [push]
jobs:
test:
runs-on: ubuntu-latest
services:
docker:
image: docker:20.10.12-dind
ports:
- 2375:2375
- 9094:9094
- 27017:27017
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21
- name: Run go test
env:
KAFKA_HOST: localhost:9094
KAFKA_IMAGE: bitnami/kafka
KAFKA_TAG: 3.4.1
MONGO_HOST: localhost:27017
MONGO_IMAGE: mongo
MONGO_TAG: 7.0.5-rc0
run: go test -v ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
- name: Prepare archive
run: mkdir -p ./out/reports ./out/badges
- name: Generate coverage report
run: go tool cover -html=cover.out -o=./out/reports/coverage-report.html
- name: Check test coverage
uses: vladopajic/go-test-coverage@v2
with:
profile: cover.out
local-prefix: github.com/telekom/pubsub-horizon-vortex
badge-file-name: ./out/badges/coverage.svg
git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }}
git-branch: badges
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
path: ./out/**