Skip to content

Commit

Permalink
Merge pull request #15 from tendermint/develop
Browse files Browse the repository at this point in the history
v0.2.1
  • Loading branch information
ebuchman authored Jun 2, 2017
2 parents a0e73e1 + bd07eb3 commit 6b06ad6
Show file tree
Hide file tree
Showing 10 changed files with 213 additions and 37 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.2.1 (June 2, 2017)

IMPROVEMENTS:
- Add version number to the source code
- Update dependencies

## 0.2.0 (May 18, 2017)

Merge in the IAVL tree from `go-merkle` and update import paths for new `tmlibs`
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.PHONY: all test get_deps install
GOTOOLS = \
github.com/mitchellh/gox \
github.com/Masterminds/glide

PDFFLAGS=-pdf --nodefraction=0.1

Expand All @@ -7,12 +9,19 @@ all: test install
install:
go install github.com/tendermint/merkleeyes/cmd/...

dist:
@ sudo bash scripts/dist.sh
@ bash scripts/publish.sh

test:
go test -v --race `glide novendor`

get_deps:
go get -d github.com/tendermint/merkleeyes/...

tools:
go get -u -v $(GOTOOLS)

get_vendor_deps:
go get github.com/Masterminds/glide
glide install
Expand Down Expand Up @@ -55,3 +64,4 @@ exploremem:
delve:
dlv test ./benchmarks -- -test.bench=.

.PHONY: all test get_deps install tools dist
21 changes: 21 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"

"github.com/tendermint/merkleeyes/version"
)

var versionCmd = &cobra.Command{
Use: "version",
Short: "Show version info",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version.Version)
},
}

func init() {
RootCmd.AddCommand(versionCmd)
}
57 changes: 30 additions & 27 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions scripts/dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
set -e

REPO_NAME="merkleeyes"

# Get the version from the environment, or try to figure it out.
if [ -z $VERSION ]; then
VERSION=$(awk -F\" '/Version =/ { print $2; exit }' < version/version.go)
fi
if [ -z "$VERSION" ]; then
echo "Please specify a version."
exit 1
fi
echo "==> Building version $VERSION..."

# Get the parent directory of where this script is.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"

# Change into that dir because we expect that.
cd "$DIR"

# Generate the tag.
if [ -z "$NOTAG" ]; then
echo "==> Tagging..."
git commit --allow-empty -a -m "Release v$VERSION"
git tag -a -m "Version $VERSION" "v${VERSION}" master
fi

# Do a hermetic build inside a Docker container.
docker build -t tendermint/${REPO_NAME}-builder scripts/${REPO_NAME}-builder/
docker run --rm -e "BUILD_TAGS=$BUILD_TAGS" -v "$(pwd)":/go/src/github.com/tendermint/${REPO_NAME} tendermint/${REPO_NAME}-builder ./scripts/dist_build.sh

# Add $REPO_NAME and $VERSION prefix to package name.
rm -rf ./build/dist
mkdir -p ./build/dist
for FILENAME in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type f); do
FILENAME=$(basename "$FILENAME")
cp "./build/pkg/${FILENAME}" "./build/dist/${REPO_NAME}_${VERSION}_${FILENAME}"
done

# Make the checksums.
pushd ./build/dist
shasum -a256 ./* > "./${REPO_NAME}_${VERSION}_SHA256SUMS"
popd

# Done
echo
echo "==> Results:"
ls -hl ./build/dist

exit 0
56 changes: 56 additions & 0 deletions scripts/dist_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env bash
set -e

# Get the parent directory of where this script is.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"

# Change into that dir because we expect that.
cd "$DIR"

# Get the git commit
GIT_COMMIT="$(git rev-parse --short HEAD)"
GIT_DESCRIBE="$(git describe --tags --always)"
GIT_IMPORT="github.com/tendermint/merkleeyes/version"

# Determine the arch/os combos we're building for
XC_ARCH=${XC_ARCH:-"386 amd64 arm"}
XC_OS=${XC_OS:-"solaris darwin freebsd linux windows"}

# Delete the old dir
echo "==> Removing old directory..."
rm -rf build/pkg
mkdir -p build/pkg

# Make sure build tools are available.
make tools

# Get VENDORED dependencies
make get_vendor_deps

# Build!
echo "==> Building..."
"$(which gox)" \
-os="${XC_OS}" \
-arch="${XC_ARCH}" \
-osarch="!darwin/arm !solaris/amd64 !freebsd/amd64" \
-ldflags "-X ${GIT_IMPORT}.GitCommit='${GIT_COMMIT}' -X ${GIT_IMPORT}.GitDescribe='${GIT_DESCRIBE}'" \
-output "build/pkg/{{.OS}}_{{.Arch}}/merkleeyes" \
-tags="${BUILD_TAGS}" \
github.com/tendermint/merkleeyes/cmd/merkleeyes

# Zip all the files.
echo "==> Packaging..."
for PLATFORM in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type d); do
OSARCH=$(basename "${PLATFORM}")
echo "--> ${OSARCH}"

pushd "$PLATFORM" >/dev/null 2>&1
zip "../${OSARCH}.zip" ./*
popd >/dev/null 2>&1
done



exit 0
12 changes: 12 additions & 0 deletions scripts/merkleeyes-builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM golang:1.7.4

RUN apt-get update && apt-get install -y --no-install-recommends \
zip \
&& rm -rf /var/lib/apt/lists/*

# We want to ensure that release builds never have any cgo dependencies so we
# switch that off at the highest level.
ENV CGO_ENABLED 0

RUN mkdir -p $GOPATH/src/github.com/tendermint/merkleeyes
WORKDIR $GOPATH/src/github.com/tendermint/merkleeyes
7 changes: 7 additions & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /bin/bash

# Get the version from the environment, or try to figure it out.
if [ -z $VERSION ]; then
VERSION=$(awk -F\" '/Version =/ { print $2; exit }' < version/version.go)
fi
aws s3 cp --recursive build/dist s3://tendermint/binaries/merkleeyes/v${VERSION} --acl public-read
19 changes: 10 additions & 9 deletions tests/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/abci/server"
. "github.com/tendermint/tmlibs/common"
"github.com/tendermint/merkleeyes/app"
eyes "github.com/tendermint/merkleeyes/client"
. "github.com/tendermint/tmlibs/common"
)

var tmspAddr = "tcp://127.0.0.1:46659"
Expand All @@ -35,20 +35,21 @@ func testProcedure(t *testing.T, addr, dbName string, cache int, testPersistence
}
}

// Start the listener
// Create the app and start the listener
mApp := app.NewMerkleEyesApp(dbName, cache)
s, err := server.NewServer(addr, "socket", mApp)
defer mApp.CloseDB()

defer func() { //Close the database, and server
mApp.CloseDB()
s.Stop()
}()
s, err := server.NewServer(addr, "socket", mApp)
checkErr(err)

s.Start()
defer s.Stop()

// Create client
cli, err := eyes.NewClient(addr)
defer cli.Stop()
checkErr(err)
cli.Start()
defer cli.Stop()

if !testPersistence {
// Empty
Expand Down Expand Up @@ -116,5 +117,5 @@ func rem(t *testing.T, cli *eyes.Client, key string) {
func commit(t *testing.T, cli *eyes.Client, hash string) {
res := cli.CommitSync()
require.False(t, res.IsErr(), res.Error())
assert.Equal(t, hash, Fmt("%X", res.Data))
assert.Equal(t, hash, Fmt("%X", res.Data.Bytes()))
}
7 changes: 7 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package version

const Maj = "0"
const Min = "2"
const Fix = "1"

const Version = "0.2.1"

0 comments on commit 6b06ad6

Please sign in to comment.