From a9d26bec2ce763c70185f85bcea7635fac85ab21 Mon Sep 17 00:00:00 2001 From: Iwasaki Yudai Date: Mon, 12 Oct 2015 11:57:14 +0900 Subject: [PATCH] Run commands in Make on wercker --- .gitignore | 1 + Godeps/Godeps.json | 2 +- Makefile | 23 +++++++++++++++++++++++ wercker.yml | 41 +++++++++++++++++++++++------------------ 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 640e407..452f349 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ gotty bindata +builds diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index c2bab58..d445a4e 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1,6 +1,6 @@ { "ImportPath": "github.com/yudai/gotty", - "GoVersion": "go1.5", + "GoVersion": "go1.5.1", "Deps": [ { "ImportPath": "github.com/braintree/manners", diff --git a/Makefile b/Makefile index 1017abd..0b91ed1 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +OUTPUT_DIR = ./builds + gotty: app/resource.go main.go app/*.go go build @@ -28,3 +30,24 @@ bindata/static/js/hterm.js: bindata/static/js libapps/hterm/js/*.js bindata/static/js/gotty.js: bindata/static/js resources/gotty.js cp resources/gotty.js bindata/static/js/gotty.js + +tools: + go get github.com/tools/godep + go get github.com/mitchellh/gox + go get github.com/tcnksm/ghr + +deps: + godep restore + +test: + if [ `go fmt ./... | wc -l` -gt 0 ]; then echo "go fmt error"; exit 1; fi + +cross_compile: + GOARM=5 gox -os="darwin linux freebsd netbsd openbsd" -arch="386 amd64 arm" -output "${OUTPUT_DIR}/pkg/{{.OS}}_{{.Arch}}/{{.Dir}}" + +targz: + mkdir -p ${OUTPUT_DIR}/dist + cd ${OUTPUT_DIR}/pkg/; for osarch in *; do (cd $$osarch; tar zcvf ../../dist/gotty_$$osarch.tar.gz ./*); done; + +release: + ghr --delete --prerelease -u yudai -r gotty pre-release ${OUTPUT_DIR}/dist diff --git a/wercker.yml b/wercker.yml index c706c97..3332e1d 100644 --- a/wercker.yml +++ b/wercker.yml @@ -1,27 +1,32 @@ -box: tcnksm/gox +box: golang:1.5.1 build: steps: - setup-go-workspace - script: - name: go get - code: | - go get github.com/tools/godep - godep restore + name: tools + code: make tools - script: - name: check format - code: | - if [ `go fmt ./... | wc -l` -gt 0 ]; then echo "go fmt error"; exit 1; fi - - tcnksm/gox: - os: "darwin linux freebsd netbsd openbsd" - arch: "386 amd64 arm" - - yudai/targz: - input: $WERCKER_OUTPUT_DIR/pkg - output: $WERCKER_OUTPUT_DIR/dist + name: deps + code: make deps + - script: + name: test + code: make test + - script: + name: cross compile + code: make cross_compile OUTPUT_DIR=$WERCKER_OUTPUT_DIR + - script: + name: targz + code: make targz OUTPUT_DIR=$WERCKER_OUTPUT_DIR + - script: + name: store Makefile + code: cp Makefile $WERCKER_OUTPUT_DIR/ deploy: steps: - - tcnksm/ghr: - token: $GITHUB_TOKEN - input: dist - replace: true + - script: + name: tools + code: make tools + - script: + name: release + code: make release OUTPUT_DIR=.