Skip to content

Commit

Permalink
remove makes
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsk committed Feb 15, 2019
1 parent 9b8be73 commit 4e9c251
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 754 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# go test and code quality report
*.out

# legacy
go.mod
go.sum
69 changes: 54 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,59 @@
OPEN_BROWSER =
SUPPORTED_VERSIONS = 1.5 1.6 1.7 1.8 1.9 1.10 latest
PACKAGES := go list ./... | grep -v vendor | grep -v ^_
SHELL ?= /bin/bash -euo pipefail


include makes/env.mk
include makes/docker.mk
include makes/local.mk
include cmd/retry/Makefile
.PHONY: test
test: #| Runs tests with race.
#| Accepts: ARGS.
#| Uses: PACKAGES.
$(PACKAGES) | xargs go test -race $(strip $(ARGS))

.PHONY: test-check
test-check: #| Fast runs tests to check their compilation errors.
#| Accepts: ARGS.
#| Uses: PACKAGES.
$(PACKAGES) | xargs go test -run=^hack $(strip $(ARGS))

.PHONY: code-quality-check
code-quality-check: ARGS = \
--exclude=".*_test\.go:.*error return value not checked.*\(errcheck\)$$" \
--exclude="duplicate of.*_test.go.*\(dupl\)$$" \
--vendor --deadline=1m ./... | sort
code-quality-check: docker-tool-gometalinter
.PHONY: test-with-coverage
test-with-coverage: #| Runs tests with coverage.
#| Accepts: ARGS.
#| Uses: PACKAGES.
$(PACKAGES) | xargs go test -cover $(strip $(ARGS))

.PHONY: code-quality-report
code-quality-report:
time make code-quality-check | tail +7 | tee report.out
.PHONY: test-with-coverage-formatted
test-with-coverage-formatted: #| Runs tests with coverage and formats the result.
#| Accepts: ARGS.
#| Uses: PACKAGES.
$(PACKAGES) | xargs go test -cover $(strip $(ARGS)) | column -t | sort -r

.PHONY: test-with-coverage-profile
test-with-coverage-profile: #| Runs tests with coverage and collects the result.
#| Accepts: ARGS, OPEN_BROWSER.
#| Uses: GO_TEST_COVERAGE_MODE, GO_TEST_COVERAGE_FILENAME, PACKAGES.
echo 'mode: ${GO_TEST_COVERAGE_MODE}' > '${GO_TEST_COVERAGE_FILENAME}'
for package in $$($(PACKAGES)); do \
go test -covermode '${GO_TEST_COVERAGE_MODE}' \
-coverprofile "coverage_$${package##*/}.out" \
$(strip $(ARGS)) "$${package}"; \
if [ -f "coverage_$${package##*/}.out" ]; then \
sed '1d' "coverage_$${package##*/}.out" >> '${GO_TEST_COVERAGE_FILENAME}'; \
rm "coverage_$${package##*/}.out"; \
fi \
done

.PHONY: test-example
test-example: GO_TEST_COVERAGE_FILENAME = coverage_example.out
test-example: #| Runs example tests with coverage and collects the result.
#| Accepts: ARGS, OPEN_BROWSER.
#| Uses: GO_TEST_COVERAGE_MODE, GO_TEST_COVERAGE_FILENAME, PACKAGES.
echo 'mode: ${GO_TEST_COVERAGE_MODE}' > '${GO_TEST_COVERAGE_FILENAME}'
for package in $$($(PACKAGES)); do \
go test -v -run=Example \
-covermode '${GO_TEST_COVERAGE_MODE}' \
-coverprofile "coverage_example_$${package##*/}.out" \
$(strip $(ARGS)) "$${package}"; \
if [ -f "coverage_$${package##*/}.out" ]; then \
sed '1d' "coverage_example_$${package##*/}.out" >> '${GO_TEST_COVERAGE_FILENAME}'; \
rm "coverage_example_$${package##*/}.out"; \
fi \
done
54 changes: 0 additions & 54 deletions cmd/retry/Makefile

This file was deleted.

32 changes: 0 additions & 32 deletions makes/README.md

This file was deleted.

25 changes: 0 additions & 25 deletions makes/docker.mk

This file was deleted.

68 changes: 0 additions & 68 deletions makes/docker/alpine.mk

This file was deleted.

Loading

0 comments on commit 4e9c251

Please sign in to comment.