mirror of
https://github.com/elyby/chrly.git
synced 2024-11-23 05:33:18 +05:30
64 lines
1.8 KiB
YAML
64 lines
1.8 KiB
YAML
os: linux
|
|
dist: xenial
|
|
language: go
|
|
go:
|
|
- "1.14"
|
|
|
|
stages:
|
|
- Tests
|
|
- name: Deploy
|
|
if: env(TRAVIS_PULL_REQUEST) IS false AND (branch = master OR tag IS present) AND commit_message !~ /(\[skip deploy\])/
|
|
|
|
install:
|
|
- go get -u github.com/golang/dep/cmd/dep
|
|
- dep ensure
|
|
|
|
cache:
|
|
directories:
|
|
- $GOPATH/pkg/dep
|
|
|
|
jobs:
|
|
include:
|
|
# Tests stage
|
|
- name: Unit tests
|
|
stage: Tests
|
|
services:
|
|
- redis
|
|
script:
|
|
- go test -v -race --tags redis -coverprofile=coverage.txt -covermode=atomic ./...
|
|
- bash <(curl -s https://codecov.io/bash)
|
|
|
|
- name: FOSSA
|
|
stage: Tests
|
|
if: branch = master
|
|
before_script:
|
|
- curl https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | bash
|
|
script:
|
|
- fossa init
|
|
- fossa analyze
|
|
# Disable until https://github.com/fossas/fossa-cli/issues/596 will be resolved
|
|
# - fossa test
|
|
|
|
# Deploy stage
|
|
- name: Docker image
|
|
stage: Deploy
|
|
services:
|
|
- docker
|
|
script:
|
|
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
|
- export DOCKER_TAG="${TRAVIS_TAG:-dev}"
|
|
- export APP_VERSION="${TRAVIS_TAG:-dev-${TRAVIS_COMMIT:0:7}}"
|
|
- >
|
|
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64
|
|
go build
|
|
-o release/chrly
|
|
-ldflags "-extldflags '-static' -X github.com/elyby/chrly/version.version=$APP_VERSION -X github.com/elyby/chrly/version.commit=$TRAVIS_COMMIT"
|
|
main.go
|
|
- docker build -t elyby/chrly:$DOCKER_TAG .
|
|
- docker push elyby/chrly:$DOCKER_TAG
|
|
- |
|
|
if [ ! -z ${TRAVIS_TAG:+x} ]; then
|
|
docker tag elyby/chrly:$DOCKER_TAG elyby/chrly:latest
|
|
docker push elyby/chrly:latest
|
|
fi
|