0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00
zot/Makefile.bazel

64 lines
1.4 KiB
Text
Raw Permalink Normal View History

2019-06-20 18:36:40 -05:00
OS := $(shell uname -s | tr A-Z a-z)
BINARY_PREFIX_DIRECTORY := $(OS)_amd64_stripped
2019-06-26 13:57:21 -05:00
BAZEL=$(HOME)/bin/bazel
BAZELOPTS= --repository_cache="$$HOME/.bzrepos" \
--test_output=errors \
--noshow_progress \
--noshow_loading_progress
2019-06-20 18:36:40 -05:00
.PHONY: all
all: build check
.PHONY: info
.SILENT: info
info:
2019-06-26 13:57:21 -05:00
${BAZEL} build @io_bazel_rules_go//:go_info
2019-06-20 18:36:40 -05:00
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:
2019-06-26 13:57:21 -05:00
${BAZEL} run //:buildozer
${BAZEL} run //:buildifier
2019-06-20 18:36:40 -05:00
.PHONY: update-bazel
update-bazel:
2019-06-26 13:57:21 -05:00
${BAZEL} run //:gazelle
${BAZEL} run //:gazelle -- update-repos -from_file=go.mod
2019-06-20 18:36:40 -05:00
.PHONY: init
init: setup-base update-bazel fmt-bazel
.PHONY: build
build:
${BAZEL} build ${BAZELOPTS} //...
${BAZEL} test ${BAZELOPTS} //...
2019-06-20 18:36:40 -05:00
.PHONY: check
check:
2019-06-26 13:57:21 -05:00
${BAZEL} run //:golangcilint
2019-06-20 18:36:40 -05:00
.PHONY: bench
.SILENT: bench
bench:
2019-06-26 13:57:21 -05:00
for i in $$(${BAZEL} query 'tests(//...)'); do \
${BAZEL} run $$i -- -test.bench=.; \
2019-06-20 18:36:40 -05:00
done
.PHONY: coverage
.SILENT: coverage
coverage:
2019-06-26 13:57:21 -05:00
${BAZEL} coverage //...
2019-06-20 18:36:40 -05:00
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:
2019-06-26 13:57:21 -05:00
${BAZEL} clean