Browse Source

Makefile and linter

pull/1842/head
Ethan Buchman 7 years ago
parent
commit
57fea1335a
3 changed files with 15 additions and 11 deletions
  1. +9
    -8
      Makefile
  2. +1
    -1
      circle.yml
  3. +5
    -2
      test.sh

+ 9
- 8
Makefile View File

@ -4,14 +4,16 @@ GOTOOLS = \
github.com/Masterminds/glide \
github.com/alecthomas/gometalinter
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
REPO:=github.com/tendermint/tmlibs
all: test
NOVENDOR = go list github.com/tendermint/tmlibs/... | grep -v /vendor/
test:
go test `glide novendor`
@echo "--> Running linter"
@make metalinter_test
@echo "--> Running go test"
@go test $(PACKAGES)
get_vendor_deps: ensure_tools
@rm -rf vendor/
@ -20,16 +22,14 @@ get_vendor_deps: ensure_tools
ensure_tools:
go get $(GOTOOLS)
metalinter: ensure_tools
@gometalinter --install
metalinter:
gometalinter --vendor --deadline=600s --enable-all --disable=lll ./...
metalinter_test: ensure_tools
@gometalinter --install
metalinter_test:
gometalinter --vendor --deadline=600s --disable-all \
--enable=deadcode \
--enable=gas \
--enable=goconst \
--enable=gosimple \
--enable=ineffassign \
@ -46,6 +46,7 @@ metalinter_test: ensure_tools
--enable=vet \
./...
#--enable=gas \
#--enable=aligncheck \
#--enable=dupl \
#--enable=errcheck \


+ 1
- 1
circle.yml View File

@ -15,7 +15,7 @@ dependencies:
test:
override:
- cd $PROJECT_PATH && make get_vendor_deps && make metalinter_test && bash ./test.sh
- cd $PROJECT_PATH && make get_vendor_deps && bash ./test.sh
post:
- cd "$PROJECT_PATH" && bash <(curl -s https://codecov.io/bash) -f coverage.txt
- cd "$PROJECT_PATH" && mv coverage.txt "${CIRCLE_ARTIFACTS}"

+ 5
- 2
test.sh View File

@ -1,8 +1,11 @@
#!/usr/bin/env bash
set -e
echo "" > coverage.txt
# run the linter
make metalinter_test
# run the unit tests with coverage
echo "" > coverage.txt
for d in $(go list ./... | grep -v vendor); do
go test -race -coverprofile=profile.out -covermode=atomic "$d"
if [ -f profile.out ]; then


Loading…
Cancel
Save