From 950e226293c0a02318f26a9209b686efff16d1e5 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Wed, 13 Feb 2019 11:06:39 +0100 Subject: [PATCH] run coverage with go module --- azure-pipelines.yml | 11 ++--------- testing/coverage/coverall | 6 +++--- testing/scenarios/common_coverage.go | 3 +-- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 467973c13..ca51e2838 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -31,23 +31,16 @@ jobs: vmImage: 'Ubuntu 16.04' variables: - GOPATH: '$(system.defaultWorkingDirectory)' CODECOV_TOKEN: '$(coverage.token)' steps: - - checkout: none + - checkout: self - task: GoTool@0 inputs: version: '1.11.5' - script: | - go version - go get -v -t -d v2ray.com/core/... - workingDirectory: '$(system.defaultWorkingDirectory)' - displayName: 'Fetch sources' - - script: | - cd ./src/v2ray.com/core bash ./testing/coverage/coverall - workingDirectory: '$(system.defaultWorkingDirectory)' + workingDirectory: '$(Build.SourcesDirectory)' displayName: 'Coverage' - job: make_release diff --git a/testing/coverage/coverall b/testing/coverage/coverall index 163b27ce6..187ddd3b9 100755 --- a/testing/coverage/coverall +++ b/testing/coverage/coverall @@ -2,12 +2,12 @@ FAIL=0 -V2RAY_OUT=${GOPATH}/out/v2ray -V2RAY_COV=${V2RAY_OUT}/cov +V2RAY_OUT=${PWD}/out/v2ray +export V2RAY_COV=${V2RAY_OUT}/cov COVERAGE_FILE=${V2RAY_COV}/coverage.txt function test_package { - DIR="v2ray.com/core$1" + DIR=".$1" DEP=$(go list -f '{{ join .Deps "\n" }}' $DIR | grep v2ray | tr '\n' ',') DEP=${DEP}$DIR RND_NAME=$(openssl rand -hex 16) diff --git a/testing/scenarios/common_coverage.go b/testing/scenarios/common_coverage.go index 6b14a3682..ed6c7b5a3 100644 --- a/testing/scenarios/common_coverage.go +++ b/testing/scenarios/common_coverage.go @@ -6,7 +6,6 @@ import ( "bytes" "os" "os/exec" - "path/filepath" "v2ray.com/core/common/uuid" ) @@ -24,7 +23,7 @@ func BuildV2Ray() error { func RunV2RayProtobuf(config []byte) *exec.Cmd { genTestBinaryPath() - covDir := filepath.Join(os.Getenv("GOPATH"), "out", "v2ray", "cov") + covDir := os.Getenv("V2RAY_COV") os.MkdirAll(covDir, os.ModeDir) randomID := uuid.New() profile := randomID.String() + ".out"