-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy path.travis.yml
57 lines (51 loc) · 2.03 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
language: go
install:
- go get -u golang.org/x/lint/golint
# This is default if `install` not overridden:
- go get -t -v ./...
before_script:
- ./check_gofmt.sh
- go vet ./...
- golint -set_exit_status ./...
script: go test -v -race ./...
before_deploy:
- PLATFORMS=(darwin/386 darwin/amd64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm windows/386 windows/amd64)
# build binary for all archs
- go get -u ./...
- |
for PLATFORM in "${PLATFORMS[@]}"; do
echo "Building $PLATFORM"
GOOS=${PLATFORM%/*}
GOARCH=${PLATFORM#*/}
if [ "$GOOS" = "windows" ]; then
build_cmd="GOOS=$GOOS GOARCH=$GOARCH go build -o kafka_consumer_group_exporter -ldflags '-w -s' ./cmd/prometheus-kafka-consumer-group-exporter/kafka_consumer_group_exporter.go"
else
build_cmd="CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH go build -o kafka_consumer_group_exporter -ldflags '-d -w -s' ./cmd/prometheus-kafka-consumer-group-exporter/kafka_consumer_group_exporter.go"
fi
if ! eval $build_cmd; then
echo "Failed building kafka_consumer_group_exporter for $PLATFORM" && return 1
fi
if [ "$GOOS" = "windows" ]; then
zip kafka_consumer_group_exporter-${GOOS}-${GOARCH}.zip kafka_consumer_group_exporter
else
tar cvzf kafka_consumer_group_exporter-${GOOS}-${GOARCH}.tgz kafka_consumer_group_exporter
fi
done
- ls
deploy:
provider: releases
api_key: $GH_TOKEN
skip_cleanup: true
file:
- "kafka_consumer_group_exporter-darwin-386.tgz"
- "kafka_consumer_group_exporter-darwin-amd64.tgz"
- "kafka_consumer_group_exporter-freebsd-386.tgz"
- "kafka_consumer_group_exporter-freebsd-arm.tgz"
- "kafka_consumer_group_exporter-freebsd-amd64.tgz"
- "kafka_consumer_group_exporter-linux-386.tgz"
- "kafka_consumer_group_exporter-linux-arm.tgz"
- "kafka_consumer_group_exporter-linux-amd64.tgz"
- "kafka_consumer_group_exporter-windows-386.zip"
- "kafka_consumer_group_exporter-windows-amd64.zip"
on:
tags: yes