chrly/.travis.yml

43 lines
1.1 KiB
YAML
Raw Normal View History

2018-02-16 00:46:20 +03:00
sudo: required
language: go
go:
- 1.12
2018-02-16 00:46:20 +03:00
services:
- docker
stages:
- test
2018-02-16 20:58:29 +03:00
- name: deploy
if: branch = master OR tag IS present
2018-02-16 00:46:20 +03:00
2018-02-16 20:58:29 +03:00
install:
2018-02-16 00:46:20 +03:00
- go get -u github.com/golang/dep/cmd/dep
2018-02-16 20:58:29 +03:00
- dep ensure
2018-02-16 00:46:20 +03:00
jobs:
include:
- stage: test
script:
2019-04-30 14:31:04 +03:00
- go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- bash <(curl -s https://codecov.io/bash)
2018-02-16 20:58:29 +03:00
- stage: deploy
2018-02-16 00:46:20 +03:00
script:
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
2018-02-16 20:58:29 +03:00
- export DOCKER_TAG="${TRAVIS_TAG:-dev}"
- export APP_VERSION="${TRAVIS_TAG:-dev-${TRAVIS_COMMIT:0:7}}"
2018-02-16 00:46:20 +03:00
- >
2018-02-17 01:25:24 +03:00
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64
2018-02-16 00:46:20 +03:00
go build
-o release/chrly
-ldflags '-extldflags "-static" -X github.com/elyby/chrly/bootstrap.version=$APP_VERSION'
2018-02-16 00:46:20 +03:00
main.go
2018-02-16 20:58:29 +03:00
- docker build -t elyby/chrly:$DOCKER_TAG .
- docker push elyby/chrly:$DOCKER_TAG
- |
2018-02-17 02:21:03 +03:00
if [ ! -z ${TRAVIS_TAG+x} ] && [[ "$TRAVIS_TAG" != *"-"* ]]; then
2018-02-16 20:58:29 +03:00
docker tag elyby/chrly:$DOCKER_TAG elyby/chrly:latest
docker push elyby/chrly:latest
fi