-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
61 lines (61 loc) · 2.48 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
# ARTIFACT_PUBLICATION use this constant only once per OS to ensure that
# the artifacts are only published once per OS, e.g. linux, osx and
# windows.
language: go
go:
- 1.14.2
env:
global:
- ARTIFACT_PUBLICATION=true
- SHA512_CMD=sha512sum
- GO111MODULE=on
- NEXUS_API_VERSION=v1
- NEXUS_VERSION=3.21.1
- SHA512_CMD=sha512sum
matrix:
include:
- os: linux
dist: bionic
env:
- NEXUS_VERSION=latest
- os: linux
dist: bionic
env:
- ARTIFACT_PUBLICATION=false
- NEXUS_VERSION=3.21.1
- os: linux
dist: bionic
env:
- ARTIFACT_PUBLICATION=false
- NEXUS_VERSION=3.9.0
- NEXUS_API_VERSION=beta
- os: osx
env:
- SHA512_CMD="shasum -a 512"
- os: windows
addons:
sonarcloud:
organization: 030-github
token: $SONAR_TOKEN
before_script:
- 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 update -y && sudo apt-get -y install ./a2deb.deb bats; fi
script:
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.23.7-alpine golangci-lint run -v; fi
- export DELIVERABLE="n3dr-${TRAVIS_OS_NAME}"
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$ARTIFACT_PUBLICATION" ]; then go test -short -cover -v -coverprofile=coverage.txt -covermode=atomic ./...; fi
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install zip -y; fi
- if [ $TRAVIS_OS_NAME == linux ]; then ./integration-tests.sh $NEXUS_VERSION $NEXUS_API_VERSION ./${DELIVERABLE}; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$ARTIFACT_PUBLICATION" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then sonar-scanner -Dsonar.projectKey=030_n3dr -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.coverage.exclusions=cmd/**,**/*_test.go -Dsonar.go.coverage.reportPaths="coverage.txt"; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$ARTIFACT_PUBLICATION" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then bash <(curl -s https://codecov.io/bash); fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ -n "${TRAVIS_TAG}" ]; then cp $DELIVERABLE n3dr && a2deb -app n3dr -version ${TRAVIS_TAG} -maintainer "030 <[email protected]>" -description "Nexus3 backup and recovery tool"; fi
deploy:
provider: releases
api_key: $GITHUB_TOKEN
file:
- n3dr_${TRAVIS_TAG}-0.deb
- $DELIVERABLE
- ${DELIVERABLE}.sha512.txt
skip_cleanup: true
on:
tags: true
condition: $ARTIFACT_PUBLICATION == true