Skip to content

Commit

Permalink
Run commands in Make on wercker
Browse files Browse the repository at this point in the history
  • Loading branch information
yudai committed Oct 12, 2015
1 parent c8fb306 commit a9d26be
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
gotty
bindata
builds
2 changes: 1 addition & 1 deletion Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
OUTPUT_DIR = ./builds

gotty: app/resource.go main.go app/*.go
go build

Expand Down Expand Up @@ -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
43 changes: 24 additions & 19 deletions wercker.yml
Original file line number Diff line number Diff line change
@@ -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
- 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: tools
code: make tools
- script:
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=.

0 comments on commit a9d26be

Please sign in to comment.