Skip to content

Commit 96f534e

Browse files
AObuchowibuziuk
authored andcommitted
feat: add code coverage report GitHub Action
Fix #929 Signed-off-by: Andrew Obuchowicz <[email protected]>
1 parent eab583f commit 96f534e

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

Diff for: .github/workflows/code-coverage.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Code Coverage Report
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
coverage-report:
12+
name: Check Code Coverage
13+
runs-on: ubuntu-20.04
14+
steps:
15+
-
16+
name: Set up Go 1.x
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.16.6
20+
-
21+
name: Set up Python 3.8
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: 3.8
25+
-
26+
name: Check out code into the Go module directory
27+
uses: actions/checkout@v2
28+
-
29+
name: Cache go modules
30+
id: cache-mod
31+
uses: actions/cache@v2
32+
with:
33+
path: ~/go/pkg/mod
34+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
35+
restore-keys: |
36+
${{ runner.os }}-go-
37+
-
38+
name: Download dependencies
39+
run: go mod download
40+
if: steps.cache-mod.outputs.cache-hit != 'true'
41+
-
42+
name: Run Go Tests
43+
run: |
44+
python -m pip install --upgrade pip yq
45+
make test
46+
-
47+
name: Build Codecov report
48+
uses: codecov/codecov-action@v1
49+
with:
50+
files: cover.out

Diff for: README.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Dev Workspace Operator
22

3+
[![codecov](https://codecov.io/gh/devfile/devworkspace-operator/branch/main/graph/badge.svg)](https://codecov.io/gh//devfile/devworkspace-operator)
4+
35
Dev Workspace operator repository that contains the controller for the DevWorkspace Custom Resource. The Kubernetes API of the DevWorkspace is defined in the https://github.com/devfile/api repository.
46

57
## DevWorkspace CR
@@ -180,3 +182,5 @@ This will delete all custom resource definitions created for the controller, as
180182
#### GitHub actions
181183

182184
- [Next Dockerimage](https://github.com/devfile/devworkspace-operator/blob/main/.github/workflows/dockerimage-next.yml) action builds main branch and pushes it to [quay.io/devfile/devworkspace-controller:next](https://quay.io/repository/devfile/devworkspace-controller?tag=latest&tab=tags)
185+
186+
- [Code Coverage Report](./.github/workflows/code-coverage.yml) action creates a code coverage report using [codecov.io](https://about.codecov.io/).

Diff for: codecov.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github_checks:
2+
annotations: false

0 commit comments

Comments
 (0)