Travis Windows (#519)

* Make Travis run Windows tests
* Simplify git checkout
This commit is contained in:
Egon Elbre 2018-10-24 14:51:49 +03:00 committed by GitHub
parent fb5ccbc407
commit 2bb2c50d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 9 deletions

View File

@ -1,7 +1,7 @@
language: go
go:
- 1.11.x
go: 1.11.x
go_import_path: "storj.io/storj"
git:
depth: 1
@ -23,9 +23,11 @@ before_script:
before_install:
- source scripts/setup-gopath.sh
matrix:
allow_failures:
- os: windows # allow failures on windows because it's slow
include:
### tests ###
- env: MODE=tests
install:
- pushd ~
@ -35,16 +37,36 @@ matrix:
script:
- go test -race -cover -coverprofile=.coverprofile ./...
- goveralls -coverprofile=.coverprofile -service=travis-ci
### run linters ###
- env: MODE=lint
install:
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b ${GOPATH}/bin v1.10.2
script:
- ./scripts/check-for-header.sh
- golangci-lint run
### captplanet tests ###
- env: MODE=integration
install:
- source scripts/install-awscli.sh
- go install storj.io/storj/cmd/captplanet
script:
- make test-captplanet
### windows tests ###
- env: MODE=windows-tests
os: windows
cache:
directories:
- "%HOME%/cache"
before_install:
- powershell -executionpolicy bypass -File scripts/setup-gopath.ps1
install:
- go get github.com/mattn/goveralls
- go install -race ./...
script:
- go test -race -cover -coverprofile=.coverprofile ./...
- goveralls -coverprofile=.coverprofile -service=travis-ci
fast_finish: true

28
scripts/setup-gopath.ps1 Normal file
View File

@ -0,0 +1,28 @@
$xhome = $env:USERPROFILE
Set-Location $xhome
New-Item "$xhome/bin" -Force -ItemType "directory"
New-Item "$xhome/cache" -Force -ItemType "directory"
$env:PATH=$env:PATH + ";$xhome/bin"
$env:GOSPACE_ROOT="$env:GOPATH"
$env:GOSPACE_PKG="storj.io/storj"
$env:GOSPACE_REPO="git@github.com:storj/storj.git"
# setup gospace
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
Invoke-WebRequest -Uri "https://github.com/storj/gospace/releases/download/v0.0.1/gospace_windows_amd64.exe" -OutFile "$xhome/bin/gospace.exe"
# find module dependency hash
$modhash = gospace hash
# download dependencies, if we don't have them in cache
if (!(Test-Path $xhome/cache/$modhash.zip)) {
gospace zip-vendor $xhome/cache/$modhash.zip
}
# unpack the dependencies into gopath
gospace unzip-vendor $xhome/cache/$modhash.zip
gospace flatten-vendor

View File

@ -7,9 +7,6 @@ export GOSPACE_ROOT=$GOPATH
export GOSPACE_PKG=storj.io/storj
export GOSPACE_REPO=git@github.com:storj/storj/git
mkdir -p $GOPATH/src/storj.io
mv $GOPATH/src/github.com/storj/storj $GOPATH/src/storj.io
# setup gospace
wget -O ~/bin/gospace https://github.com/storj/gospace/releases/download/v0.0.1/gospace_linux_amd64
chmod +x ~/bin/gospace
@ -26,7 +23,4 @@ fi
gospace unzip-vendor $HOME/cache/$MODHASH.zip
gospace flatten-vendor
export TRAVIS_BUILD_DIR=$GOPATH/src/storj.io/storj
cd $TRAVIS_BUILD_DIR
set +x