ソースを参照

Added travis magic

Steve Kemp 6 年 前
コミット
f902fee556
2 ファイル変更57 行追加0 行削除
  1. 11 0
      .travis.yml
  2. 46 0
      .travis/build-all

+ 11 - 0
.travis.yml

@@ -0,0 +1,11 @@
+language: go
+sudo: false
+matrix:
+  include:
+  - go: tip
+  allow_failures:
+  - go: tip
+before_script:
+  - go vet ./...
+script:
+- "./.travis/build-all"

+ 46 - 0
.travis/build-all

@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# The basename of our binary
+BASE="rss2hook"
+
+# Get the dependencies
+go get -t -v -d $(go list ./...)
+
+#
+# We build on only a single platform/arch: CGO is hard
+#
+BUILD_PLATFORMS="linux"
+BUILD_ARCHS="amd64"
+
+# For each platform
+for OS in ${BUILD_PLATFORMS[@]}; do
+
+    # For each arch
+    for ARCH in ${BUILD_ARCHS[@]}; do
+
+        # Setup a suffix for the binary
+        SUFFIX="${OS}"
+
+        # i386 is better than 386
+        if [ "$ARCH" = "386" ]; then
+            SUFFIX="${SUFFIX}-i386"
+        else
+            SUFFIX="${SUFFIX}-${ARCH}"
+        fi
+
+        # Windows binaries should end in .EXE
+        if [ "$OS" = "windows" ]; then
+            SUFFIX="${SUFFIX}.exe"
+        fi
+
+        echo "Building for ${OS} [${ARCH}] -> ${BASE}-${SUFFIX}"
+
+        # Run the build
+        export GOARCH=${ARCH}
+        export GOOS=${OS}
+        export CGO_ENABLED=1
+
+        go build -ldflags "-X main.version=$(git describe --tags)" -o "${BASE}-${SUFFIX}"
+
+    done
+done