From c7a461e07b997d1f172b02e9eb69519687c46723 Mon Sep 17 00:00:00 2001 From: yudppp Date: Wed, 25 Aug 2021 00:04:10 +0900 Subject: [PATCH 1/2] add: Add coveralls --- .github/workflows/test.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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 From 77b5c198b023768299d76ec82011343439c22d6c Mon Sep 17 00:00:00 2001 From: yudppp Date: Wed, 25 Aug 2021 00:08:37 +0900 Subject: [PATCH 2/2] add: Add coveralls badge --- README.md | 1 + 1 file changed, 1 insertion(+) 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.