diff --git a/.gitignore b/.gitignore index 9f11b75..53a04aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .idea/ +release/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..22d7f98 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +language: go +go: +- 1.9 +script: go vet +before_deploy: +- "./build.sh" +deploy: + provider: releases + api_key: + secure: po0qgaUP0fXGA2eJJeRYMV86rAdb0Lzpw404Dtl4p2XE+SF5yOAbIUKkXCApeg0ypx4dSPacTsRezTKmP/mVAH6mvVsxWxJli4Q0UIN502Jp0Hyl3tj43wTFUzIOfk1oMdUiUaRu8Hu4cyD++l6yXmS8YU5M+9mMxz2TcjZPcT6WMwh6vG1M0rv/JVrl+YQhpecpym9zaMiX4BHPS1Y1ILjgHRCF+/f19Tl8Y8MB/L/XeDK8pKhOW7AK01oN1vVDb6Wr/oEbEueuOMe2/0YFZd5HTugQUvMNfSV2LY5JJCtYCG+PJtjGoQc2ZfDeAj8l3xLhG/ppiCc0NTE6baBkhpPpppv8woBYCLtVqCaG33AF0OtYmK7TfzC6RKISr58iAnCW2bbkRkDLUm5iSRcM9d319MlmT3BCZ+tgngcM1dsF8hubpJNOta74zjTD3abINR6uXtAsJcG8dOfJa8MRpOdv1bi5YaEMCmn147HNjTmxuaMNc1lKwUjonbFEb6NT2gGO6yWn69VbClF1ln/eH+swEvum1degj+SlJYfcw/fGVuliVEZPNYLSOCfLHNVeXk0NGG4Xb430C3O66AnCBtjahbwdHyatxix6YlTQmOzwAwRmzn0jYqVIcDXZIWWItxI13wsrSg5VExKmtRDv4o43Bd76B/qQH7HQyBb+LuI= + skip_cleanup: true + file: + - release/kafka_connect_exporter-linux-amd64 + - release/kafka_connect_exporter-linux-amd64.sha256 + on: + repo: wakeful/kafka_connect_exporter + branch: master + tags: true diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..1aee4d8 --- /dev/null +++ b/build.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -e + +VERSION=$(git describe --tags --dirty) +GO_BUILD_CMD="go build -a -installsuffix cgo" +GO_BUILD_LDFLAGS="-s -w -X main.version=$VERSION" + +BUILD_PLATFORMS="linux" +BUILD_ARCHS="amd64" + +mkdir -p release + +for OS in ${BUILD_PLATFORMS[@]}; do + for ARCH in ${BUILD_ARCHS[@]}; do + NAME="./kafka_connect_exporter-$OS-$ARCH" + echo "Building for $OS/$ARCH" + GOARCH=$ARCH GOOS=$OS CGO_ENABLED=0 $GO_BUILD_CMD -ldflags "$GO_BUILD_LDFLAGS"\ + -o "release/$NAME" ./kafka_connect_exporter.go + shasum -a 256 "release/$NAME" > "release/$NAME".sha256 + done +done \ No newline at end of file