Adjust build scripts

pull/374/head
David Hill 2020-02-27 12:57:51 -05:00
parent 13527bda06
commit 8f8ade727c
3 changed files with 11 additions and 11 deletions

View File

@ -9,7 +9,7 @@ RUN apt-get update && \
liblz4-dev graphviz && \
apt-get clean
ENV GOLANG_VERSION=go1.12.4.linux-amd64
ENV GOLANG_VERSION=go1.13.8.linux-amd64
ENV ROCKSDB_VERSION=v5.18.3
ENV GOPATH=/go
ENV PATH=$PATH:$GOPATH/bin
@ -33,17 +33,17 @@ RUN strip /opt/rocksdb/ldb /opt/rocksdb/sst_dump && \
cp /opt/rocksdb/ldb /opt/rocksdb/sst_dump /build
# install build tools
RUN go get github.com/golang/dep/cmd/dep
RUN go get github.com/gobuffalo/packr/...
# download pre-loaded depencencies
RUN \
cleanup() { rm -rf $GOPATH/src/blockbook; } && \
cleanup() { rm -rf $GOPATH/src/github.com/trezor ; } && \
trap cleanup EXIT && \
cd $GOPATH/src && \
mkdir -p $GOPATH/src/github.com/trezor && \
cd $GOPATH/src/github.com/trezor && \
git clone https://github.com/trezor/blockbook.git && \
cd blockbook && \
dep ensure -vendor-only && \
env GO111MODULE=on go mod vendor && \
cp -r vendor /build/vendor
ADD Makefile /build/Makefile

View File

@ -3,8 +3,8 @@ UPDATE_VENDOR ?= 1
VERSION ?= devel
GITCOMMIT = $(shell cd /src && git describe --always --dirty)
BUILDTIME = $(shell date --iso-8601=seconds)
LDFLAGS := -X blockbook/common.version=$(VERSION) -X blockbook/common.gitcommit=$(GITCOMMIT) -X blockbook/common.buildtime=$(BUILDTIME)
BLOCKBOOK_SRC := $(GOPATH)/src/blockbook
LDFLAGS := -X github.com/trezor/blockbook/common.version=$(VERSION) -X github.com/trezor/blockbook/common.gitcommit=$(GITCOMMIT) -X github.com/trezor/blockbook/common.buildtime=$(BUILDTIME)
BLOCKBOOK_SRC := $(GOPATH)/src/github.com/trezor/blockbook
ARGS ?=
all: build tools
@ -24,13 +24,13 @@ tools:
chown $(PACKAGER) /out/{ldb,sst_dump}
test: prepare-sources generate-data
cd $(BLOCKBOOK_SRC) && go test -tags unittest `go list ./... | grep -vP '^blockbook/(contrib|tests)'` $(ARGS)
cd $(BLOCKBOOK_SRC) && go test -tags unittest `go list ./... | grep -vP '^github.com/trezor/blockbook/(contrib|tests)'` $(ARGS)
test-integration: prepare-sources generate-data
cd $(BLOCKBOOK_SRC) && go test -tags integration `go list blockbook/tests/...` $(ARGS)
test-all: prepare-sources generate-data
cd $(BLOCKBOOK_SRC) && go test -tags 'unittest integration' `go list ./... | grep -v '^blockbook/contrib'` $(ARGS)
cd $(BLOCKBOOK_SRC) && go test -tags 'unittest integration' `go list ./... | grep -v '^github.com/trezor/blockbook/contrib'` $(ARGS)
prepare-sources:
@ [ -n "`ls /src 2> /dev/null`" ] || (echo "/src doesn't exist or is empty" 1>&2 && exit 1)
@ -41,7 +41,7 @@ prepare-sources:
prepare-vendor:
@ if [ "$(UPDATE_VENDOR)" -eq 1 ]; then \
echo "Updating vendor"; \
cd $(BLOCKBOOK_SRC) && rm -rf vendor* && cp -r /build/vendor . && dep ensure -vendor-only ; \
cd $(BLOCKBOOK_SRC) && rm -rf vendor* && cp -r /build/vendor . && env GO111MODULE=on go mod vendor ; \
else \
echo "Update of vendor not demanded, keeping version from src" ; \
fi

View File

@ -15,7 +15,7 @@ mkdir -p build
cp -r /src/build/templates build
cp -r /src/build/scripts build
cp -r /src/configs .
mkdir -p /go/src/blockbook/build && cp -r /src/build/tools /go/src/blockbook/build/tools
mkdir -p /go/src/github.com/trezor/blockbook/build && cp -r /src/build/tools /go/src/github.com/trezor/blockbook/build/tools
go run build/templates/generate.go $coin
# backend