run coverage with go module

pull/1550/head v4.16.0
Darien Raymond 6 years ago
parent 8cdc7d8c4f
commit 950e226293
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -31,23 +31,16 @@ jobs:
vmImage: 'Ubuntu 16.04' vmImage: 'Ubuntu 16.04'
variables: variables:
GOPATH: '$(system.defaultWorkingDirectory)'
CODECOV_TOKEN: '$(coverage.token)' CODECOV_TOKEN: '$(coverage.token)'
steps: steps:
- checkout: none - checkout: self
- task: GoTool@0 - task: GoTool@0
inputs: inputs:
version: '1.11.5' version: '1.11.5'
- script: | - 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 bash ./testing/coverage/coverall
workingDirectory: '$(system.defaultWorkingDirectory)' workingDirectory: '$(Build.SourcesDirectory)'
displayName: 'Coverage' displayName: 'Coverage'
- job: make_release - job: make_release

@ -2,12 +2,12 @@
FAIL=0 FAIL=0
V2RAY_OUT=${GOPATH}/out/v2ray V2RAY_OUT=${PWD}/out/v2ray
V2RAY_COV=${V2RAY_OUT}/cov export V2RAY_COV=${V2RAY_OUT}/cov
COVERAGE_FILE=${V2RAY_COV}/coverage.txt COVERAGE_FILE=${V2RAY_COV}/coverage.txt
function test_package { function test_package {
DIR="v2ray.com/core$1" DIR=".$1"
DEP=$(go list -f '{{ join .Deps "\n" }}' $DIR | grep v2ray | tr '\n' ',') DEP=$(go list -f '{{ join .Deps "\n" }}' $DIR | grep v2ray | tr '\n' ',')
DEP=${DEP}$DIR DEP=${DEP}$DIR
RND_NAME=$(openssl rand -hex 16) RND_NAME=$(openssl rand -hex 16)

@ -6,7 +6,6 @@ import (
"bytes" "bytes"
"os" "os"
"os/exec" "os/exec"
"path/filepath"
"v2ray.com/core/common/uuid" "v2ray.com/core/common/uuid"
) )
@ -24,7 +23,7 @@ func BuildV2Ray() error {
func RunV2RayProtobuf(config []byte) *exec.Cmd { func RunV2RayProtobuf(config []byte) *exec.Cmd {
genTestBinaryPath() genTestBinaryPath()
covDir := filepath.Join(os.Getenv("GOPATH"), "out", "v2ray", "cov") covDir := os.Getenv("V2RAY_COV")
os.MkdirAll(covDir, os.ModeDir) os.MkdirAll(covDir, os.ModeDir)
randomID := uuid.New() randomID := uuid.New()
profile := randomID.String() + ".out" profile := randomID.String() + ".out"

Loading…
Cancel
Save