Skip to content

Commit

Permalink
travis: use build stages
Browse files Browse the repository at this point in the history
  • Loading branch information
andrestc committed Mar 29, 2018
1 parent 2f9d783 commit ad565f4
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 13 deletions.
52 changes: 39 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,47 @@
language: go
sudo: required
install: true
os:
- linux
go:
- 1.10.x
- master
addons:
apt:
packages:
- docker-ce
env:
global:
- GO_FOR_RELEASE=1.10
matrix:
- GOARCH=amd64
- GOARCH=386
- secure: "riJQtXxb4BcRRvPW8DRuDZHo37WWedoL/Byx0O211AxIKEaGpnAYPPEu6GK9g6J/J1QOWhMSEKRdas3SlXfH2qc+w02YiX1TS9wlycWc/R4mdz6e3WJ4IkhM9m/WBMTmL4w+IHLN0Sf+V2P6Nl24vdSMSTaS4ygSOKB6GeqqinKk21Zg7f+Wq2Npm3yIiDCE9nwLzKIoY4J004yEHl5dbvR8GkgkGJGZiywF3L7gAJKGvIslLNvgYAJmGgj/LfaC8ds9n4oXmqTW8mIaAFiykZ2XqzzgXAofbQPwIErqhUxsy7y8ZQFViSMbSKCziLV03f1h8Prj5YvL237DgENBerpOZybgftkDwso0nN36ytJBSPFEpd3seMZqvpxNW8eEIi+hs1zpdV+NLhrjuEJfGDWy51yfovt5V+j0wbqsaeTnjE/ysNhJXHtJaW7aNP+hxCSvwLXOP2RyKCpMEJbIGY97OsSV0EHgsFfSU/KjDxOPxdhg5ctUmGAixA+0Ccjv4ov1HmEi+Egg6Vu2FFXcABJOtRhLinm+smYyRNfcVY91tg5ejLm+olQfuiuHqX72oMW5j3C0sZ9qkIqbUHwNcEBjSpKG7vt9T8m62yoaOJ7NzTLKPYmN1m1EZRNerv08h9EUPFygBDl+gLq837Utw8pCIeanmZLUWsqq33mSN3c="
- secure: "DY13jMRyr5lCrqqlS5fSFLrjJ+uyv0GrXFQJvctGBXi018BE2N3bPUHaLkNapHNbSSstH9bzciMXsvHxADyHJzGF3wIMTSmf91eqxq8F3J2hZaTo+QbPK0I8uYEQPqhpIlLVuP4BViMG8QJ8/44h8rX+kWb+oGwagXncoK/cgxqJ6jnkMkHU3BCAj1neTDEDwzYqFssbndB9rhi6viSI6SM/yebKqkByMK7YoBibXIMjCtGSz0rxB04rWb2tGvu9yslacs9diJeD/wQjyFNz/2iuFQEsWRCaV1HY5SGEm6qCOvRpCgHj7tgwvmt+DLZLIeVwMmAQ+e7dTZoTOWXVDfnFrb74axgl+sPvd1We2QGFOjy/8JIcA9LoggiVAt4WZHOH/gQ/cx8n2y2HPmHRiBvk6COSQEdSWNG0AsTnqO6ml7Osb+SIIyItNsEZ+O2RZNMRsmsHKDTlqw6hBgk7WFjmg3U4M2hNbYX1C/rSvEJRKed4DMgNVDV3mlLvoL6NIO3rKa6zf0Xb2UXKschZRy8CN+sk0ChoalOk3ENSfz4/PIOMN8rR3Nho/GwYRwllG9m+8+57r2N/Y3/cxzFRcxPuhBVqEjvx7khoxUrJy7tPfVXbh1lyVQ+ncgz1xxN/3lcS2+lXAigaZ0t0uH72Lmt8nQuzYfFZCl/LXBE2xRQ="
jobs:
fast_finish: true
include:
- stage: test
script: make test
env: GOARCH=amd64
go: "1.10.x"
- stage: test
script: make test
env: GOARCH=386
go: "1.10.x"
- stage: test
script: make test
env: GOARCH=amd64
go: "master"
- stage: test
script: make test
env: GOARCH=386
go: "master"
- stage: push to docker
script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- if [ -n "$TRAVIS_TAG" ]; then make TAG=$TRAVIS_TAG push; else make push; fi
go: "1.10.x"
if: branch = master AND NOT type = pull_request
- stage: push to packagecloud
script:
- if [ -n "$TRAVIS_TAG" ]; then curl -sL https://raw.githubusercontent.com/tsuru/push-to-packagecloud/master/push.sh | PACKAGE_NAME=deploy-agent bash; fi
go: "1.10.x"
env:
- GOARCH=amd64
- GO_FOR_RELEASE=1.10
if: tag IS present
matrix:
allow_failures:
- go: master
script:
- go test -x ./...
after_success:
- if [ -n "$TRAVIS_TAG" ]; then curl -sL https://raw.githubusercontent.com/tsuru/push-to-packagecloud/master/push.sh | PACKAGE_NAME=deploy-agent bash; fi
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
TAG=latest
BINARY=deploy-agent
IMAGE=tsuru/$(BINARY)

.PHONY: build-docker push test

build-docker:
docker build --rm -t $(IMAGE):$(TAG) .

push: build-docker
docker push $(IMAGE):$(TAG)

test:
go test ./... -coverprofile=

0 comments on commit ad565f4

Please sign in to comment.