-
Notifications
You must be signed in to change notification settings - Fork 31
/
.travis.yml
72 lines (72 loc) · 2.2 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
72
sudo: required
language: go
go:
- "1.11.x"
services:
- docker
stages:
- build_test
- build_test_release_publish
- deploy
git:
submodules: false
quiet: false
deploy:
provider: releases
api_key: ${GITHUB_OAUTH_TOKEN}
file_glob: true
file: bin/${BINARY_FILENAME}-*
skip_cleanup: true
on:
branch: master
tags: true
before_script:
- echo "DOCKER_IMAGE_REGISTRY=${DOCKER_IMAGE_REGISTRY}" > Makefile.properties
- echo "DOCKER_IMAGE_NAMESPACE=${DOCKER_IMAGE_NAMESPACE}" >> Makefile.properties
- echo "DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME}" >> Makefile.properties
- echo "DOCKER_REGISTRY_USERNAME=${DOCKER_REGISTRY_USERNAME}" >> Makefile.properties
- echo "DOCKER_REGISTRY_PASSWORD=${DOCKER_REGISTRY_PASSWORD}" >> Makefile.properties
- echo "GITHUB_REPOSITORY_URL=${GITHUB_REPOSITORY_URL}" >> Makefile.properties
- touch ~/.ssh/id_rsa
- |
if [ "${GITHUB_SSH_DEPLOY_KEY}" != "" ]; then
printf -- "${GITHUB_SSH_DEPLOY_KEY}" | base64 -d >> ~/.ssh/id_rsa;
chmod 600 ~/.ssh/id_rsa;
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts;
fi;
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build -d
after_script:
- ./cc-test-reporter after-build -d
- rm -rf Makefile.properties ~/.ssh/id_rsa
jobs:
include:
- stage: build_test
if: branch != master AND (type IN (push)) AND (tag IS blank)
script:
- make test.ci
- make docker
- stage: build_test_release
if: branch = master AND (type IN (push)) AND (tag IS blank)
script:
- make test.ci
- make docker
- make godev
after_success:
- |
if [ "${GITHUB_REPOSITORY_URL}" != "" ] && [ "{GITHUB_SSH_DEPLOY_KEY}" != "" ]; then
make release.github BUMP=${VERSION_BUMP};
fi;
- stage: publish
if: (tag IS NOT blank)
script:
- make deps
- make test.ci
- make godev
- |
if [ "${DOCKER_REGISTRY_USERNAME}" != "" ] && [ "${DOCKER_REGISTRY_PASSWORD}" != "" ]; then
docker login ${DOCKER_IMAGE_REGISTRY} -u ${DOCKER_REGISTRY_USERNAME} -p ${DOCKER_REGISTRY_PASSWORD};
make release.docker;
docker logout;
fi;