This repository has been archived by the owner on Dec 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
39 lines (39 loc) · 1.66 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
language: go
go:
- 1.15.4
env:
global:
- SHA512_CMD=sha512sum
- GO111MODULE=on
matrix:
include:
- os: linux
dist: bionic
- os: osx
env: SHA512_CMD="shasum -a 512"
- os: windows
addons:
sonarcloud:
organization: 030-github
token: $SONAR_TOKEN
before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then curl -L https://github.com/030/a2deb/releases/download/1.0.0/a2deb_1.0.0-0.deb -o a2deb.deb && sudo apt-get -y install ./a2deb.deb; fi
script:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.21.0 golangci-lint run -v; fi
- export DELIVERABLE="go-yq-${TRAVIS_OS_NAME}"
- go test -short -cover -v -coverprofile=coverage.out -covermode=atomic ./...
- CGO_ENABLED=0 go build -o $DELIVERABLE
- $SHA512_CMD $DELIVERABLE > ${DELIVERABLE}.sha512.txt
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then sonar-scanner -Dsonar.projectKey=030_go-yq -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.coverage.exclusions=**/*_test.go -Dsonar.go.coverage.reportPaths="coverage.out"; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then bash <(curl -s https://codecov.io/bash); fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ -n "${TRAVIS_TAG}" ]; then cp $DELIVERABLE go-yq && a2deb -app go-yq -version ${TRAVIS_TAG} -maintainer "030 <[email protected]>" -description "jq-style golang equivalent of yq"; fi
deploy:
provider: releases
api_key: $GITHUB_TOKEN
file:
- go-yq_${TRAVIS_TAG}-0.deb
- $DELIVERABLE
- ${DELIVERABLE}.sha512.txt
skip_cleanup: true
on:
tags: true