Skip to content

Commit

Permalink
update github action for code coverage and badges in readme was added
Browse files Browse the repository at this point in the history
  • Loading branch information
pzentenoe committed Apr 9, 2024
1 parent 7429166 commit b23d171
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/action.yml → .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,18 @@ jobs:
- name: Update dependencies
run: go mod tidy

- name: Test
run: go test ./... -v
- name: Test with Coverage
run: go test ./... -coverprofile=coverage.txt -covermode=atomic

- name: Check Coverage
run: |
go tool cover -func=coverage.txt -o coverage-summary.txt
COVERAGE=$(go tool cover -func=coverage.txt | grep total: | awk '{print substr($3, 1, length($3)-1)}')
echo "Total test coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < 70" |bc -l) )); then
echo "Test coverage is below 70%"
exit 1
fi
env:
GO111MODULE: on

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

The `httpclient-call-go` library simplifies making HTTP calls to various API services efficiently and straightforwardly. It is designed to seamlessly integrate into any Go project requiring HTTP API interactions.

![Actions](https://github.com/pzentenoe/httpclient-call-go/actions/workflows/actions.yml/badge.svg)
![Build](https://github.com/pzentenoe/httpclient-call-go/actions/workflows/actions.yml/badge.svg)

### Buy Me a Coffee

Expand Down

0 comments on commit b23d171

Please sign in to comment.