Skip to content

Commit 6f94208

Browse files
committed
Add Codecov upload step to "Test Go" workflow
This will record the project's test coverage data on Codecov. A readme badge will display the % coverage and link to the project's data.
1 parent fc4b3c3 commit 6f94208

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.github/workflows/test-go-task.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
push:
1212
paths:
1313
- ".github/workflows/test-go-task.ya?ml"
14+
- "codecov.ya?ml"
1415
- "**/go.mod"
1516
- "**/go.sum"
1617
- "Taskfile.ya?ml"
@@ -19,6 +20,7 @@ on:
1920
pull_request:
2021
paths:
2122
- ".github/workflows/test-go-task.ya?ml"
23+
- "codecov.ya?ml"
2224
- "**/go.mod"
2325
- "**/go.sum"
2426
- "Taskfile.ya?ml"
@@ -94,6 +96,7 @@ jobs:
9496
- ubuntu-latest
9597
module:
9698
- path: ./
99+
codecov-flags: unit
97100

98101
runs-on: ${{ matrix.operating-system }}
99102

@@ -130,3 +133,11 @@ jobs:
130133
env:
131134
GO_MODULE_PATH: ${{ matrix.module.path }}
132135
run: task go:test
136+
137+
- name: Send unit tests coverage to Codecov
138+
if: runner.os == 'Linux'
139+
uses: codecov/codecov-action@v2
140+
with:
141+
file: ${{ matrix.module.path }}coverage_unit.txt
142+
flags: ${{ matrix.module.codecov-flags }}
143+
fail_ci_if_error: ${{ github.repository == 'REPO_OWNER/REPO_NAME' }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# libraries-repository-engine
22

33
[![Test Go status](https://github.com/arduino/libraries-repository-engine/actions/workflows/test-go-task.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/test-go-task.yml)
4+
[![Codecov](https://codecov.io/gh/arduino/libraries-repository-engine/branch/main/graph/badge.svg)](https://codecov.io/gh/arduino/libraries-repository-engine)
45
[![Integration Test status](https://github.com/arduino/libraries-repository-engine/actions/workflows/test-go-integration-task.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/test-go-integration-task.yml)
56
[![Check Go status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-go-task.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-go-task.yml)
67
[![Check Prettier Formatting status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-prettier-formatting-task.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-prettier-formatting-task.yml)

0 commit comments

Comments
 (0)