forked from fstab/grok_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
100 lines (93 loc) · 2.63 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
language: go
go:
- 1.7
os:
- linux
- osx
env:
matrix:
- ONIG_VERSION=5.9.6 MODE=STATIC
- ONIG_VERSION=5.9.6 MODE=DYNAMIC
- ONIG_VERSION=DEFAULT
before_install:
- |
set -e ;
set -x ;
case "$ONIG_VERSION" in
"DEFAULT")
if [[ "$TRAVIS_OS_NAME" == "osx" ]] ; then
brew update ;
brew install fstab/oniguruma/oniguruma-5.9.6 ;
elif [[ "$TRAVIS_OS_NAME" == "linux" ]] ; then
sudo apt-get -qq update ;
sudo apt-get install libonig-dev ;
fi
;;
*)
PROJ_DIR=$(pwd) ;
cd /tmp ;
curl -sLO https://github.com/kkos/oniguruma/releases/download/v${ONIG_VERSION}/onig-${ONIG_VERSION}.tar.gz ;
tar xfz onig-${ONIG_VERSION}.tar.gz ;
cd onig-${ONIG_VERSION} ;
./configure && make && sudo make install ;
cd "${PROJ_DIR}" ;
;;
esac ;
if [[ "$TRAVIS_OS_NAME" == "linux" ]] ;
then
sudo ldconfig ;
fi ;
set +e ;
install:
- echo "nothing to do in install phase" ;
script:
- |
set -e ;
set -x ;
if [[ "$TRAVIS_OS_NAME" == "osx" ]] ;
then
LDD_COMMAND="otool -L" ;
else
LDD_COMMAND="ldd" ;
fi
case "$MODE" in
"STATIC")
if [[ "$TRAVIS_OS_NAME" == "osx" ]] ;
then
sed -i.bak 's;#cgo LDFLAGS: -L/usr/local/lib -lonig;#cgo LDFLAGS: /usr/local/lib/libonig.a;' exporter/oniguruma.go ;
fi ;
CGO_LDFLAGS=/usr/local/lib/libonig.a go test -v $(go list ./... | grep -v /vendor/) ;
CGO_LDFLAGS=/usr/local/lib/libonig.a go install . ;
if $LDD_COMMAND $GOPATH/bin/grok_exporter | grep libonig ;
then
echo "ERROR: Expected statically linked binary." >&2 ;
exit -1 ;
fi ;
./integration-test.sh ;
;;
*)
go test -v $(go list ./... | grep -v /vendor/) ;
go install . ;
if ! $LDD_COMMAND $GOPATH/bin/grok_exporter | grep libonig ;
then
echo "ERROR: Expected dynamically linked binary." >&2 ;
exit -1 ;
fi ;
;;
esac ;
set +e ;
after_success:
- |
set -e ;
set -x ;
if [[ "$TRAVIS_OS_NAME" == "linux" && "$ONIG_VERSION" == "DEFAULT" ]] ;
then
go get golang.org/x/tools/cmd/cover github.com/mattn/goveralls github.com/modocache/gover ;
go list ./... | grep -v /vendor/ | while read package ;
do
go test -covermode count -coverprofile=$(basename $package).coverprofile $package ;
done ;
gover && goveralls -coverprofile=gover.coverprofile -service=travis-ci ;
rm *.coverprofile ;
fi ;
set +e ;