-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (151 loc) · 4.43 KB
/
codecov.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: "Codecov Go test"
on:
push:
branches:
- main
tags:
- 'v*.*.*'
paths:
- '.github/workflows/codecov.yml'
- 'src/**'
pull_request:
branches:
- main
paths:
- '.github/workflows/codecov.yml'
- 'src/**'
env:
UPDATER_DIR: "src/updater"
API_DIR: "src/api"
KEY_MAN_DIR: "src/key_management"
SRC_DIR: "src"
jobs:
coverage-updater:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: app
POSTGRES_PASSWORD: password
POSTGRES_DB: unittest
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache-dependency-path: |
src/go.sum
- name: Run migration
working-directory: ${{ env.UPDATER_DIR }}
shell: bash -l {0}
run: |
go install github.com/pressly/goose/v3/cmd/goose@latest
$(go env GOPATH)/bin/goose --dir database/migrations/ postgres "host=localhost user=app password=password dbname=unittest sslmode=disable" up
- name: Build
working-directory: ${{ env.UPDATER_DIR }}
run: go build -v ./...
- name: Test
working-directory: ${{ env.UPDATER_DIR }}
env:
COV_FILE_NAME: coverage.txt
MODE: atomic
run: go test -v -race -coverprofile=${{ env.COV_FILE_NAME }} -covermode=${{ env.MODE }} ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
flags: smart-tests
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
coverage-api:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: app
POSTGRES_PASSWORD: password
POSTGRES_DB: unittest
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache-dependency-path: |
src/go.sum
- name: Run migration
working-directory: ${{ env.API_DIR }}
shell: bash -l {0}
run: |
go install github.com/pressly/goose/v3/cmd/goose@latest
$(go env GOPATH)/bin/goose --dir database/migrations/ postgres "host=localhost user=app password=password dbname=unittest sslmode=disable" up
- name: Build
working-directory: ${{ env.API_DIR }}
run: go build -v ./...
- name: Test
working-directory: ${{ env.API_DIR }}
env:
COV_FILE_NAME: coverage.txt
MODE: atomic
run: go test -v -race -coverprofile=${{ env.COV_FILE_NAME }} -covermode=${{ env.MODE }} ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
flags: smart-tests
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
coverage-key-manager:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: app
POSTGRES_PASSWORD: password
POSTGRES_DB: unittest
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache-dependency-path: |
src/go.sum
- name: Run migration
working-directory: ${{ env.SRC_DIR }}
shell: bash -l {0}
env:
PSQL_HOSTNAME: localhost
DATABASE: unittest
run: |
go mod download
go cmd/migration.go
- name: Build
working-directory: ${{ env.KEY_MAN_DIR }}
run: go build -v ./...
- name: Test
working-directory: ${{ env.KEY_MAN_DIR }}
env:
COV_FILE_NAME: coverage.txt
MODE: atomic
run: go test -v -race -coverprofile=${{ env.COV_FILE_NAME }} -covermode=${{ env.MODE }} ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
flags: smart-tests
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}