travis integration
authorGabe Rosenhouse <grosenhouse@pivotal.io>
Wed, 3 May 2017 17:07:29 +0000 (10:07 -0700)
committerGabe Rosenhouse <grosenhouse@pivotal.io>
Wed, 3 May 2017 19:22:14 +0000 (12:22 -0700)
- go build instead of go install to support cross-compile to bin dir
- shellcheck fixes for build script

.travis.yml [new file with mode: 0644]
build

diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..d0640b8
--- /dev/null
@@ -0,0 +1,41 @@
+language: go
+sudo: required
+dist: trusty
+
+go:
+  - 1.7.x
+  - 1.8.x
+
+env:
+  global:
+  - PATH=$GOROOT/bin:$PATH
+  matrix:
+  - TARGET=amd64
+  - TARGET=arm
+  - TARGET=arm64
+  - TARGET=ppc64le
+  - TARGET=s390x
+
+matrix:
+  fast_finish: true
+
+install:
+ - |
+   go get github.com/containernetworking/cni || true
+   pushd ../cni
+     GOARCH="${TARGET}" ./build.sh
+   popd
+
+script:
+ - |
+   if [ "${TARGET}" == "amd64" ]; then
+     CNI_PATH="$(cd ../cni/bin && pwd)" GOARCH="${TARGET}" ./test
+   else
+     GOARCH="${TARGET}" ./build
+   fi
+
+notifications:
+  email: false
+
+git:
+  depth: 9999999
diff --git a/build b/build
index 8b1f39a..14d8abe 100755 (executable)
--- a/build
+++ b/build
@@ -12,15 +12,15 @@ fi
 export GO15VENDOREXPERIMENT=1
 export GOPATH=${PWD}/gopath
 
-mkdir -p ${PWD}/bin
+mkdir -p "${PWD}/bin"
 
 echo "Building plugins"
 PLUGINS="plugins/*"
 for d in $PLUGINS; do
-       if [ -d $d ]; then
-               plugin=$(basename $d)
-               echo "  " $plugin
+       if [ -d "$d" ]; then
+               plugin="$(basename "$d")"
+               echo "  $plugin"
                # use go install so we don't duplicate work
-               GOBIN=${PWD}/bin go install -pkgdir $GOPATH/pkg "$@" $REPO_PATH/$d
+               go build -o "${PWD}/bin/$plugin" -pkgdir "$GOPATH/pkg" "$@" "$REPO_PATH/$d"
        fi
 done