Browse Source

Merge pull request #1001 from tendermint/makefile

Cleaned up makefile
pull/1011/head
Ethan Buchman 7 years ago
committed by GitHub
parent
commit
616f7e74db
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 51 deletions
  1. +60
    -41
      Makefile
  2. +1
    -1
      glide.lock
  3. +2
    -2
      p2p/connection.go
  4. +1
    -1
      test/docker/Dockerfile
  5. +5
    -6
      test/run_test.sh

+ 60
- 41
Makefile View File

@ -1,18 +1,21 @@
GOTOOLS = \
github.com/mitchellh/gox \
github.com/tcnksm/ghr \
gopkg.in/alecthomas/gometalinter.v2
github.com/mitchellh/gox \
github.com/Masterminds/glide \
github.com/tcnksm/ghr \
gopkg.in/alecthomas/gometalinter.v2
GOTOOLS_CHECK = gox glide ghr gometalinter.v2
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
BUILD_TAGS?=tendermint
TMHOME = $${TMHOME:-$$HOME/.tendermint}
BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short HEAD`"
all: get_vendor_deps install test
all: check build test install metalinter
install:
go install $(BUILD_FLAGS) ./cmd/tendermint
check: check_tools get_vendor_deps
########################################
### Build
build:
go build $(BUILD_FLAGS) -o build/tendermint ./cmd/tendermint/
@ -24,9 +27,42 @@ build_race:
dist:
@BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/dist.sh'"
install:
go install $(BUILD_FLAGS) ./cmd/tendermint
########################################
### Tools & dependencies
check_tools:
@# https://stackoverflow.com/a/25668869
@echo "Found tools: $(foreach tool,$(GOTOOLS_CHECK),\
$(if $(shell which $(tool)),$(tool),$(error "No $(tool) in PATH")))"
get_tools:
@echo "--> Installing tools"
go get -u -v $(GOTOOLS)
@gometalinter.v2 --install
update_tools:
@echo "--> Updating tools"
@go get -u $(GOTOOLS)
get_vendor_deps:
@rm -rf vendor/
@echo "--> Running glide install"
@glide install
draw_deps:
@# requires brew install graphviz or apt-get install graphviz
go get github.com/RobotsAndPencils/goviz
@goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
########################################
### Testing
test:
@echo "--> Running linter"
@make metalinter_test
@echo "--> Running go test"
@go test $(PACKAGES)
@ -49,46 +85,21 @@ vagrant_test:
vagrant ssh -c 'make test_race'
vagrant ssh -c 'make test_integrations'
draw_deps:
# requires brew install graphviz or apt-get install graphviz
go get github.com/RobotsAndPencils/goviz
@goviz -i github.com/tendermint/tendermint/cmd/tendermint -d 3 | dot -Tpng -o dependency-graph.png
get_vendor_deps:
@hash glide 2>/dev/null || go get github.com/Masterminds/glide
@rm -rf vendor/
@echo "--> Running glide install"
@glide install
@make check_tools
update_vendor_deps:
@glide update
update_tools:
@echo "--> Updating tools"
@go get -u $(GOTOOLS)
check_tools:
which gox || make tools
tools:
@echo "--> Installing tools"
@go get $(GOTOOLS)
@gometalinter.v2 --install
########################################
### Formatting, linting, and vetting
metalinter:
gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
fmt:
@go fmt ./...
metalinter_test:
metalinter:
@echo "--> Running linter"
gometalinter.v2 --vendor --deadline=600s --disable-all \
--enable=deadcode \
--enable=gosimple \
--enable=misspell \
--enable=safesql \
./...
#--enable=gas \
#--enable=maligned \
#--enable=dupl \
@ -110,4 +121,12 @@ metalinter_test:
#--enable=vet \
#--enable=vetshadow \
.PHONY: install build build_race check_tools dist test test_race test_integrations test100 draw_deps get_vendor_deps update_vendor_deps update_tools tools test_release
metalinter_all:
@echo "--> Running linter (all)"
gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
# To avoid unintended conflicts with file names, always add to .PHONY
# unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: check build build_race dist install check_tools get_tools update_tools get_vendor_deps draw_deps test test_race test_integrations test_release test100 vagrant_test fmt metalinter metalinter_all

+ 1
- 1
glide.lock View File

@ -131,7 +131,7 @@ imports:
subpackages:
- iavl
- name: github.com/tendermint/tmlibs
version: e236218516289f91bde3273e99fe5c1fc20eb304
version: 662a886dc20600ce11e1d684a15b83b5813e7277
subpackages:
- autofile
- cli


+ 2
- 2
p2p/connection.go View File

@ -314,11 +314,11 @@ FOR_LOOP:
// NOTE: flushTimer.Set() must be called every time
// something is written to .bufWriter.
c.flush()
case <-c.chStatsTimer.Ch:
case <-c.chStatsTimer.Chan():
for _, channel := range c.channels {
channel.updateStats()
}
case <-c.pingTimer.Ch:
case <-c.pingTimer.Chan():
c.Logger.Debug("Send Ping")
legacy.WriteOctet(packetTypePing, c.bufWriter, &n, &err)
c.sendMonitor.Update(int(n))


+ 1
- 1
test/docker/Dockerfile View File

@ -17,7 +17,7 @@ WORKDIR $REPO
ADD glide.yaml glide.yaml
ADD glide.lock glide.lock
ADD Makefile Makefile
RUN make tools
RUN make get_tools
RUN make get_vendor_deps
# Install the apps


+ 5
- 6
test/run_test.sh View File

@ -7,8 +7,7 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "Current branch: $BRANCH"
# run the linter
# TODO: drop the `_test` once we're ballin' enough
make metalinter_test
make metalinter
# run the go unit tests with coverage
bash test/test_cover.sh
@ -20,8 +19,8 @@ bash test/app/test.sh
bash test/persist/test.sh
if [[ "$BRANCH" == "master" || $(echo "$BRANCH" | grep "release-") != "" ]]; then
echo ""
echo "* branch $BRANCH; testing libs"
# checkout every github.com/tendermint dir and run its tests
bash test/test_libs.sh
echo ""
echo "* branch $BRANCH; testing libs"
# checkout every github.com/tendermint dir and run its tests
bash test/test_libs.sh
fi

Loading…
Cancel
Save