Skip to content

Commit 26afeed

Browse files
author
Shlomi Noach
authored
Merge pull request #776 from github/initial-github-ci-cd
Initial GitHub CI/CD
2 parents b38814f + 143abf0 commit 26afeed

File tree

8 files changed

+58
-15
lines changed

8 files changed

+58
-15
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@master
12+
13+
- name: Set up Go 1.12
14+
uses: actions/setup-go@v1
15+
with:
16+
version: 1.12
17+
id: go
18+
19+
- name: Build
20+
run: script/cibuild

.github/workflows/replica-tests.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: migration tests
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@master
12+
13+
- name: Set up Go 1.12
14+
uses: actions/setup-go@v1
15+
with:
16+
version: 1.12
17+
id: go
18+
19+
- name: migration tests
20+
run: script/cibuild-gh-ost-replica-tests

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
language: go
33

44
go:
5-
- "1.9"
6-
- "1.10"
5+
- "1.12.x"
76

87
os:
98
- linux
109

10+
services:
11+
- mysql
12+
1113
env:
1214
- MYSQL_USER=root
1315
- CURRENT_CI_ENV=travis

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Please see [Coding gh-ost](doc/coding-ghost.md) for a guide to getting started d
9494

9595
[Download latest release here](https://github.com/github/gh-ost/releases/latest)
9696

97-
`gh-ost` is a Go project; it is built with Go `1.9` and above. To build on your own, use either:
97+
`gh-ost` is a Go project; it is built with Go `1.12` and above. To build on your own, use either:
9898
- [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.
9999
- [build.sh](https://github.com/github/gh-ost/blob/master/build.sh) for building `tar.gz` artifacts in `/tmp/gh-ost`
100100

build.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ function build {
1818
GOOS=$3
1919
GOARCH=$4
2020

21-
22-
23-
if ! go version | egrep -q 'go(1[.]9|1[.]1[0-9])' ; then
24-
echo "go version is too low. Must use 1.9 or above"
21+
if ! go version | egrep -q 'go(1\.1[234])' ; then
22+
echo "go version must be 1.12 or above"
2523
exit 1
2624
fi
2725

go/logic/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (this *Server) applyServerCommand(command string, writer *bufio.Writer) (pr
144144
switch command {
145145
case "help":
146146
{
147-
fmt.Fprintln(writer, `available commands:
147+
fmt.Fprint(writer, `available commands:
148148
status # Print a detailed status message
149149
sup # Print a short status message
150150
coordinates # Print the currently inspected coordinates

localtests/test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ verify_master_and_replica() {
5050
original_sql_mode="$(gh-ost-test-mysql-master -e "select @@global.sql_mode" -s -s)"
5151
echo "sql_mode on master is ${original_sql_mode}"
5252

53+
echo "Gracefully sleeping for 3 seconds while replica is setting up..."
54+
sleep 3
55+
5356
if [ "$(gh-ost-test-mysql-replica -e "select 1" -ss)" != "1" ] ; then
5457
echo "Cannot verify gh-ost-test-mysql-replica"
5558
exit 1

script/ensure-go-installed

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/bin/bash
22

3-
PREFERRED_GO_VERSION=go1.9.2
4-
SUPPORTED_GO_VERSIONS='go1.[89]'
3+
PREFERRED_GO_VERSION=go1.12.6
4+
SUPPORTED_GO_VERSIONS='go1.1[234]'
55

66
GO_PKG_DARWIN=${PREFERRED_GO_VERSION}.darwin-amd64.pkg
7-
GO_PKG_DARWIN_SHA=8b4f6ae6deae1150d2e341d02c247fd18a99af387516540eeb84702ffd76d3a1
7+
GO_PKG_DARWIN_SHA=ea78245e43de2996fa0973033064b33f48820cfe39f4f3c6e953040925cc5815
88

99
GO_PKG_LINUX=${PREFERRED_GO_VERSION}.linux-amd64.tar.gz
10-
GO_PKG_LINUX_SHA=de874549d9a8d8d8062be05808509c09a88a248e77ec14eb77453530829ac02b
10+
GO_PKG_LINUX_SHA=dbcf71a3c1ea53b8d54ef1b48c85a39a6c9a935d01fc8291ff2b92028e59913c
1111

1212
export ROOTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
1313
cd $ROOTDIR
1414

1515
# If Go isn't installed globally, setup environment variables for local install.
1616
if [ -z "$(which go)" ] || [ -z "$(go version | grep "$SUPPORTED_GO_VERSIONS")" ]; then
17-
GODIR="$ROOTDIR/.vendor/go19"
17+
GODIR="$ROOTDIR/.vendor/golocal"
1818

1919
if [ $(uname -s) = "Darwin" ]; then
2020
export GOROOT="$GODIR/usr/local/go"
@@ -32,12 +32,12 @@ if [ -z "$(which go)" ] || [ -z "$(go version | grep "$SUPPORTED_GO_VERSIONS")"
3232
cd "$GODIR";
3333

3434
if [ $(uname -s) = "Darwin" ]; then
35-
curl -L -O https://storage.googleapis.com/golang/$GO_PKG_DARWIN
35+
curl -L -O https://dl.google.com/go/$GO_PKG_DARWIN
3636
shasum -a256 $GO_PKG_DARWIN | grep $GO_PKG_DARWIN_SHA
3737
xar -xf $GO_PKG_DARWIN
3838
cpio -i < com.googlecode.go.pkg/Payload
3939
else
40-
curl -L -O https://storage.googleapis.com/golang/$GO_PKG_LINUX
40+
curl -L -O https://dl.google.com/go/$GO_PKG_LINUX
4141
shasum -a256 $GO_PKG_LINUX | grep $GO_PKG_LINUX_SHA
4242
tar xf $GO_PKG_LINUX
4343
fi

0 commit comments

Comments
 (0)