mirror of
https://github.com/gogs/gogs.git
synced 2025-05-25 17:00:55 +00:00
chore: update Go versions in CI (#7346)
This commit is contained in:
parent
9110059797
commit
3e3d6eda12
4
.github/pull_request_template.md
vendored
4
.github/pull_request_template.md
vendored
@ -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 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 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
|
## 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 -->
|
||||||
|
10
.github/workflows/go.yml
vendored
10
.github/workflows/go.yml
vendored
@ -57,7 +57,7 @@ jobs:
|
|||||||
name: Test
|
name: Test
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [ 1.18.x, 1.19.x ]
|
go-version: [ 1.19.x, 1.20.x ]
|
||||||
platform: [ ubuntu-latest, macos-latest ]
|
platform: [ ubuntu-latest, macos-latest ]
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
steps:
|
steps:
|
||||||
@ -97,7 +97,7 @@ jobs:
|
|||||||
name: Test
|
name: Test
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [ 1.18.x, 1.19.x ]
|
go-version: [ 1.19.x, 1.20.x ]
|
||||||
platform: [ windows-latest ]
|
platform: [ windows-latest ]
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
steps:
|
steps:
|
||||||
@ -135,7 +135,7 @@ jobs:
|
|||||||
name: Postgres
|
name: Postgres
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [ 1.18.x, 1.19.x ]
|
go-version: [ 1.19.x, 1.20.x ]
|
||||||
platform: [ ubuntu-latest ]
|
platform: [ ubuntu-latest ]
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
services:
|
services:
|
||||||
@ -171,7 +171,7 @@ jobs:
|
|||||||
name: MySQL
|
name: MySQL
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [ 1.18.x, 1.19.x ]
|
go-version: [ 1.19.x, 1.20.x ]
|
||||||
platform: [ ubuntu-18.04 ]
|
platform: [ ubuntu-18.04 ]
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
steps:
|
steps:
|
||||||
@ -196,7 +196,7 @@ jobs:
|
|||||||
name: SQLite - Go
|
name: SQLite - Go
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [ 1.18.x, 1.19.x ]
|
go-version: [ 1.19.x, 1.20.x ]
|
||||||
platform: [ ubuntu-latest ]
|
platform: [ ubuntu-latest ]
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
steps:
|
steps:
|
||||||
|
5
.github/workflows/lsif.yml
vendored
5
.github/workflows/lsif.yml
vendored
@ -21,6 +21,11 @@ jobs:
|
|||||||
uses: docker://sourcegraph/src-cli:latest
|
uses: docker://sourcegraph/src-cli:latest
|
||||||
with:
|
with:
|
||||||
args: lsif upload -github-token=${{ secrets.GITHUB_TOKEN }}
|
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
|
- name: Upload LSIF data to cs.unknwon.dev
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: docker://sourcegraph/src-cli:latest
|
uses: docker://sourcegraph/src-cli:latest
|
||||||
|
@ -20,24 +20,27 @@ import (
|
|||||||
// 2. Call fmt.Fprintln(os.Stdout, ...) to print results for the main test to collect.
|
// 2. Call fmt.Fprintln(os.Stdout, ...) to print results for the main test to collect.
|
||||||
func Exec(helper string, envs ...string) (string, error) {
|
func Exec(helper string, envs ...string) (string, error) {
|
||||||
cmd := exec.Command(os.Args[0], "-test.run="+helper, "--")
|
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...)
|
cmd.Env = append(cmd.Env, envs...)
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
str := string(out)
|
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 {
|
if err != nil {
|
||||||
return "", fmt.Errorf("%v - %s", err, str)
|
return "", fmt.Errorf("%v - %s", err, str)
|
||||||
}
|
}
|
||||||
|
return "", errors.New(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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// WantHelperProcess returns true if current process is in helper mode.
|
// WantHelperProcess returns true if current process is in helper mode.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user