Skip to content

Commit

Permalink
Clean up makefile and try codecov upload with glob
Browse files Browse the repository at this point in the history
  • Loading branch information
djaglowski committed Sep 1, 2020
1 parent e0a3134 commit 0cd0842
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
name: Run Unit Tests
command: make test
- codecov/upload:
file: ./coverage.txt
file: '**/coverage.txt'

test-macos:
executor: mac
Expand Down
30 changes: 11 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,17 @@ install-tools:
go install github.com/vektra/mockery/cmd/mockery

.PHONY: test
test: clean test-all

.PHONY: test-all
test-all:
mkdir -p $(ARTIFACTS)
touch $(ARTIFACTS)/coverage.all
@set -e; for dir in $(ALL_MODULES); do \
(cd "$${dir}" && \
go test -race -coverprofile coverage.txt -coverpkg ./... ./...); \
cat "$${dir}"/coverage.txt >> $(ARTIFACTS)/coverage.all; \
done
cat $(ARTIFACTS)/coverage.all | uniq -u > $(ARTIFACTS)/coverage.txt
test:
$(MAKE) for-all CMD="go test -race -coverprofile coverage.txt -coverpkg ./... ./..."

.PHONY: bench
bench:
@set -e; for dir in $(ALL_MODULES); do \
(cd "$${dir}" && go test -run=NONE -bench '.*' ./... -benchmem); \
done
$(MAKE) for-all CMD="go test -run=NONE -bench '.*' ./... -benchmem"

.PHONY: clean
clean:
rm -fr ./artifacts
@set -e; for dir in $(ALL_MODULES); do \
(cd "$${dir}" && rm -f coverage.txt coverage.html); \
done
$(MAKE) for-all CMD="rm -f coverage.txt coverage.html"

.PHONY: listmod
listmod:
Expand Down Expand Up @@ -83,4 +69,10 @@ build-linux-amd64:
.PHONY: build-windows-amd64
build-windows-amd64:
@GOOS=windows GOARCH=amd64 $(MAKE) build


.PHONY: for-all
for-all:
@$${CMD}
@set -e; for dir in $(ALL_MODULES); do \
(cd "$${dir}" && $${CMD} ); \
done

0 comments on commit 0cd0842

Please sign in to comment.