diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 000000000..175bf4dee --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,30 @@ +version: "{build}" + +image: Visual Studio 2017 + +clone_folder: c:\gopath\src\github.com\containerd\containerd + +environment: + GOPATH: C:\gopath + CGO_ENABLED: 1 + +before_build: + - choco install -y mingw + - choco install codecov + +build_script: + - bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe fmt" + - bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe vet" + - bash.exe -lc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe build" + - bash.exe -lc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe binaries" + +test_script: + # TODO: need an equivalent of TRAVIS_COMMIT_RANGE + # - GIT_CHECK_EXCLUDE="./vendor" TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE/.../..}" C:\MinGW\bin\mingw32-make.exe dco + - bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe integration" + - bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe coverage" + - bash.exe -lc "export PATH=/c/tools/mingw64/bin:/c/gopath/src/github.com/containerd/containerd/bin:$PATH ; mingw32-make.exe root-coverage" + +on_success: + # Note that, a Codecov upload token is not required. + - codecov -f coverage.txt diff --git a/Makefile b/Makefile index 135d38ffe..6d0bae844 100644 --- a/Makefile +++ b/Makefile @@ -9,15 +9,18 @@ VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always) REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi) ifneq "$(strip $(shell command -v go 2>/dev/null))" "" -GOOS ?= $(shell go env GOOS) + GOOS ?= $(shell go env GOOS) else -GOOS ?= $$GOOS + GOOS ?= $$GOOS endif + WHALE = "🇩" ONI = "👹" +FIX_PATH = $1 ifeq ("$(OS)", "Windows_NT") WHALE="+" ONI="-" + FIX_PATH = $(subst /,\,$1) endif GOARCH ?= $(shell go env GOARCH) @@ -88,7 +91,7 @@ vet: binaries ## run go vet fmt: ## run go fmt @echo "$(WHALE) $@" - @test -z "$$(gofmt -s -l . | grep -v vendor/ | grep -v ".pb.go$$" | tee /dev/stderr)" || \ + @test -z "$$(gofmt -s -l . | grep -Fv $(call FIX_PATH,'vendor/') | grep -v ".pb.go$$" | tee /dev/stderr)" || \ (echo "$(ONI) please format Go code with 'gofmt -s -w'" && false) @test -z "$$(find . -path ./vendor -prune -o ! -name timestamp.proto ! -name duration.proto -name '*.proto' -type f -exec grep -Hn -e "^ " {} \; | tee /dev/stderr)" || \ (echo "$(ONI) please indent proto files with tabs only" && false) @@ -97,7 +100,7 @@ fmt: ## run go fmt lint: ## run go lint @echo "$(WHALE) $@" - @test -z "$$(golint ./... | grep -v vendor/ | grep -v ".pb.go:" | tee /dev/stderr)" + @test -z "$$(golint ./... | grep -Fv $(call FIX_PATH,'vendor/') | grep -v ".pb.go:" | tee /dev/stderr)" dco: ## dco check @which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found" && false) @@ -109,11 +112,11 @@ endif ineffassign: ## run ineffassign @echo "$(WHALE) $@" - @test -z "$$(ineffassign . | grep -v vendor/ | grep -v ".pb.go:" | tee /dev/stderr)" + @test -z "$$(ineffassign . | grep -Fv $(call FIX_PATH,'vendor/') | grep -v ".pb.go:" | tee /dev/stderr)" #errcheck: ## run go errcheck # @echo "$(WHALE) $@" -# @test -z "$$(errcheck ./... | grep -v vendor/ | grep -v ".pb.go:" | tee /dev/stderr)" +# @test -z "$$(errcheck ./... | grep -Fv $(call FIX_PATH,'vendor/') | grep -v ".pb.go:" | tee /dev/stderr)" build: ## build the go packages @echo "$(WHALE) $@" diff --git a/archive/path_test.go b/archive/path_test.go index 942ab19c0..6cb83ef62 100644 --- a/archive/path_test.go +++ b/archive/path_test.go @@ -1,3 +1,5 @@ +// +build !windows + package archive import ( diff --git a/archive/tar_test.go b/archive/tar_test.go index 02e0109df..1cc9149e1 100644 --- a/archive/tar_test.go +++ b/archive/tar_test.go @@ -1,3 +1,5 @@ +// +build !windows + package archive import (