diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9e8feda..90bed30 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,5 +21,14 @@ jobs: - name: Build run: go build -v ./... - - name: Test - run: go test -v ./... + - name: Run Unit tests + run: | + go test -race -covermode atomic -coverprofile=covprofile ./... + + - name: Install goveralls + run: go install github.com/mattn/goveralls@latest + + - name: Send coverage + env: + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: goveralls -coverprofile=covprofile -service=github diff --git a/README.md b/README.md index be43a5f..0fc9db9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ![test workflow](https://github.com/yudppp/throttle/actions/workflows/test.yml/badge.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/yudppp/throttle)](https://goreportcard.com/report/github.com/yudppp/throttle) +[![Coverage Status](https://coveralls.io/repos/github/yudppp/throttle/badge.svg?branch=master)](https://coveralls.io/github/yudppp/throttle?branch=master) Throttle is an object that will perform exactly one action per duration. Do call the function f if a specified duration has passed since the last function f was called for this instance of Throttle.