mirror of
https://github.com/project-zot/zot.git
synced 2024-12-30 22:34:13 -05:00
59 lines
1.2 KiB
Text
59 lines
1.2 KiB
Text
|
OS := $(shell uname -s | tr A-Z a-z)
|
||
|
BINARY_PREFIX_DIRECTORY := $(OS)_amd64_stripped
|
||
|
|
||
|
.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
|
||
|
bazel run //:gazelle -- update-repos -from_file=go.mod
|
||
|
|
||
|
.PHONY: init
|
||
|
init: setup-base update-bazel fmt-bazel
|
||
|
|
||
|
.PHONY: build
|
||
|
build:
|
||
|
bazel build //...
|
||
|
bazel test //...
|
||
|
|
||
|
.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
|