Skip to content

Commit

Permalink
Merge pull request #11 from Shopify/dev-setup-improvements
Browse files Browse the repository at this point in the history
Makefile improvements + working CI
  • Loading branch information
shuhaowu authored Aug 8, 2017
2 parents 20d0f76 + 8cc4fb1 commit 801a44c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
31 changes: 22 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
.PHONY: test
.PHONY: test install clean

BUILD_DIR := build
COPYDB_BIN := ghostferry-copydb
COPYDB_TARGET := $(BUILD_DIR)/$(COPYDB_BIN)
GOBIN := $(GOPATH)/bin

$(COPYDB_TARGET): $(BUILD_DIR)
@go version
go build -o $(BUILD_DIR)/$(COPYDB_BIN) ./copydb/cmd
COPYDB_TARGET := $(GOBIN)/ghostferry-copydb
COPYDB_PKG := ./copydb/cmd

SOURCES := $(shell find . -name "*.go")

define go_build_i
go build -i -o $(1) $(2)
endef

install: $(COPYDB_TARGET)

$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(COPYDB_TARGET): $(GOBIN) $(SOURCES)
$(call go_build_i,$(COPYDB_TARGET),$(COPYDB_PKG))

$(GOBIN):
mkdir -p $(GOBIN)

test:
@go version
go test ./test $(TESTFLAGS)

clean:
rm -f $(COPYDB_TARGET)
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Vagrant.configure("2") do |config|
chmod +x /usr/bin/gimme
sudo -H -u vagrant gimme 1.8.3
echo "source /home/vagrant/.gimme/envs/go1.8.3.env" >> /home/vagrant/.bashrc
echo 'GOPATH=$HOME/go' >> /home/vagrant/.bashrc
echo 'export GOPATH=$HOME/go' >> /home/vagrant/.bashrc
fi
SHELL

Expand Down
3 changes: 2 additions & 1 deletion ci/02-setup-mysql.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

source test/envsetup.sh
N1=gf.n1
N2=gf.n2

# TODO: at somepoint we can open source mysql-vending-machine so we don't
# have to do this hack and just clone from https
Expand Down
7 changes: 7 additions & 0 deletions ci/files/circle-percona-apt-pin
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Package: *
Pin: release o=Percona Development Team
Pin-Priority: 1001

Package: *
Pin: release o=MySQL
Pin-Priority: 1
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
test:
override:
- go test ./test
- go test ./test -v

dependencies:
pre:
Expand Down

0 comments on commit 801a44c

Please sign in to comment.