Skip to content

Commit

Permalink
[add] code coverage metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Zensey committed Sep 10, 2020
1 parent 2ee7374 commit cba7700
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
48 changes: 48 additions & 0 deletions .github/workflows/cover.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test
on: [push]
env:
GO111MODULE: "on"

jobs:
test:
name: Tests and Coverage
runs-on: ubuntu-latest
steps:

- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Get dependencies
run: |
go get -d -v
- name: Run tests and calculate code coverage
run: |
out=$(go test ./... -coverprofile cover.out)
out="${out//'%'/'%25'}"
out="${out//$'\n'/'%0A'}"
out="${out//$'\r'/'%0D'}"
echo -e "::set-env name=COVER::$out"
go tool cover -html=cover.out -o coverage.html
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: coverage
path: coverage.html

- name: Comment
uses: mshick/add-pr-comment@v1
with:
message: |
**code coverage: **
${{ env.COVER }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login: 'github-actions[bot]' # The user.login for temporary GitHub tokens
allow-repeats: true # This is the default
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# go-data-routing

![Test](https://github.com/Zensey/go-data-routing/workflows/Test/badge.svg?branch=dev)


The library provides a pipeline engine for stream processing of data.
It is based on the concept of EIP (enterprise integration patterns).

Expand Down
3 changes: 2 additions & 1 deletion route_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (r *Probe) Run() {}

func TestEnrich(t *testing.T) {

for i := 0; i < 1000; i++ {
for i := 0; i < 100; i++ {
Enrich(t)
}
}
Expand Down Expand Up @@ -51,6 +51,7 @@ func Enrich(t *testing.T) {
}()
rc.Run()
rc.Print()

// check that all nodes are stoped
for _, r := range rc.routes {
for _, n := range *r {
Expand Down

0 comments on commit cba7700

Please sign in to comment.