From 34b1b702dcbbac9716d2c6d665b2616bab5e8a6a Mon Sep 17 00:00:00 2001 From: Ben Moss Date: Fri, 7 Dec 2018 16:39:45 -0500 Subject: [PATCH] Move Windows tests to Travis --- .appveyor.yml | 29 ----------------------------- .travis.yml | 10 ++++++++-- README.md | 3 +-- build_windows.sh | 9 ++++----- test.sh => test_linux.sh | 0 test_windows.sh | 14 ++++++++++++++ 6 files changed, 27 insertions(+), 38 deletions(-) delete mode 100644 .appveyor.yml rename test.sh => test_linux.sh (100%) create mode 100755 test_windows.sh diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 1133a06ee..000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,29 +0,0 @@ -clone_folder: c:\gopath\src\github.com\containernetworking\plugins - -environment: - GOPATH: c:\gopath - -install: - - echo %PATH% - - echo %GOPATH% - - go version - - go env - - ps: $webClient = New-Object System.Net.WebClient; $InstallPath="c:" ; $webClient.DownloadFile("https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/gcc.zip", "$InstallPath\gcc.zip"); Expand-Archive $InstallPath\gcc.zip -DestinationPath $InstallPath\gcc -Force; $webClient.DownloadFile("https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/runtime.zip", "$InstallPath\runtime.zip"); Expand-Archive $InstallPath\runtime.zip -DestinationPath $InstallPath\gcc -Force; $webClient.DownloadFile("https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/binutils.zip","$InstallPath\binutils.zip"); Expand-Archive $InstallPath\binutils.zip -DestinationPath $InstallPath\gcc -Force; - - set PATH=%GOPATH%\bin;c:\go\bin;c:\gcc\bin;%PATH% - -build: off - -test_script: - - ps: | - go list ./... | Select-String -Pattern (Get-Content "./plugins/windows_only.txt") > "to_test.txt" - echo "Will test:" - Get-Content "to_test.txt" - foreach ($pkg in Get-Content "to_test.txt") { - if ($pkg) { - echo $pkg - go test -v $pkg - if ($LastExitCode -ne 0) { - throw "test failed" - } - } - } diff --git a/.travis.yml b/.travis.yml index 7a7ef5394..aa18b8ce9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,16 +18,22 @@ env: matrix: fast_finish: true + include: + - os: windows + env: TARGET=amd64 + go: 1.10.x + - os: windows + env: TARGET=amd64 + go: 1.11.x install: - - sudo apt-get install gcc-multilib gcc-mingw-w64 -y - go get github.com/onsi/ginkgo/ginkgo - go get github.com/containernetworking/cni/cnitool script: - | if [ "${TARGET}" == "amd64" ]; then - GOARCH="${TARGET}" ./test.sh + GOARCH="${TARGET}" ./test_${TRAVIS_OS_NAME}.sh else GOARCH="${TARGET}" ./build_linux.sh fi diff --git a/README.md b/README.md index 6b11c83c0..da759235c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -[![Linux Build Status](https://travis-ci.org/containernetworking/plugins.svg?branch=master)](https://travis-ci.org/containernetworking/plugins) -[![Windows Build Status](https://ci.appveyor.com/api/projects/status/kcuubx0chr76ev86/branch/master?svg=true)](https://ci.appveyor.com/project/cni-bot/plugins/branch/master) +[![Build Status](https://travis-ci.org/containernetworking/plugins.svg?branch=master)](https://travis-ci.org/containernetworking/plugins) # plugins Some CNI network plugins, maintained by the containernetworking team. For more information, see the individual READMEs. diff --git a/build_windows.sh b/build_windows.sh index 02b946f5b..010f902d6 100755 --- a/build_windows.sh +++ b/build_windows.sh @@ -5,12 +5,11 @@ cd $(dirname "$0") ORG_PATH="github.com/containernetworking" export REPO_PATH="${ORG_PATH}/plugins" -if [ ! -h gopath/src/${REPO_PATH} ]; then - mkdir -p gopath/src/${ORG_PATH} - ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255 -fi +export GOPATH=$(mktemp -d) +mkdir -p ${GOPATH}/src/${ORG_PATH} +trap "{ rm -rf $GOPATH; }" EXIT +ln -s ${PWD} ${GOPATH}/src/${REPO_PATH} || exit 255 -export GOPATH=${PWD}/gopath export GO="${GO:-go}" export GOOS=windows diff --git a/test.sh b/test_linux.sh similarity index 100% rename from test.sh rename to test_linux.sh diff --git a/test_windows.sh b/test_windows.sh new file mode 100755 index 000000000..36610dd83 --- /dev/null +++ b/test_windows.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# +# Run CNI plugin tests. +# +set -e + +source ./build_windows.sh + +echo "Running tests" + +PLUGINS=$(cat plugins/windows_only.txt | tr '\n' ' ') +GINKGO_FLAGS="-p -r --randomizeAllSpecs --randomizeSuites --failOnPending --progress pkg/hns $PLUGINS" + +bash -c "cd ${GOPATH}/src/${REPO_PATH}; PATH='${GOROOT}/bin:$(pwd)/bin:${PATH}' ginkgo ${GINKGO_FLAGS}"