Skip to content

Commit

Permalink
Add coverage target to make (#58)
Browse files Browse the repository at this point in the history
Co-authored-by: amanjpro <[email protected]>
  • Loading branch information
amanjpro and amanjpro authored Dec 12, 2024
1 parent 63ca840 commit d6458bc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: pre-commit install
- name: Run all pre-commit hooks
run: SKIP=golangci-lint pre-commit run --all-files
build:
test:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
Expand Down Expand Up @@ -65,7 +65,13 @@ jobs:
- name: Run go tests
env:
STORAGE_EMULATOR_HOST: http://0.0.0.0:4443
run: go test ./...
run: go test ./... -coverprofile=./cover.out -covermode=atomic
- name: check test coverage
uses: vladopajic/go-test-coverage@v2
with:
profile: ./cover.out
local-prefix: "github.com/Optable/optable-pair-cli"
threshold-total: 70
- name: Cleanup
if: always()
run: docker stop fake-gcs-server && docker rm fake-gcs-server
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,8 @@ clean-fake-gcs-server:
.PHONY: test
test: start-fake-gcs-server
STORAGE_EMULATOR_HOST=$(STORAGE_EMULATOR_HOST) $(GO) test -v ./...

.PHONY: coverage
coverage: start-fake-gcs-server
STORAGE_EMULATOR_HOST=$(STORAGE_EMULATOR_HOST) $(GO) test -coverprofile coverage.out ./...
$(GO) tool cover -html=coverage.out
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ require (
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
golang.org/x/tools/cmd/cover v0.1.0-deprecated // indirect
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
google.golang.org/genproto v0.0.0-20240812133136-8ffd90a71988 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools/cmd/cover v0.1.0-deprecated h1:Rwy+mWYz6loAF+LnG1jHG/JWMHRMMC2/1XX3Ejkx9lA=
golang.org/x/tools/cmd/cover v0.1.0-deprecated/go.mod h1:hMDiIvlpN1NoVgmjLjUJE9tMHyxHjFX7RuQ+rW12mSA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 h1:LLhsEBxRTBLuKlQxFBYUOU8xyFgXv6cOTp2HASDlsDk=
Expand Down

0 comments on commit d6458bc

Please sign in to comment.