Move Windows tests to Travis

This commit is contained in:
Ben Moss 2018-12-07 16:39:45 -05:00 committed by Ben Moss
parent 3fb464786f
commit 34b1b702dc
6 changed files with 27 additions and 38 deletions

View File

@ -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"
}
}
}

View File

@ -18,16 +18,22 @@ env:
matrix: matrix:
fast_finish: true fast_finish: true
include:
- os: windows
env: TARGET=amd64
go: 1.10.x
- os: windows
env: TARGET=amd64
go: 1.11.x
install: install:
- sudo apt-get install gcc-multilib gcc-mingw-w64 -y
- go get github.com/onsi/ginkgo/ginkgo - go get github.com/onsi/ginkgo/ginkgo
- go get github.com/containernetworking/cni/cnitool - go get github.com/containernetworking/cni/cnitool
script: script:
- | - |
if [ "${TARGET}" == "amd64" ]; then if [ "${TARGET}" == "amd64" ]; then
GOARCH="${TARGET}" ./test.sh GOARCH="${TARGET}" ./test_${TRAVIS_OS_NAME}.sh
else else
GOARCH="${TARGET}" ./build_linux.sh GOARCH="${TARGET}" ./build_linux.sh
fi fi

View File

@ -1,5 +1,4 @@
[![Linux Build Status](https://travis-ci.org/containernetworking/plugins.svg?branch=master)](https://travis-ci.org/containernetworking/plugins) [![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)
# plugins # plugins
Some CNI network plugins, maintained by the containernetworking team. For more information, see the individual READMEs. Some CNI network plugins, maintained by the containernetworking team. For more information, see the individual READMEs.

View File

@ -5,12 +5,11 @@ cd $(dirname "$0")
ORG_PATH="github.com/containernetworking" ORG_PATH="github.com/containernetworking"
export REPO_PATH="${ORG_PATH}/plugins" export REPO_PATH="${ORG_PATH}/plugins"
if [ ! -h gopath/src/${REPO_PATH} ]; then export GOPATH=$(mktemp -d)
mkdir -p gopath/src/${ORG_PATH} mkdir -p ${GOPATH}/src/${ORG_PATH}
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255 trap "{ rm -rf $GOPATH; }" EXIT
fi ln -s ${PWD} ${GOPATH}/src/${REPO_PATH} || exit 255
export GOPATH=${PWD}/gopath
export GO="${GO:-go}" export GO="${GO:-go}"
export GOOS=windows export GOOS=windows

14
test_windows.sh Executable file
View File

@ -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}"