zot-wo-auth/Makefile.bazel
Ramkumar Chinchani 68a1784c17 docs: fix Makefile
2019-08-29 10:56:59 -07:00

67 lines
1.4 KiB
Makefile

OS := $(shell uname -s | tr A-Z a-z)
BINARY_PREFIX_DIRECTORY := $(OS)_amd64_stripped
BAZEL=$(HOME)/bin/bazel
BAZELOPTS= --repository_cache="$$HOME/.bzrepos" \
--test_output=errors \
--noshow_progress \
--noshow_loading_progress
.PHONY: all
all: build check
.PHONY: info
.SILENT: info
info:
${BAZEL} build @io_bazel_rules_go//:go_info
cat bazel-bin/external/io_bazel_rules_go/linux_amd64_stripped/go_info%/go_info_report
.PHONY: setup-base
setup-base:
swag -v || go get -u github.com/swaggo/swag/cmd/swag
swag init -g pkg/api/routes.go
.PHONY: fmt-bazel
fmt-bazel:
${BAZEL} run //:buildozer
${BAZEL} run //:buildifier
.PHONY: update-bazel
update-bazel:
${BAZEL} run //:gazelle
.PHONY: update-mod
update-mod:
${BAZEL} run //:gazelle -- update-repos -from_file=go.mod
.PHONY: init
init: setup-base update-bazel fmt-bazel
.PHONY: build
build:
${BAZEL} build ${BAZELOPTS} //...
${BAZEL} test ${BAZELOPTS} //...
.PHONY: check
check:
${BAZEL} run //:golangcilint
.PHONY: bench
.SILENT: bench
bench:
for i in $$(${BAZEL} query 'tests(//...)'); do \
${BAZEL} run $$i -- -test.bench=.; \
done
.PHONY: coverage
.SILENT: coverage
coverage:
${BAZEL} coverage //...
for c in $$(find ./bazel-out/ -name 'coverage.dat'); do \
go tool cover --html=$$c -o /tmp/cover.html; \
cat /tmp/cover.html | grep 'option value="file' | sed 's/<[^>]*>//g' | sed 's/^[ \t]*//'; \
done
.PHONY: clean
clean:
${BAZEL} clean