From 8af4b331ef2a54e245ef54789d9feb3713e70d4a Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 31 Aug 2018 20:56:25 +0200 Subject: [PATCH] Travis: Remove gotestcover --- .travis.yml | 2 +- run_integration_tests.go | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index a783efc95..dcac6c288 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,4 +42,4 @@ script: - go run run_integration_tests.go after_success: - - bash <(curl -s https://codecov.io/bash) -f all.cov + - test -r all.cov && bash <(curl -s https://codecov.io/bash) -f all.cov diff --git a/run_integration_tests.go b/run_integration_tests.go index c8f316fce..05a513847 100644 --- a/run_integration_tests.go +++ b/run_integration_tests.go @@ -187,8 +187,6 @@ func (env *TravisEnvironment) Prepare() error { msg("preparing environment for Travis CI\n") pkgs := []string{ - "golang.org/x/tools/cmd/cover", - "github.com/pierrre/gotestcover", "github.com/NebulousLabs/glyphcheck", "github.com/restic/rest-server/cmd/rest-server", "github.com/restic/calens", @@ -340,12 +338,20 @@ func (env *TravisEnvironment) RunTests() error { } // run the build script - if err := run(args[0], args[1:]...); err != nil { + err := run(args[0], args[1:]...) + if err != nil { return err } - // run the tests and gather coverage information - err := runWithEnv(env.env, "gotestcover", "-coverprofile", "all.cov", "github.com/restic/restic/cmd/...", "github.com/restic/restic/internal/...") + // run the tests and gather coverage information (for Go >= 1.10) + switch { + case v.AtLeast(GoVersion{1, 11, 0}): + err = runWithEnv(env.env, "go", "test", "-mod=vendor", "-coverprofile", "all.cov", "./...") + case v.AtLeast(GoVersion{1, 10, 0}): + err = runWithEnv(env.env, "go", "test", "-coverprofile", "all.cov", "./...") + default: + err = runWithEnv(env.env, "go", "test", "./...") + } if err != nil { return err }