diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 1341028c8..2d2aba7f1 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,8 +8,8 @@ Link to the issue: diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c09f622c7..e008658b7 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -57,7 +57,7 @@ jobs: name: Test strategy: matrix: - go-version: [ 1.18.x, 1.19.x ] + go-version: [ 1.19.x, 1.20.x ] platform: [ ubuntu-latest, macos-latest ] runs-on: ${{ matrix.platform }} steps: @@ -97,7 +97,7 @@ jobs: name: Test strategy: matrix: - go-version: [ 1.18.x, 1.19.x ] + go-version: [ 1.19.x, 1.20.x ] platform: [ windows-latest ] runs-on: ${{ matrix.platform }} steps: @@ -135,7 +135,7 @@ jobs: name: Postgres strategy: matrix: - go-version: [ 1.18.x, 1.19.x ] + go-version: [ 1.19.x, 1.20.x ] platform: [ ubuntu-latest ] runs-on: ${{ matrix.platform }} services: @@ -171,7 +171,7 @@ jobs: name: MySQL strategy: matrix: - go-version: [ 1.18.x, 1.19.x ] + go-version: [ 1.19.x, 1.20.x ] platform: [ ubuntu-18.04 ] runs-on: ${{ matrix.platform }} steps: @@ -196,7 +196,7 @@ jobs: name: SQLite - Go strategy: matrix: - go-version: [ 1.18.x, 1.19.x ] + go-version: [ 1.19.x, 1.20.x ] platform: [ ubuntu-latest ] runs-on: ${{ matrix.platform }} steps: diff --git a/.github/workflows/lsif.yml b/.github/workflows/lsif.yml index c6463ee11..644f5c6cb 100644 --- a/.github/workflows/lsif.yml +++ b/.github/workflows/lsif.yml @@ -21,6 +21,11 @@ jobs: uses: docker://sourcegraph/src-cli:latest with: args: lsif upload -github-token=${{ secrets.GITHUB_TOKEN }} + - name: Upload LSIF data to S2 + continue-on-error: true + uses: docker://sourcegraph/src-cli:latest + with: + args: -endpoint=https://sourcegraph.sourcegraph.com lsif upload -github-token=${{ secrets.GITHUB_TOKEN }} - name: Upload LSIF data to cs.unknwon.dev continue-on-error: true uses: docker://sourcegraph/src-cli:latest diff --git a/internal/testutil/exec.go b/internal/testutil/exec.go index 45f08315d..3600537db 100644 --- a/internal/testutil/exec.go +++ b/internal/testutil/exec.go @@ -20,24 +20,27 @@ import ( // 2. Call fmt.Fprintln(os.Stdout, ...) to print results for the main test to collect. func Exec(helper string, envs ...string) (string, error) { cmd := exec.Command(os.Args[0], "-test.run="+helper, "--") - cmd.Env = []string{"GO_WANT_HELPER_PROCESS=1"} + cmd.Env = []string{ + "GO_WANT_HELPER_PROCESS=1", + "GOCOVERDIR=" + os.TempDir(), + } cmd.Env = append(cmd.Env, envs...) out, err := cmd.CombinedOutput() str := string(out) + + // The error is quite confusing even when tests passed, so let's check whether + // it is passed first. + if strings.Contains(str, "no tests to run") { + return "", errors.New("no tests to run") + } else if i := strings.Index(str, "PASS"); i >= 0 { + // Collect helper result + return strings.TrimSpace(str[:i]), nil + } + if err != nil { return "", fmt.Errorf("%v - %s", err, str) } - - if strings.Contains(str, "no tests to run") { - return "", errors.New("no tests to run") - } else if !strings.Contains(str, "PASS") { - return "", errors.New(str) - } - - // Collect helper result - result := str[:strings.Index(str, "PASS")] - result = strings.TrimSpace(result) - return result, nil + return "", errors.New(str) } // WantHelperProcess returns true if current process is in helper mode.