chore: update Go versions in CI (#7346)

pull/7362/head
Joe Chen 2023-02-19 18:10:34 +08:00 committed by GitHub
parent 9110059797
commit 3e3d6eda12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 19 deletions

View File

@ -8,8 +8,8 @@ Link to the issue: <!-- paste the issue link here, or put "n/a" if not applicabl
- [ ] I agree to follow the [Code of Conduct](https://go.dev/conduct) by submitting this pull request.
- [ ] I have read and acknowledge the [Contributing guide](https://github.com/gogs/gogs/blob/main/.github/CONTRIBUTING.md).
- [ ] I have added test cases to cover the new code.
- [ ] I have added test cases to cover the new code or have provided the test plan.
## Test plan
If no test cases added, please provide your test plan here.
<!-- Please provide concrete but concise steps to proof things are working as stated, see an example in https://github.com/gogs/gogs/pull/7345 -->

View File

@ -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:

View File

@ -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

View File

@ -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.