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

Merge pull request #6 from rchincha/master

build: fix travis CI
This commit is contained in:
Ravi Chamarthy 2019-06-26 14:09:23 -07:00 committed by GitHub
commit a975cb0428
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 14 deletions

View file

@ -1,5 +1,11 @@
language: go
go:
- 1.12.x
env:
- GO111MODULE=on
matrix:
include:
- os: linux
@ -8,7 +14,7 @@ notifications:
email: false
install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget -N https://github.com/bazelbuild/bazel/releases/download/0.26.1/bazel-0.26.1-installer-linux-x86_64.sh && chmod +x bazel-0.26.1-installer-linux-x86_64.sh && ./bazel-0.26.1-installer-linux-x86_64.sh --user; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget -N https://github.com/bazelbuild/bazel/releases/download/0.26.1/bazel-0.26.1-installer-linux-x86_64.sh && chmod +x bazel-0.26.1-installer-linux-x86_64.sh && ./bazel-0.26.1-installer-linux-x86_64.sh --user; go get -u github.com/swaggo/swag/cmd/swag; go mod download; fi
script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; make && make -f Makefile.bazel build; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make && make -f Makefile.bazel build; fi

View file

@ -1,5 +1,6 @@
OS := $(shell uname -s | tr A-Z a-z)
BINARY_PREFIX_DIRECTORY := $(OS)_amd64_stripped
BAZEL=$(HOME)/bin/bazel
.PHONY: all
all: build check
@ -7,7 +8,7 @@ all: build check
.PHONY: info
.SILENT: info
info:
bazel build @io_bazel_rules_go//:go_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
@ -17,37 +18,37 @@ setup-base:
.PHONY: fmt-bazel
fmt-bazel:
bazel run //:buildozer
bazel run //:buildifier
${BAZEL} run //:buildozer
${BAZEL} run //:buildifier
.PHONY: update-bazel
update-bazel:
bazel run //:gazelle
bazel run //:gazelle -- update-repos -from_file=go.mod
${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 //...
${BAZEL} build //...
${BAZEL} test //...
.PHONY: check
check:
bazel run //:golangcilint
${BAZEL} run //:golangcilint
.PHONY: bench
.SILENT: bench
bench:
for i in $$(bazel query 'tests(//...)'); do \
bazel run $$i -- -test.bench=.; \
for i in $$(${BAZEL} query 'tests(//...)'); do \
${BAZEL} run $$i -- -test.bench=.; \
done
.PHONY: coverage
.SILENT: coverage
coverage:
bazel 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]*//'; \
@ -55,4 +56,4 @@ coverage:
.PHONY: clean
clean:
bazel clean
${BAZEL} clean