chore: Add codecov (#276)
* Add test-cover target * Add test-cover and codecov upload
This commit is contained in:
parent
db58154795
commit
56eeeb3ea2
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
@ -35,6 +35,15 @@ jobs:
|
||||
run: |
|
||||
go work init
|
||||
make test
|
||||
- name: Test Coverage
|
||||
run: |
|
||||
make test-cover
|
||||
- name: Upload coverage reports to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
with:
|
||||
files: cover.out
|
||||
|
||||
test-integration:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
10
Makefile
10
Makefile
@ -9,6 +9,7 @@ BUILD_DIR ?= $(CURDIR)/build
|
||||
PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git)
|
||||
HTTPS_GIT := https://github.com/skip-mev/block-sdk.git
|
||||
DOCKER := $(shell which docker)
|
||||
COVER_FILE ?= "cover.out"
|
||||
|
||||
###############################################################################
|
||||
### Test App ###
|
||||
@ -128,6 +129,15 @@ test-integration: $(TEST_INTEGRATION_DEPS)
|
||||
test: use-main
|
||||
@go test -v -race $(shell go list ./... | grep -v tests/)
|
||||
|
||||
test-cover: tidy
|
||||
@echo Running unit tests and creating coverage report...
|
||||
@go test -mod=readonly -v -timeout 30m -coverprofile=$(COVER_FILE) -covermode=atomic $(shell go list ./... | grep -v tests/)
|
||||
@sed -i '/.pb.go/d' $(COVER_FILE)
|
||||
@sed -i '/.pulsar.go/d' $(COVER_FILE)
|
||||
@sed -i '/.proto/d' $(COVER_FILE)
|
||||
@sed -i '/.pb.gw.go/d' $(COVER_FILE)
|
||||
|
||||
|
||||
.PHONY: test test-integration
|
||||
|
||||
###############################################################################
|
||||
|
||||
Loading…
Reference in New Issue
Block a user