mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-18 22:23:07 -03:00
Added test-coverage
This commit is contained in:
committed by
Santiago M. Mola
parent
7e827e47ef
commit
ded3e2c4ae
@ -16,7 +16,7 @@ install:
|
|||||||
- go get -v -t ./...
|
- go get -v -t ./...
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- make test
|
- make test-coverage
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
|
17
Makefile
17
Makefile
@ -1,3 +1,7 @@
|
|||||||
|
COVERAGE_REPORT := coverage.txt
|
||||||
|
COVERAGE_PROFILE := profile.out
|
||||||
|
COVERAGE_MODE := atomic
|
||||||
|
|
||||||
LINGUIST_PATH = .linguist
|
LINGUIST_PATH = .linguist
|
||||||
|
|
||||||
$(LINGUIST_PATH):
|
$(LINGUIST_PATH):
|
||||||
@ -6,6 +10,19 @@ $(LINGUIST_PATH):
|
|||||||
test: $(LINGUIST_PATH)
|
test: $(LINGUIST_PATH)
|
||||||
go test -v ./...
|
go test -v ./...
|
||||||
|
|
||||||
|
test-coverage: $(LINGUIST_PATH)
|
||||||
|
@echo "mode: $(COVERAGE_MODE)" > $(COVERAGE_REPORT); \
|
||||||
|
for dir in `find . -name "*.go" | grep -o '.*/' | sort -u | grep -v './fixtures/' | grep -v './.linguist/'`; do \
|
||||||
|
go test $$dir -coverprofile=$(COVERAGE_PROFILE) -covermode=$(COVERAGE_MODE); \
|
||||||
|
if [ $$? != 0 ]; then \
|
||||||
|
exit 2; \
|
||||||
|
fi; \
|
||||||
|
if [ -f $(COVERAGE_PROFILE) ]; then \
|
||||||
|
tail -n +2 $(COVERAGE_PROFILE) >> $(COVERAGE_REPORT); \
|
||||||
|
rm $(COVERAGE_PROFILE); \
|
||||||
|
fi; \
|
||||||
|
done;
|
||||||
|
|
||||||
code-generate: $(LINGUIST_PATH)
|
code-generate: $(LINGUIST_PATH)
|
||||||
mkdir -p data
|
mkdir -p data
|
||||||
go run internal/code-generator/main.go
|
go run internal/code-generator/main.go
|
||||||
|
Reference in New Issue
Block a user