-
Notifications
You must be signed in to change notification settings - Fork 132
/
.travis.yml
71 lines (63 loc) · 2.95 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
language: go
sudo: required
services:
- docker
env:
global:
- APP_NAME=shell2http
- CURRENT_GO_VERSION="1.8"
go:
- 1.7.x
- 1.8.x
- master
before_install:
- go get github.com/mattn/goveralls
- go get github.com/philwinder/gocoverage
- go get github.com/kisielk/errcheck
install: go get -t ./...
script:
- go test -race -v ./...
- go vet ./...
- errcheck ./...
- diff <(gofmt -d .) <(echo -n "")
- if [[ $TRAVIS_GO_VERSION =~ $CURRENT_GO_VERSION ]]; then
gocoverage && goveralls -coverprofile=profile.cov -service=travis-ci || true;
fi
after_success:
- if [[ $TRAVIS_GO_VERSION =~ $CURRENT_GO_VERSION ]] && [[ $TRAVIS_BRANCH == "master" || -n $TRAVIS_TAG ]] && [[ $TRAVIS_EVENT_TYPE == "push" ]]; then
docker login -u="$DOCKER_USERNAME" -p="$(echo $DOCKER_PASSWORD | base64 -d)" &&
docker login -u="$QUAY_USERNAME" -p="$QUAY_PASSWORD" quay.io &&
docker run --rm -v $PWD:/go/src/$APP_NAME -w /go/src/$APP_NAME golang:alpine sh -c "apk add --no-cache git && go get ./... && go build -ldflags='-w -s' -o $APP_NAME" &&
docker build -t $DOCKER_USERNAME/$APP_NAME:latest . &&
docker tag $DOCKER_USERNAME/$APP_NAME:latest quay.io/$DOCKER_USERNAME/$APP_NAME:latest &&
docker push $DOCKER_USERNAME/$APP_NAME:latest &&
docker push quay.io/$DOCKER_USERNAME/$APP_NAME:latest;
if [[ -n $TRAVIS_TAG ]]; then
docker tag $DOCKER_USERNAME/$APP_NAME:latest $DOCKER_USERNAME/$APP_NAME:$TRAVIS_TAG &&
docker tag $DOCKER_USERNAME/$APP_NAME:latest quay.io/$DOCKER_USERNAME/$APP_NAME:$TRAVIS_TAG &&
docker push $DOCKER_USERNAME/$APP_NAME:$TRAVIS_TAG &&
docker push quay.io/$DOCKER_USERNAME/$APP_NAME:$TRAVIS_TAG;
fi;
rm -f $APP_NAME;
fi
before_deploy:
- curl -SL https://raw.githubusercontent.com/msoap/etc/master/golang-cross-build/golang-cross-build.sh > $GOPATH/bin/golang-cross-build.sh
- chmod 700 $GOPATH/bin/golang-cross-build.sh
- gem install --no-ri --no-rdoc fpm
- golang-cross-build.sh $APP_NAME
- ls -l *.zip *.tar.gz *.deb
deploy:
provider: releases
api_key:
secure: dXAy5WWWVozf+prMJNjQT6s4JqAXZEyOZ+LeaBzz8k7WZzCvHaLg+qdIpXbIL0G/hc7hW9WEhj/apcjiodwPhqKjy52dw3bUclHqUxxR5ZvgyZyb7qyyLoPqDtygHgGMX+UANgkMTUIM3auP/W6jvmV5mc7ddTZah+z+l542J6AdDOs+m97dlqNLdlz5AdCr5uY0O2sIsmpD4WFxINsdcG67Lj6V9HK8fzlCz0aGeKvcapgF1r4iXxWxvwSGMJwdljYKGyX2wm5Sp2Q7IklX/zNPAPJZtthUvbaaDUMkmYjb6YcAPmFZ1IhtFkpurNzNGfKCSz7784ZEf1b+dDYLNAKwv6hG1YKLadFoplecaH0xLcYwBZvwq9pDaJpX20I5sbNQDyEOCjrBaxB1RyCr/m9m8tOXZzfn6YIUHAbimhL4g98smQ797fQn4/zquSeKkqF2mMA5v5hLdXI2snwK/e2zDxTCwpw4NNyxjY6PgXO61vL4EE8Xq6nl+rKDZ7B+BXWHmP5kxuxHHVpYZPKUnQUmpbUkD62RM5hZbJ6+h07WF3wVvgFc+l8aNK8W+uWff5OZBbyV7mWdfpHtxVR0xSG/6eGIiCVJ6cFLyjV2JRQHk9x+aZKSEErfkuYawyt+tIl7OtsqBNBtYHE4ARgvwb7uPbX4EgTpcQmOsRCNBsQ=
file_glob: "true"
file:
- "*.zip"
- "*.tar.gz"
- "*.deb"
skip_cleanup: true
on:
tags: true
branch: master
condition: $TRAVIS_GO_VERSION =~ $CURRENT_GO_VERSION
repo: msoap/$APP_NAME