Merge branch 'master' into concurrent-rowcount-defaults-true
This commit is contained in:
commit
14b9e9a9aa
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/.gopath/
|
||||
/bin/
|
||||
/libexec/
|
||||
/.vendor/
|
16
script/bootstrap
Executable file
16
script/bootstrap
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Make sure we have the version of Go we want to depend on, either from the
|
||||
# system or one we grab ourselves.
|
||||
. script/ensure-go-installed
|
||||
|
||||
# Since we want to be able to build this outside of GOPATH, we set it
|
||||
# up so it points back to us and go is none the wiser
|
||||
|
||||
set -x
|
||||
rm -rf .gopath
|
||||
mkdir -p .gopath/src/github.com/github
|
||||
ln -s "$PWD" .gopath/src/github.com/github/gh-ost
|
||||
export GOPATH=$PWD/.gopath:$GOPATH
|
20
script/build
Executable file
20
script/build
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
. script/bootstrap
|
||||
|
||||
mkdir -p bin
|
||||
bindir="$PWD"/bin
|
||||
scriptdir="$PWD"/script
|
||||
|
||||
# We have a few binaries that we want to build, so let's put them into bin/
|
||||
|
||||
version=$(git rev-parse HEAD)
|
||||
describe=$(git describe --tags --always --dirty)
|
||||
|
||||
export GOPATH="$PWD/.gopath"
|
||||
cd .gopath/src/github.com/github/gh-ost
|
||||
|
||||
# We put the binaries directly into the bindir, because we have no need for shim wrappers
|
||||
go build -o "$bindir/gh-ost" -ldflags "-X main.AppVersion=${version} -X main.BuildDescribe=${describe}" ./go/cmd/gh-ost/main.go
|
12
script/cibuild
Executable file
12
script/cibuild
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
. script/bootstrap
|
||||
|
||||
script/build
|
||||
|
||||
export GITBACKUPS_ENV=test
|
||||
|
||||
cd .gopath/src/github.com/github/gh-ost
|
||||
go test ./go/...
|
29
script/cibuild-gh-ost-build-deploy-tarball
Executable file
29
script/cibuild-gh-ost-build-deploy-tarball
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
script/cibuild
|
||||
|
||||
# Get a fresh directory and make sure to delete it afterwards
|
||||
build_dir=tmp/build
|
||||
rm -rf $build_dir
|
||||
mkdir -p $build_dir
|
||||
trap "rm -rf $build_dir" EXIT
|
||||
|
||||
commit_sha=$(git rev-parse HEAD)
|
||||
|
||||
if [ $(uname -s) = "Darwin" ]; then
|
||||
build_arch="$(uname -sr | tr -d ' ' | tr '[:upper:]' '[:lower:]')-$(uname -m)"
|
||||
else
|
||||
build_arch="$(lsb_release -sc | tr -d ' ' | tr '[:upper:]' '[:lower:]')-$(uname -m)"
|
||||
fi
|
||||
|
||||
tarball=$build_dir/${commit_sha}-${build_arch}.tar
|
||||
|
||||
# Create the tarball
|
||||
tar cvf $tarball --mode="ugo=rx" bin/
|
||||
|
||||
# Compress it and copy it to the directory for the CI to upload it
|
||||
gzip $tarball
|
||||
mkdir -p "$BUILD_ARTIFACT_DIR"/gh-ost
|
||||
cp ${tarball}.gz "$BUILD_ARTIFACT_DIR"/gh-ost/
|
51
script/ensure-go-installed
Executable file
51
script/ensure-go-installed
Executable file
@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
GO_VERSION=go1.7
|
||||
|
||||
GO_PKG_DARWIN=${GO_VERSION}.darwin-amd64.pkg
|
||||
GO_PKG_DARWIN_SHA=e7089843bc7148ffcc147759985b213604d22bb9fd19bd930b515aa981bf1b22
|
||||
|
||||
GO_PKG_LINUX=${GO_VERSION}.linux-amd64.tar.gz
|
||||
GO_PKG_LINUX_SHA=702ad90f705365227e902b42d91dd1a40e48ca7f67a2f4b2fd052aaa4295cd95
|
||||
|
||||
export ROOTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
|
||||
cd $ROOTDIR
|
||||
|
||||
# If Go isn't installed globally, setup environment variables for local install.
|
||||
if [ -z "$(which go)" ] || [ -z "$(go version | grep $GO_VERSION)" ]; then
|
||||
GODIR="$ROOTDIR/.vendor/go17"
|
||||
|
||||
if [ $(uname -s) = "Darwin" ]; then
|
||||
export GOROOT="$GODIR/usr/local/go"
|
||||
else
|
||||
export GOROOT="$GODIR/go"
|
||||
fi
|
||||
|
||||
export PATH="$GOROOT/bin:$PATH"
|
||||
fi
|
||||
|
||||
# Check if local install exists, and install otherwise.
|
||||
if [ -z "$(which go)" ] || [ -z "$(go version | grep $GO_VERSION)" ]; then
|
||||
[ -d "$GODIR" ] && rm -rf $GODIR
|
||||
mkdir -p "$GODIR"
|
||||
cd "$GODIR";
|
||||
|
||||
if [ $(uname -s) = "Darwin" ]; then
|
||||
curl -L -O https://storage.googleapis.com/golang/$GO_PKG_DARWIN
|
||||
shasum -a256 $GO_PKG_DARWIN | grep $GO_PKG_DARWIN_SHA
|
||||
xar -xf $GO_PKG_DARWIN
|
||||
cpio -i < com.googlecode.go.pkg/Payload
|
||||
else
|
||||
curl -L -O https://storage.googleapis.com/golang/$GO_PKG_LINUX
|
||||
shasum -a256 $GO_PKG_LINUX | grep $GO_PKG_LINUX_SHA
|
||||
tar xf $GO_PKG_LINUX
|
||||
fi
|
||||
|
||||
# Prove we did something right
|
||||
echo "$GO_VERSION installed in $GODIR: Go Binary: $(which go)"
|
||||
fi
|
||||
|
||||
cd $ROOTDIR
|
||||
|
||||
# Configure the new go to be the first go found
|
||||
export GOPATH=$ROOTDIR/.vendor
|
11
script/go
Executable file
11
script/go
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
. script/bootstrap
|
||||
|
||||
mkdir -p bin
|
||||
bindir="$PWD"/bin
|
||||
|
||||
cd .gopath/src/github.com/github/gh-ost
|
||||
go "$@"
|
76
vendor/github.com/outbrain/golib/tests/spec.go
generated
vendored
Normal file
76
vendor/github.com/outbrain/golib/tests/spec.go
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Spec is an access point to test Expections
|
||||
type Spec struct {
|
||||
t *testing.T
|
||||
}
|
||||
|
||||
// S generates a spec. You will want to use it once in a test file, once in a test or once per each check
|
||||
func S(t *testing.T) *Spec {
|
||||
return &Spec{t: t}
|
||||
}
|
||||
|
||||
// ExpectNil expects given value to be nil, or errors
|
||||
func (spec *Spec) ExpectNil(actual interface{}) {
|
||||
if actual == nil {
|
||||
return
|
||||
}
|
||||
spec.t.Errorf("Expected %+v to be nil", actual)
|
||||
}
|
||||
|
||||
// ExpectNotNil expects given value to be not nil, or errors
|
||||
func (spec *Spec) ExpectNotNil(actual interface{}) {
|
||||
if actual != nil {
|
||||
return
|
||||
}
|
||||
spec.t.Errorf("Expected %+v to be not nil", actual)
|
||||
}
|
||||
|
||||
// ExpectEquals expects given values to be equal (comparison via `==`), or errors
|
||||
func (spec *Spec) ExpectEquals(actual, value interface{}) {
|
||||
if actual == value {
|
||||
return
|
||||
}
|
||||
spec.t.Errorf("Expected %+v, got %+v", value, actual)
|
||||
}
|
||||
|
||||
// ExpectNotEquals expects given values to be nonequal (comparison via `==`), or errors
|
||||
func (spec *Spec) ExpectNotEquals(actual, value interface{}) {
|
||||
if !(actual == value) {
|
||||
return
|
||||
}
|
||||
spec.t.Errorf("Expected not %+v", value)
|
||||
}
|
||||
|
||||
// ExpectEqualsAny expects given actual to equal (comparison via `==`) at least one of given values, or errors
|
||||
func (spec *Spec) ExpectEqualsAny(actual interface{}, values ...interface{}) {
|
||||
for _, value := range values {
|
||||
if actual == value {
|
||||
return
|
||||
}
|
||||
}
|
||||
spec.t.Errorf("Expected %+v to equal any of given values", actual)
|
||||
}
|
||||
|
||||
// ExpectNotEqualsAny expects given actual to be nonequal (comparison via `==`)tp any of given values, or errors
|
||||
func (spec *Spec) ExpectNotEqualsAny(actual interface{}, values ...interface{}) {
|
||||
for _, value := range values {
|
||||
if actual == value {
|
||||
spec.t.Errorf("Expected not %+v", value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ExpectFalse expects given values to be false, or errors
|
||||
func (spec *Spec) ExpectFalse(actual interface{}) {
|
||||
spec.ExpectEquals(actual, false)
|
||||
}
|
||||
|
||||
// ExpectTrue expects given values to be true, or errors
|
||||
func (spec *Spec) ExpectTrue(actual interface{}) {
|
||||
spec.ExpectEquals(actual, true)
|
||||
}
|
Loading…
Reference in New Issue
Block a user