diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ec8978d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,20 @@ +name: CI + +on: [pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + + - name: Set up Go 1.12 + uses: actions/setup-go@v1 + with: + version: 1.12 + id: go + + - name: Build + run: script/cibuild diff --git a/.github/workflows/replica-tests.yml b/.github/workflows/replica-tests.yml new file mode 100644 index 0000000..d775131 --- /dev/null +++ b/.github/workflows/replica-tests.yml @@ -0,0 +1,20 @@ +name: migration tests + +on: [pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + + - name: Set up Go 1.12 + uses: actions/setup-go@v1 + with: + version: 1.12 + id: go + + - name: migration tests + run: script/cibuild-gh-ost-replica-tests diff --git a/.travis.yml b/.travis.yml index b6b68f3..c1c1891 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,14 @@ language: go go: - - "1.9" - - "1.10" + - "1.12.x" os: - linux +services: + - mysql + env: - MYSQL_USER=root - CURRENT_CI_ENV=travis diff --git a/README.md b/README.md index 008c65b..cd6f592 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ Please see [Coding gh-ost](doc/coding-ghost.md) for a guide to getting started d [Download latest release here](https://github.com/github/gh-ost/releases/latest) -`gh-ost` is a Go project; it is built with Go `1.9` and above. To build on your own, use either: +`gh-ost` is a Go project; it is built with Go `1.12` and above. To build on your own, use either: - [script/build](https://github.com/github/gh-ost/blob/master/script/build) - this is the same build script used by CI hence the authoritative; artifact is `./bin/gh-ost` binary. - [build.sh](https://github.com/github/gh-ost/blob/master/build.sh) for building `tar.gz` artifacts in `/tmp/gh-ost` diff --git a/build.sh b/build.sh index df9ac7d..b7f3a54 100755 --- a/build.sh +++ b/build.sh @@ -18,10 +18,8 @@ function build { GOOS=$3 GOARCH=$4 - - - if ! go version | egrep -q 'go(1[.]9|1[.]1[0-9])' ; then - echo "go version is too low. Must use 1.9 or above" + if ! go version | egrep -q 'go(1\.1[234])' ; then + echo "go version must be 1.12 or above" exit 1 fi diff --git a/go/logic/server.go b/go/logic/server.go index 774c4ab..4c1f581 100644 --- a/go/logic/server.go +++ b/go/logic/server.go @@ -144,7 +144,7 @@ func (this *Server) applyServerCommand(command string, writer *bufio.Writer) (pr switch command { case "help": { - fmt.Fprintln(writer, `available commands: + fmt.Fprint(writer, `available commands: status # Print a detailed status message sup # Print a short status message coordinates # Print the currently inspected coordinates diff --git a/localtests/test.sh b/localtests/test.sh index 1078965..d4b3f17 100755 --- a/localtests/test.sh +++ b/localtests/test.sh @@ -50,6 +50,9 @@ verify_master_and_replica() { original_sql_mode="$(gh-ost-test-mysql-master -e "select @@global.sql_mode" -s -s)" echo "sql_mode on master is ${original_sql_mode}" + echo "Gracefully sleeping for 3 seconds while replica is setting up..." + sleep 3 + if [ "$(gh-ost-test-mysql-replica -e "select 1" -ss)" != "1" ] ; then echo "Cannot verify gh-ost-test-mysql-replica" exit 1 diff --git a/script/ensure-go-installed b/script/ensure-go-installed index a511e0e..c9c2ae8 100755 --- a/script/ensure-go-installed +++ b/script/ensure-go-installed @@ -1,20 +1,20 @@ #!/bin/bash -PREFERRED_GO_VERSION=go1.9.2 -SUPPORTED_GO_VERSIONS='go1.[89]' +PREFERRED_GO_VERSION=go1.12.6 +SUPPORTED_GO_VERSIONS='go1.1[234]' GO_PKG_DARWIN=${PREFERRED_GO_VERSION}.darwin-amd64.pkg -GO_PKG_DARWIN_SHA=8b4f6ae6deae1150d2e341d02c247fd18a99af387516540eeb84702ffd76d3a1 +GO_PKG_DARWIN_SHA=ea78245e43de2996fa0973033064b33f48820cfe39f4f3c6e953040925cc5815 GO_PKG_LINUX=${PREFERRED_GO_VERSION}.linux-amd64.tar.gz -GO_PKG_LINUX_SHA=de874549d9a8d8d8062be05808509c09a88a248e77ec14eb77453530829ac02b +GO_PKG_LINUX_SHA=dbcf71a3c1ea53b8d54ef1b48c85a39a6c9a935d01fc8291ff2b92028e59913c 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 "$SUPPORTED_GO_VERSIONS")" ]; then - GODIR="$ROOTDIR/.vendor/go19" + GODIR="$ROOTDIR/.vendor/golocal" if [ $(uname -s) = "Darwin" ]; then export GOROOT="$GODIR/usr/local/go" @@ -32,12 +32,12 @@ if [ -z "$(which go)" ] || [ -z "$(go version | grep "$SUPPORTED_GO_VERSIONS")" cd "$GODIR"; if [ $(uname -s) = "Darwin" ]; then - curl -L -O https://storage.googleapis.com/golang/$GO_PKG_DARWIN + curl -L -O https://dl.google.com/go/$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 + curl -L -O https://dl.google.com/go/$GO_PKG_LINUX shasum -a256 $GO_PKG_LINUX | grep $GO_PKG_LINUX_SHA tar xf $GO_PKG_LINUX fi