Compare commits

...

3 Commits

Author SHA1 Message Date
Marko Baricevic
85f2e0bb14 remove slate 2019-09-04 23:03:34 +02:00
Marko Baricevic
1d7cdd6c76 .phony 2019-09-04 17:43:56 +02:00
Marko Baricevic
57523ce1b7 Update makefile
- these two files were taken from the sdk with adjustments for usage in TM

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>
2019-09-04 17:22:26 +02:00
4 changed files with 125 additions and 27 deletions

View File

@@ -51,22 +51,6 @@ jobs:
paths:
- /go/src/github.com/tendermint/tendermint
build_slate:
<<: *defaults
steps:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
key: v4-pkg-cache
- restore_cache:
key: v3-tree-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: slate docs
command: |
set -ex
export PATH="$GOBIN:$PATH"
make build-slate
test_abci_apps:
<<: *defaults
steps:

View File

@@ -16,6 +16,9 @@ BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
all: check build test install
# The below include contains the tools.
include scripts/Makefile
check: check_tools
########################################
@@ -79,13 +82,13 @@ check_tools:
@echo "Found tools: $(foreach tool,$(notdir $(GOTOOLS)),\
$(if $(shell which $(tool)),$(tool),$(error "No $(tool) in PATH")))"
get_tools:
@echo "--> Installing tools"
./scripts/get_tools.sh
# get_tools:
# @echo "--> Installing tools"
# ./scripts/get_tools.sh
update_tools:
@echo "--> Updating tools"
./scripts/get_tools.sh
# update_tools:
# @echo "--> Updating tools"
# ./scripts/get_tools.sh
#For ABCI and libs
get_protoc:
@@ -304,10 +307,6 @@ sentry-stop:
@if [ -z "$(DO_API_TOKEN)" ]; then echo "DO_API_TOKEN environment variable not set." ; false ; fi
cd networks/remote/terraform && terraform destroy -var DO_API_TOKEN="$(DO_API_TOKEN)" -var SSH_KEY_FILE="$(HOME)/.ssh/id_rsa.pub"
# meant for the CI, inspect script & adapt accordingly
build-slate:
bash scripts/slate.sh
# Build hooks for dredd, to skip or add information on some steps
build-contract-tests-hooks:
ifeq ($(OS),Windows_NT)
@@ -327,4 +326,4 @@ contract-tests:
# 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 build_abci dist install install_abci check_tools get_tools update_tools draw_deps get_protoc protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver test_cover test_apps test_persistence test_p2p test test_race test_integrations test_release test100 vagrant_test fmt rpc-docs build-linux localnet-start localnet-stop build-docker build-docker-localnode sentry-start sentry-config sentry-stop build-slate protoc_grpc protoc_all build_c install_c test_with_deadlock cleanup_after_test_with_deadlock lint build-contract-tests-hooks contract-tests
.PHONY: check build build_race build_abci dist install install_abci check_tools get_tools update_tools draw_deps get_protoc protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver test_cover test_apps test_persistence test_p2p test test_race test_integrations test_release test100 vagrant_test fmt rpc-docs build-linux localnet-start localnet-stop build-docker build-docker-localnode sentry-start sentry-config sentry-stop protoc_grpc protoc_all build_c install_c test_with_deadlock cleanup_after_test_with_deadlock lint build-contract-tests-hooks contract-tests

88
scripts/Makefile Normal file
View File

@@ -0,0 +1,88 @@
###
# Find OS and Go environment
# GO contains the Go binary
# FS contains the OS file separator
###
ifeq ($(OS),Windows_NT)
GO := $(shell where go.exe 2> NUL)
FS := "\\"
else
GO := $(shell command -v go 2> /dev/null)
FS := "/"
endif
ifeq ($(GO),)
$(error could not find go. Is it in PATH? $(GO))
endif
GOPATH ?= $(shell $(GO) env GOPATH)
GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com
GOLANGCI_LINT_VERSION := v1.17.1
GOLANGCI_LINT_HASHSUM := f5fa647a12f658924d9f7d6b9628d505ab118e8e049e43272de6526053ebe08d
###
# Functions
###
go_get = $(if $(findstring Windows_NT,$(OS)),\
IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS) ( mkdir $(GITHUBDIR)$(FS)$(1) ) else (cd .) &\
IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS)$(2)$(FS) ( cd $(GITHUBDIR)$(FS)$(1) && git clone https://github.com/$(1)/$(2) ) else (cd .) &\
,\
mkdir -p $(GITHUBDIR)$(FS)$(1) &&\
(test ! -d $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && cd $(GITHUBDIR)$(FS)$(1) && git clone https://github.com/$(1)/$(2)) || true &&\
)\
cd $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && git fetch origin && git checkout -q $(3)
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd)
###
# tools
###
TOOLS_DESTDIR ?= $(GOPATH)/bin
GOLANGCI_LINT = $(TOOLS_DESTDIR)/golangci-lint
GOIMPORTS = $(TOOLS_DESTDIR)/goimports
CERTSTRAP = $(TOOLS_DESTDIR)/certstrap
PROTOBUF = $(TOOLS_DESTDIR)/protoc
GOX = $(TOOLS_DESTDIR)/gox
all: get_tools
get_tools: golangci-lint goimports certstrap protobuf gox
golangci-lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT): $(mkfile_dir)/install-golangci-lint.sh
bash $(mkfile_dir)/install-golangci-lint.sh $(TOOLS_DESTDIR) $(GOLANGCI_LINT_VERSION) $(GOLANGCI_LINT_HASHSUM)
goimports: $(GOIMPORTS)
$(GOIMPORTS):
@echo "Get goimports@v0.0.0-20190628034336-212fb13d595e"
@go get golang.org/x/tools/cmd/goimports@v0.0.0-20190628034336-212fb13d595e
certstrap: $(CERTSTRAP)
$(CERTSTRAP):
@echo "Get Certstrap"
@go get github.com/square/certstrap@338204a88c4349b1c135eac1e8c14c693ad007da
protobuf: $(PROTOBUF)
$(PROTOBUF):
@echo "Get Protobuf"
## protobuf v1.3.0
@go get github.com/gogo/protobuf/protoc-gen-gogo@0ca988a254f991240804bf9821f3450d87ccbb1b
gox: $(GOX)
$(GOX):
@echo "Get Gox"
# used to build tm-monitor & tm-bench binaries
## gox v1.0.1
@go get github.com/mitchellh/gox@d8caaff5a9dc98f4cfa1fcce6e7265a04689f641
tools-clean:
rm -f $(CERTSTRAP) $(GOIMPORTS) $(GOLANGCI_LINT) $(PROTOBUF) $(GOX)
rm -f tools-stamp
.PHONY: all get_tools tools-clean

View File

@@ -0,0 +1,27 @@
#!/bin/bash
set -euo pipefail
f_sha256() {
local l_file
l_file=$1
python -sBc "import hashlib;print(hashlib.sha256(open('$l_file','rb').read()).hexdigest())"
}
installer="$(mktemp)"
trap "rm -f ${installer}" EXIT
GOBIN="${1}"
VERSION="${2}"
HASHSUM="${3}"
CURL="$(which curl)"
echo "Downloading golangci-lint ${VERSION} installer ..." >&2
"${CURL}" -sfL "https://raw.githubusercontent.com/golangci/golangci-lint/${VERSION}/install.sh" > "${installer}"
echo "Checking hashsum ..." >&2
[ "${HASHSUM}" = "$(f_sha256 ${installer})" ]
chmod +x "${installer}"
echo "Launching installer ..." >&2
exec "${installer}" -d -b "${GOBIN}" "${VERSION}"