forked from fstab/grok_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
115 lines (106 loc) · 3.1 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
language: go
# go 1.13 is default on ubuntu 20.10 LTS
# go 1.15 is the latest version, and the version used for the latest release
go:
- "1.13"
- "1.15"
os:
- linux
- osx
dist:
- focal
# oniguruma 5.9.6 was the default for a long time, and has slightly different API
# oniguruma 6.9.4 is the current default on ubuntu 20.10 LTS
# oniguruma 6.9.5-rev1 is the latest version, and the version used for the latest release
env:
matrix:
- ONIG_VERSION=5.9.6 MODE=STATIC
- ONIG_VERSION=6.9.4 MODE=STATIC
- ONIG_VERSION=6.9.4 MODE=STATIC
- ONIG_VERSION=6.9.5-rev1 MODE=STATIC
- ONIG_VERSION=DEFAULT MODE=DYNAMIC
before_install:
- |
set -e ;
set -x ;
if [[ "$TRAVIS_OS_NAME" == "osx" ]] ; then
# Workaround for broken OS X build, see https://github.com/travis-ci/travis-ci/issues/8703
unset -f cd ;
fi
case "$ONIG_VERSION" in
"DEFAULT")
if [[ "$TRAVIS_OS_NAME" == "osx" ]] ; then
brew update ;
brew install oniguruma ;
elif [[ "$TRAVIS_OS_NAME" == "linux" ]] ; then
sudo apt-get -qq update ;
sudo apt-get install libonig-dev ;
fi
;;
"6.9.5-rev1")
PROJ_DIR=$(pwd) ;
cd /tmp ;
curl -sLO https://github.com/kkos/oniguruma/releases/download/v6.9.5_rev1/onig-6.9.5-rev1.tar.gz ;
tar xfz onig-6.9.5-rev1.tar.gz ;
cd onig-6.9.5 ;
./configure && make && sudo make install ;
cd "${PROJ_DIR}" ;
;;
*)
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;' oniguruma/oniguruma.go ;
fi ;
CGO_LDFLAGS=/usr/local/lib/libonig.a go test -count=1 -v ./... ;
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 ;
./hack/smoke-test.sh ;
;;
"DYNAMIC")
go test -failfast -count=1 -v ./... ;
go install ;
if ! $LDD_COMMAND $GOPATH/bin/grok_exporter | grep libonig ;
then
echo "ERROR: Expected dynamically linked binary." >&2 ;
exit -1 ;
fi ;
./hack/smoke-test.sh ;
;;
*)
echo "Unknown mode $MODE" >&2 ;
exit 1 ;
;;
esac ;
set +e ;