-
-
Notifications
You must be signed in to change notification settings - Fork 372
58 lines (56 loc) · 1.68 KB
/
pr_test-coverage.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
name: Test Coverage
on: [ pull_request ]
jobs:
pr-test:
if: ${{ github.event_name }} == 'pull_request'
permissions:
pull-requests: write
contents: read
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_PASSWORD: example
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- "5432:5432"
mq:
image: rabbitmq:3-management
ports:
- 5672:5672
- 15672:15672
env:
ALLOW_ANONYMOUS_LOGIN: "yes"
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Test
run: TEST_DB=1 TEST_MQ=1 go test ./... -coverprofile=cover.out
timeout-minutes: 5
env:
AWS_ACCESS_KEY_ID: ${{ secrets.TESTING_AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TESTING_AWS_SECRET_KEY }}
- name: Install dependencies
run: go install github.com/axw/gocov/gocov@v1.1.0 && go install github.com/AlekSi/gocov-xml@v1.1.0
- run: gocov convert cover.out | gocov-xml > coverage.xml
- name: Code Coverage Summary
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage.xml
badge: true
format: markdown
output: both
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2.6.2
with:
recreate: true
path: code-coverage-results.md
number: ${{ github.event.number }}