-
Notifications
You must be signed in to change notification settings - Fork 4
/
.travis.yml
69 lines (60 loc) · 1.78 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
language: go
go:
- 1.9
# https://golang.org/doc/install/source#environment
env:
- BUILD_GOOS=darwin BUILD_GOARCH=amd64
- BUILD_GOOS=linux BUILD_GOARCH=386
- BUILD_GOOS=linux BUILD_GOARCH=amd64
before_install:
- echo " >>> downloading dep"
- go get -u github.com/golang/dep/cmd/dep
install:
- echo " >>> downloading dependencies"
- dep ensure
- dep status
before_script:
- echo " >>> preparing build informations"
- PROJECT_NAME=$(echo ${TRAVIS_REPO_SLUG} | cut -d "/" -f 2)
- |
OUTPUT_NAME=${PROJECT_NAME}-${BUILD_GOOS}-${BUILD_GOARCH}
if [ ${BUILD_GOOS} = "windows" ]; then
OUTPUT_NAME+='.exe'
fi
- |
APP_VERSION=${TRAVIS_BRANCH}-$(git rev-parse --short ${TRAVIS_COMMIT})
if [ -n "${TRAVIS_TAG}" ]; then
APP_VERSION=${TRAVIS_TAG}
fi
- echo " >>> build version ${APP_VERSION}"
script:
- echo " >>> Building ${OUTPUT_NAME}"
- go test -race -covermode=atomic ./...
- env CGO_ENABLED=0 GOOS=${BUILD_GOOS} GOARCH=${BUILD_GOARCH} go build -a -installsuffix cgo -x -ldflags "-X main.version=${APP_VERSION}" -o ${OUTPUT_NAME} cmd/*.go
- tar -cvzf ${OUTPUT_NAME}.tar.gz ${OUTPUT_NAME}
after_success:
- echo " >>> upload codecoverage"
- bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN}
- echo " >>> test hydra"
- ./${OUTPUT_NAME} --version
before_deploy:
- shasum -a 256 ${OUTPUT_NAME}.tar.gz
- mkdir -p build/${TRAVIS_TAG} && shasum -a 256 ${OUTPUT_NAME}.tar.gz | awk '{print $1}' > build/${TRAVIS_TAG}/${OUTPUT_NAME}.tar.gz.sha265
deploy:
- provider: releases
api_key: ${GITHUB_API_KEY}
#prerelease: true
file:
- ${OUTPUT_NAME}.tar.gz
skip_cleanup: true
on:
tags: true
- provider: s3
region: "eu-central-1"
bucket: "benkeil-hydra"
access_key_id: ${AWS_ACCESS_KEY}
secret_access_key: ${AWS_ACCESS_SECRET}
local_dir: build
skip_cleanup: true
on:
tags: true