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 language: go
go:
- 1.12.x
env:
- GO111MODULE=on
matrix: matrix:
include: include:
- os: linux - os: linux
@ -8,7 +14,7 @@ notifications:
email: false email: false
install: 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: 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) OS := $(shell uname -s | tr A-Z a-z)
BINARY_PREFIX_DIRECTORY := $(OS)_amd64_stripped BINARY_PREFIX_DIRECTORY := $(OS)_amd64_stripped
BAZEL=$(HOME)/bin/bazel
.PHONY: all .PHONY: all
all: build check all: build check
@ -7,7 +8,7 @@ all: build check
.PHONY: info .PHONY: info
.SILENT: info .SILENT: info
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 cat bazel-bin/external/io_bazel_rules_go/linux_amd64_stripped/go_info%/go_info_report
.PHONY: setup-base .PHONY: setup-base
@ -17,37 +18,37 @@ setup-base:
.PHONY: fmt-bazel .PHONY: fmt-bazel
fmt-bazel: fmt-bazel:
bazel run //:buildozer ${BAZEL} run //:buildozer
bazel run //:buildifier ${BAZEL} run //:buildifier
.PHONY: update-bazel .PHONY: update-bazel
update-bazel: update-bazel:
bazel run //:gazelle ${BAZEL} run //:gazelle
bazel run //:gazelle -- update-repos -from_file=go.mod ${BAZEL} run //:gazelle -- update-repos -from_file=go.mod
.PHONY: init .PHONY: init
init: setup-base update-bazel fmt-bazel init: setup-base update-bazel fmt-bazel
.PHONY: build .PHONY: build
build: build:
bazel build //... ${BAZEL} build //...
bazel test //... ${BAZEL} test //...
.PHONY: check .PHONY: check
check: check:
bazel run //:golangcilint ${BAZEL} run //:golangcilint
.PHONY: bench .PHONY: bench
.SILENT: bench .SILENT: bench
bench: bench:
for i in $$(bazel query 'tests(//...)'); do \ for i in $$(${BAZEL} query 'tests(//...)'); do \
bazel run $$i -- -test.bench=.; \ ${BAZEL} run $$i -- -test.bench=.; \
done done
.PHONY: coverage .PHONY: coverage
.SILENT: coverage .SILENT: coverage
coverage: coverage:
bazel coverage //... ${BAZEL} coverage //...
for c in $$(find ./bazel-out/ -name 'coverage.dat'); do \ for c in $$(find ./bazel-out/ -name 'coverage.dat'); do \
go tool cover --html=$$c -o /tmp/cover.html; \ go tool cover --html=$$c -o /tmp/cover.html; \
cat /tmp/cover.html | grep 'option value="file' | sed 's/<[^>]*>//g' | sed 's/^[ \t]*//'; \ cat /tmp/cover.html | grep 'option value="file' | sed 's/<[^>]*>//g' | sed 's/^[ \t]*//'; \
@ -55,4 +56,4 @@ coverage:
.PHONY: clean .PHONY: clean
clean: clean:
bazel clean ${BAZEL} clean