Skip to content

Commit 27328ab

Browse files
authored
Update code coverage reporting (#928)
Signed-off-by: John Collier <[email protected]> Signed-off-by: John Collier <[email protected]>
1 parent d563c4c commit 27328ab

File tree

3 files changed

+64
-9
lines changed

3 files changed

+64
-9
lines changed

.codecov.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# See http://docs.codecov.io/docs/coverage-configuration
2+
coverage:
3+
precision: 2 # 2 = xx.xx%, 0 = xx%
4+
round: down
5+
# For example: 20...60 would result in any coverage less than 20%
6+
# would have a red background. The color would gradually change to
7+
# green approaching 60%. Any coverage over 60% would result in a
8+
# solid green color.
9+
range: "20...60"
10+
11+
status:
12+
# project will give us the diff in the total code coverage between a commit
13+
# and its parent
14+
project: yes
15+
# Patch gives just the coverage of the patch
16+
patch: yes
17+
# changes tells us if there are unexpected code coverage changes in other files
18+
# which were not changed by the diff
19+
changes: yes
20+
21+
# See http://docs.codecov.io/docs/ignoring-paths
22+
ignore:
23+
- "assets/*"
24+
- "build/*"
25+
- "deploy/*"
26+
- "hack/*"
27+
- "manifests/*"
28+
- "openshift-ci/*"
29+
- "vendor/*"
30+
- "Makefile"
31+
- ".travis.yml"
32+
33+
# See http://docs.codecov.io/docs/pull-request-comments-1
34+
comment:
35+
layout: "diff, files"
36+
behavior: ""
37+
# default = posts once then update, posts new if delete
38+
# once = post once then updates
39+
# new = delete old, post new
40+
# spammy = post new

.github/workflows/ci.yaml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,10 @@ jobs:
3434
run: ./docker-run.sh ./validate-samples.sh
3535

3636
- name: Run GO tests
37-
run: go test -coverprofile test/v200/api-test-coverage.out -v ./...
38-
39-
- name: Generate test coverage report
40-
run: go tool cover -html=test/v200/api-test-coverage.out -o test/v200/api-test-coverage.html
37+
run: go test -coverprofile cover.out -v ./...
4138

42-
- name: Upload Test Coverage results
43-
uses: actions/upload-artifact@v2
44-
with:
45-
name: api-test-coverage-html
46-
path: test/v200/api-test-coverage.html
39+
- name: Upload coverage to Codecov
40+
uses: codecov/[email protected]
4741

4842
- name: Check typescript model generation
4943
run: ./build/typescript-model/generate.sh

.github/workflows/codecov.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Code Coverage Report
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
build-and-deploy:
8+
runs-on: ubuntu-20.04
9+
steps:
10+
- name: Checkout
11+
uses: actions/[email protected]
12+
with:
13+
persist-credentials: false
14+
- name: Set up Go 1.x
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: 1.17
18+
- name: Run tests
19+
run: go test ./... -coverprofile cover.out
20+
- name: Codecov
21+
uses: codecov/[email protected]

0 commit comments

Comments
 (0)