-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
120 lines (89 loc) · 3.78 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
language: go
sudo: false
go:
- 1.9.5
- 1.10.x
matrix:
fast_finish: true
allow_failures:
- go: tip
go_import_path: github.com/Encrypt-S/kauri-api
addons:
apt:
update: true
before_install:
# Install code coverage / coveralls tooling
- go get -u github.com/axw/gocov/gocov
- go get -u github.com/mattn/goveralls
- go get -u golang.org/x/tools/cmd/cover
# Install linter
- go get -u golang.org/x/lint/golint
# Install dependency management
- go get -u github.com/tools/godep
# Merge all subpackage code coverage reports into a single report
- go get -u github.com/modocache/gover
# Install cyclomatic dependency analysis tool
- go get -u github.com/fzipp/gocyclo
install:
- go get -t ./...
before_script:
# Print build info.
- echo $TRAVIS_COMMIT
- echo $TRAVIS_TAG
- echo $TRAVIS_BRANCH
- echo $TRAVIS_BUILD_NUMBER
- echo $TRAVIS_REPO_SLUG
# Lint project
- golint ./...
# Test if code was formatted with 'go fmt'
# Command will format code and return modified files
# fail if any have been modified.
- if [ -n "$(go fmt)" ]; then echo 'Code is not formatted with "go fmt"'; false; fi
# Perform static code analysys
- go tool vet -unsafeptr=false `go list ./... | grep -v vendor | sed -e "s,^,$GOPATH/src/,;s,.*:,,"`
# Fail builds when the cyclomatic complexity reaches 15 or more
- gocyclo -over 15 `find . -iname '*.go' | grep -v 'vendor' | grep -v '_test.go'`
script:
# go list supply import paths for all sub directories.
# Exclude vendor directory, we don't want to run tests and coverage for all dependencies every time,
# also including their coverage may introduce to much noice. Concentrate on the coverage of local packages.
# Execute go test on every local subpackage (resolved as dependencies) and generate covreage report for each.
# Check for race conditions
# Test packages pararell (xargs -P)
- go list ./... | grep -v vendor | xargs -n1 -I {} -P 4 go test -v -race -covermode=atomic -coverprofile=../../../{}/profile.coverprofile {}
after_success:
# Notify Discord build-status channel of success via webhook
- wget https://raw.githubusercontent.com/k3rn31p4nic/travis-ci-discord-webhook/master/send.sh
- chmod +x send.sh
- "./send.sh success $WEBHOOK_URL"
# Merge all coverage reports located in subdirectories and put them under: gover.coverprofile
- gover
# Send code coverage report to coveralls.io only after success
- goveralls -service=travis-ci -coverprofile=gover.coverprofile -repotoken $COVERALLS_TOKEN
after_failure:
# Notify Discord build-status channel of failure via webhook
- wget https://raw.githubusercontent.com/k3rn31p4nic/travis-ci-discord-webhook/master/send.sh
- chmod +x send.sh
- "./send.sh failure $WEBHOOK_URL"
# Customise builds
builds:
- main: ./app/main.go
- binary: kauri-api
goos:
- windows
- darwin
- linux
goarch:
- amd64
# Initiate deploy sequence via goreleaser
deploy:
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
condition: $TRAVIS_OS_NAME = linux
notifications:
email: false
env:
secure: pfgvIn/dxcLiboFyy5EAMpAMXT5bFNhm00XCpITU88c2WhG664v8ym9zi6Oa0R4iO3Ua+Bf52bLdEwjVJVch/Vxb+l4ZzCoGrpavTLdg6dTBe2FKxev1NKQmO7/ZJzVNR38BFQ/AeG6rCXhyChbRhLubsz2CpjLw1eH3qUZjqyPxp4Mx1HrENAjTyqTJN7MEMwFbN5a4wtUqDq7zshh8YL2IB2RvKH0VkT00pp+2K2uNEpGQ4V0AY1x9AB8UJ+dKk9as+qwdWWTjNPIkFLXGXlc6FaWQMtA0WQ/Yua5pxoYKecFJrxMSJEPMNSR/SCd6qsILg9dMUEpsMfLZLPUdMlEu/xN0FPm+vmHxyZQbcyRQZm0IxJu8Y7re9xz9IMy3zF0sRPi2Bm3dxE93jfDkPw/TyuUjX3aJt/ykOf7yCcu2pF0OiH7LoShwYbXzot+a6j6Zg1bviShe7oqCdtP9HgkoMlvb72MKn/9TAj5HR30T2CAOF8rdqIvnrGKu4BuURDAnKaR8dweWThWfr7/kYWce7O76HlcQ8iU5Lnt5hJ7wlyQM6wvk+M/4coRkC4SYFgPHjUwUUzocQI9Oyn5Dw+SBXJT+ViA6GpcpeY8Oa5SlfUWgkupaJEK46GSKlBage/8uz48YbUytFCOsIvM6ZgSI2kjxiIjgTp/Aaokepog=