Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ FROM golang:1.11-stretch as builder

WORKDIR /go/src/github.com/CovenantSQL/CovenantSQL
COPY . .
RUN CGO_ENABLED=1 GOOS=linux GOLDFLAGS="-linkmode external -extldflags -static" ./build.sh
RUN GOOS=linux GOLDFLAGS="-linkmode external -extldflags -static" ./build.sh
RUN rm -f bin/*.test

# Stage: runner
FROM alpine:3.7
FROM frolvlad/alpine-glibc:latest

ARG COMMIT
ARG VERSION
Expand Down
21 changes: 18 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
default: build
default: docker

IMAGE := covenantsql/covenantsql
GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
Expand All @@ -15,7 +15,7 @@ IMAGE_TAR_GZ := $(IMAGE_TAR).gz
status:
@echo "Commit: $(COMMIT) Version: $(VERSION) Ship Version: $(SHIP_VERSION)"

build: status
docker: status
docker build \
--tag $(IMAGE):$(VERSION) \
--tag $(IMAGE):latest \
Expand All @@ -35,11 +35,26 @@ start:
docker-compose up --no-start
docker-compose start

stop:
docker-compose down

logs:
docker-compose logs -f --tail=10

push:
docker push $(IMAGE):$(VERSION)
docker push $(IMAGE):latest

.PHONY: status build save start logs push
bp:
./build.sh bp

miner:
./build.sh miner

client:
./build.sh client

all:
./build.sh

.PHONY: status docker save start stop logs push bp miner client all
84 changes: 61 additions & 23 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash -x
set -e

param=$1

branch=`git rev-parse --abbrev-ref HEAD`
commitid=`git rev-parse --short HEAD`
builddate=`date +%Y%m%d%H%M%S`
Expand All @@ -19,38 +21,74 @@ cd `dirname $0`

version=`getversion`

cql_utils_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-utils"
go build -ldflags "-X main.version=${version} ${GOLDFLAGS}" -o bin/cql-utils ${cql_utils_pkgpath}
tags="${platform} sqlite_omit_load_extension"
testtags="${platform} sqlite_omit_load_extension testbinary"

cqld_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cqld"
CGO_ENABLED=1 go build -ldflags "-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=B ${GOLDFLAGS}" -tags "${platform} sqlite_omit_load_extension" -o bin/cqld ${cqld_pkgpath}
CGO_ENABLED=1 go test -coverpkg github.com/CovenantSQL/CovenantSQL/... -cover -race -c -tags "${platform} sqlite_omit_load_extension testbinary" -ldflags "-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=B ${GOLDFLAGS}" -o bin/cqld.test ${cqld_pkgpath}
ldflags_role_bp="-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=B ${GOLDFLAGS}"
ldflags_role_miner="-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=M ${GOLDFLAGS}"
ldflags_role_client="-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=C ${GOLDFLAGS}"

cql_minerd_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-minerd"
CGO_ENABLED=1 go build -ldflags "-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=M ${GOLDFLAGS}" --tags ${platform}" sqlite_omit_load_extension" -o bin/cql-minerd ${cql_minerd_pkgpath}
CGO_ENABLED=1 go test -coverpkg github.com/CovenantSQL/CovenantSQL/... -cover -race -c -tags "${platform} sqlite_omit_load_extension testbinary" -ldflags "-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=M ${GOLDFLAGS}" -o bin/cql-minerd.test ${cql_minerd_pkgpath}
test_flags="-coverpkg github.com/CovenantSQL/CovenantSQL/... -cover -race -c"

cql_observer_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-observer"
go build -ldflags "-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=C ${GOLDFLAGS}" -o bin/cql-observer ${cql_observer_pkgpath}
go test -coverpkg github.com/CovenantSQL/CovenantSQL/... -cover -race -c -tags 'testbinary' -ldflags "-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=C ${GOLDFLAGS}" -o bin/cql-observer.test ${cql_observer_pkgpath}
export CGO_ENABLED=1

cli_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql"
CGO_ENABLED=1 go build -ldflags "-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=C ${GOLDFLAGS}" --tags ${platform}" sqlite_omit_load_extension" -o bin/cql ${cli_pkgpath}
cql_utils_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-utils"
go build -ldflags "-X main.version=${version} ${GOLDFLAGS}" -o bin/cql-utils ${cql_utils_pkgpath}

fuse_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-fuse"
CGO_ENABLED=1 go build -ldflags "-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=C ${GOLDFLAGS}" --tags ${platform}" sqlite_omit_load_extension" -o bin/cql-fuse ${fuse_pkgpath}

cql_adapter_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-adapter"
CGO_ENABLED=1 go build -ldflags "-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=C ${GOLDFLAGS}" --tags ${platform}" sqlite_omit_load_extension" -o bin/cql-adapter ${cql_adapter_pkgpath}
build_bp() {
cqld_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cqld"
go build -ldflags "${ldflags_role_bp}" --tags "${tags}" -o bin/cqld ${cqld_pkgpath}
go test ${test_flags} -tags "${testtags}" -ldflags "${ldflags_role_bp}" -o bin/cqld.test ${cqld_pkgpath}
}

build_miner() {
cql_minerd_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-minerd"
go build -ldflags "${ldflags_role_miner}" --tags "${tags}" -o bin/cql-minerd ${cql_minerd_pkgpath}
go test ${test_flags} -tags "${testtags}" -ldflags "${ldflags_role_miner}" -o bin/cql-minerd.test ${cql_minerd_pkgpath}
}

cql_faucet_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-faucet"
CGO_ENABLED=1 go build -ldflags "-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=C ${GOLDFLAGS}" --tags ${platform}" sqlite_omit_load_extension" -o bin/cql-faucet ${cql_faucet_pkgpath}

cql_mysql_adapter_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-mysql-adapter"
CGO_ENABLED=1 go build -ldflags "-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=C ${GOLDFLAGS}" --tags ${platform}" sqlite_omit_load_extension" -o bin/cql-mysql-adapter ${cql_mysql_adapter_pkgpath}
build_client() {
cql_observer_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-observer"
go build -ldflags "${ldflags_role_client}" -o bin/cql-observer ${cql_observer_pkgpath}
go test ${test_flags} -tags 'testbinary' -ldflags "${ldflags_role_client}" -o bin/cql-observer.test ${cql_observer_pkgpath}

cli_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql"
go build -ldflags "${ldflags_role_client}" --tags "${tags}" -o bin/cql ${cli_pkgpath}

fuse_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-fuse"
go build -ldflags "${ldflags_role_client}" --tags "${tags}" -o bin/cql-fuse ${fuse_pkgpath}

cql_adapter_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-adapter"
go build -ldflags "${ldflags_role_client}" --tags "${tags}" -o bin/cql-adapter ${cql_adapter_pkgpath}

cql_faucet_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-faucet"
go build -ldflags "${ldflags_role_client}" --tags "${tags}" -o bin/cql-faucet ${cql_faucet_pkgpath}

cql_mysql_adapter_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-mysql-adapter"
go build -ldflags "${ldflags_role_client}" --tags "${tags}" -o bin/cql-mysql-adapter ${cql_mysql_adapter_pkgpath}

cql_explorer_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-explorer"
go build -ldflags "${ldflags_role_client}" --tags "${tags}" -o bin/cql-explorer ${cql_explorer_pkgpath}
}

cql_explorer_pkgpath="github.com/CovenantSQL/CovenantSQL/cmd/cql-explorer"
CGO_ENABLED=1 go build -ldflags "-X main.version=${version} -X github.com/CovenantSQL/CovenantSQL/conf.RoleTag=C ${GOLDFLAGS}" --tags ${platform}" sqlite_omit_load_extension" -o bin/cql-explorer ${cql_explorer_pkgpath}
case $param in
"bp")
build_bp
;;
'miner')
build_miner
;;
'client')
build_client
;;
*)
build_bp
build_miner
build_client
;;
esac

echo "done"

2 changes: 1 addition & 1 deletion test/GNTE/GNTE
Submodule GNTE updated 3 files
+3 −5 Dockerfile
+3 −2 generate.sh
+1 −2 scripts/gobuild.sh
9 changes: 3 additions & 6 deletions test/GNTE/run.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#!/bin/bash -x

yaml[0]=./scripts/gnte_0ms.yaml
yaml[1]=./scripts/gnte_5ms.yaml
yaml[2]=./scripts/gnte_20ms.yaml
yaml[3]=./scripts/gnte_100ms.yaml
yaml[4]=./scripts/gnte_200ms.yaml

yaml=(
./scripts/gnte_{0,5,20,100,200}ms.yaml
)

TEST_WD=$(cd $(dirname $0)/; pwd)
PROJECT_DIR=$(cd ${TEST_WD}/../../; pwd)
Expand Down