mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
commit
616f7e74db
101
Makefile
101
Makefile
@ -1,18 +1,21 @@
|
|||||||
GOTOOLS = \
|
GOTOOLS = \
|
||||||
github.com/mitchellh/gox \
|
github.com/mitchellh/gox \
|
||||||
github.com/tcnksm/ghr \
|
github.com/Masterminds/glide \
|
||||||
gopkg.in/alecthomas/gometalinter.v2
|
github.com/tcnksm/ghr \
|
||||||
|
gopkg.in/alecthomas/gometalinter.v2
|
||||||
|
GOTOOLS_CHECK = gox glide ghr gometalinter.v2
|
||||||
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
|
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
|
||||||
BUILD_TAGS?=tendermint
|
BUILD_TAGS?=tendermint
|
||||||
TMHOME = $${TMHOME:-$$HOME/.tendermint}
|
TMHOME = $${TMHOME:-$$HOME/.tendermint}
|
||||||
|
|
||||||
BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short HEAD`"
|
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:
|
check: check_tools get_vendor_deps
|
||||||
go install $(BUILD_FLAGS) ./cmd/tendermint
|
|
||||||
|
|
||||||
|
########################################
|
||||||
|
### Build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build $(BUILD_FLAGS) -o build/tendermint ./cmd/tendermint/
|
go build $(BUILD_FLAGS) -o build/tendermint ./cmd/tendermint/
|
||||||
@ -24,9 +27,42 @@ build_race:
|
|||||||
dist:
|
dist:
|
||||||
@BUILD_TAGS='$(BUILD_TAGS)' sh -c "'$(CURDIR)/scripts/dist.sh'"
|
@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:
|
test:
|
||||||
@echo "--> Running linter"
|
|
||||||
@make metalinter_test
|
|
||||||
@echo "--> Running go test"
|
@echo "--> Running go test"
|
||||||
@go test $(PACKAGES)
|
@go test $(PACKAGES)
|
||||||
|
|
||||||
@ -49,46 +85,21 @@ vagrant_test:
|
|||||||
vagrant ssh -c 'make test_race'
|
vagrant ssh -c 'make test_race'
|
||||||
vagrant ssh -c 'make test_integrations'
|
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
|
### Formatting, linting, and vetting
|
||||||
|
|
||||||
metalinter:
|
fmt:
|
||||||
gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
|
@go fmt ./...
|
||||||
|
|
||||||
metalinter_test:
|
metalinter:
|
||||||
|
@echo "--> Running linter"
|
||||||
gometalinter.v2 --vendor --deadline=600s --disable-all \
|
gometalinter.v2 --vendor --deadline=600s --disable-all \
|
||||||
--enable=deadcode \
|
--enable=deadcode \
|
||||||
--enable=gosimple \
|
--enable=gosimple \
|
||||||
--enable=misspell \
|
--enable=misspell \
|
||||||
--enable=safesql \
|
--enable=safesql \
|
||||||
./...
|
./...
|
||||||
|
|
||||||
#--enable=gas \
|
#--enable=gas \
|
||||||
#--enable=maligned \
|
#--enable=maligned \
|
||||||
#--enable=dupl \
|
#--enable=dupl \
|
||||||
@ -110,4 +121,12 @@ metalinter_test:
|
|||||||
#--enable=vet \
|
#--enable=vet \
|
||||||
#--enable=vetshadow \
|
#--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
|
||||||
|
2
glide.lock
generated
2
glide.lock
generated
@ -131,7 +131,7 @@ imports:
|
|||||||
subpackages:
|
subpackages:
|
||||||
- iavl
|
- iavl
|
||||||
- name: github.com/tendermint/tmlibs
|
- name: github.com/tendermint/tmlibs
|
||||||
version: e236218516289f91bde3273e99fe5c1fc20eb304
|
version: 662a886dc20600ce11e1d684a15b83b5813e7277
|
||||||
subpackages:
|
subpackages:
|
||||||
- autofile
|
- autofile
|
||||||
- cli
|
- cli
|
||||||
|
@ -314,11 +314,11 @@ FOR_LOOP:
|
|||||||
// NOTE: flushTimer.Set() must be called every time
|
// NOTE: flushTimer.Set() must be called every time
|
||||||
// something is written to .bufWriter.
|
// something is written to .bufWriter.
|
||||||
c.flush()
|
c.flush()
|
||||||
case <-c.chStatsTimer.Ch:
|
case <-c.chStatsTimer.Chan():
|
||||||
for _, channel := range c.channels {
|
for _, channel := range c.channels {
|
||||||
channel.updateStats()
|
channel.updateStats()
|
||||||
}
|
}
|
||||||
case <-c.pingTimer.Ch:
|
case <-c.pingTimer.Chan():
|
||||||
c.Logger.Debug("Send Ping")
|
c.Logger.Debug("Send Ping")
|
||||||
legacy.WriteOctet(packetTypePing, c.bufWriter, &n, &err)
|
legacy.WriteOctet(packetTypePing, c.bufWriter, &n, &err)
|
||||||
c.sendMonitor.Update(int(n))
|
c.sendMonitor.Update(int(n))
|
||||||
|
@ -17,7 +17,7 @@ WORKDIR $REPO
|
|||||||
ADD glide.yaml glide.yaml
|
ADD glide.yaml glide.yaml
|
||||||
ADD glide.lock glide.lock
|
ADD glide.lock glide.lock
|
||||||
ADD Makefile Makefile
|
ADD Makefile Makefile
|
||||||
RUN make tools
|
RUN make get_tools
|
||||||
RUN make get_vendor_deps
|
RUN make get_vendor_deps
|
||||||
|
|
||||||
# Install the apps
|
# Install the apps
|
||||||
|
@ -7,8 +7,7 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|||||||
echo "Current branch: $BRANCH"
|
echo "Current branch: $BRANCH"
|
||||||
|
|
||||||
# run the linter
|
# run the linter
|
||||||
# TODO: drop the `_test` once we're ballin' enough
|
make metalinter
|
||||||
make metalinter_test
|
|
||||||
|
|
||||||
# run the go unit tests with coverage
|
# run the go unit tests with coverage
|
||||||
bash test/test_cover.sh
|
bash test/test_cover.sh
|
||||||
@ -20,8 +19,8 @@ bash test/app/test.sh
|
|||||||
bash test/persist/test.sh
|
bash test/persist/test.sh
|
||||||
|
|
||||||
if [[ "$BRANCH" == "master" || $(echo "$BRANCH" | grep "release-") != "" ]]; then
|
if [[ "$BRANCH" == "master" || $(echo "$BRANCH" | grep "release-") != "" ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "* branch $BRANCH; testing libs"
|
echo "* branch $BRANCH; testing libs"
|
||||||
# checkout every github.com/tendermint dir and run its tests
|
# checkout every github.com/tendermint dir and run its tests
|
||||||
bash test/test_libs.sh
|
bash test/test_libs.sh
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user