test_env: hardcode major go version in use (#23464)
hardcode the version of test_env we use in docker, so that we can use different major versions of golang between versions of Gitea --------- Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
6e75739c5b
commit
32204fcf8b
40
.drone.yml
40
.drone.yml
|
@ -44,7 +44,7 @@ steps:
|
||||||
depends_on: [deps-frontend]
|
depends_on: [deps-frontend]
|
||||||
|
|
||||||
- name: lint-backend
|
- name: lint-backend
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
- make lint-backend
|
- make lint-backend
|
||||||
|
@ -58,7 +58,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: lint-backend-windows
|
- name: lint-backend-windows
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
commands:
|
commands:
|
||||||
- make golangci-lint-windows vet
|
- make golangci-lint-windows vet
|
||||||
environment:
|
environment:
|
||||||
|
@ -73,7 +73,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: lint-backend-gogit
|
- name: lint-backend-gogit
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
commands:
|
commands:
|
||||||
- make lint-backend
|
- make lint-backend
|
||||||
environment:
|
environment:
|
||||||
|
@ -234,13 +234,13 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: prepare-test-env
|
- name: prepare-test-env
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
- ./build/test-env-prepare.sh
|
- ./build/test-env-prepare.sh
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
user: gitea
|
user: gitea
|
||||||
commands:
|
commands:
|
||||||
- ./build/test-env-check.sh
|
- ./build/test-env-check.sh
|
||||||
|
@ -255,7 +255,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: test-pgsql
|
- name: test-pgsql
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
user: gitea
|
user: gitea
|
||||||
commands:
|
commands:
|
||||||
- timeout -s ABRT 50m make test-pgsql-migration test-pgsql
|
- timeout -s ABRT 50m make test-pgsql-migration test-pgsql
|
||||||
|
@ -336,13 +336,13 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: prepare-test-env
|
- name: prepare-test-env
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
- ./build/test-env-prepare.sh
|
- ./build/test-env-prepare.sh
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
user: gitea
|
user: gitea
|
||||||
commands:
|
commands:
|
||||||
- ./build/test-env-check.sh
|
- ./build/test-env-check.sh
|
||||||
|
@ -357,7 +357,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: unit-test
|
- name: unit-test
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
user: gitea
|
user: gitea
|
||||||
commands:
|
commands:
|
||||||
- make unit-test-coverage test-check
|
- make unit-test-coverage test-check
|
||||||
|
@ -373,7 +373,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: unit-test-gogit
|
- name: unit-test-gogit
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
user: gitea
|
user: gitea
|
||||||
commands:
|
commands:
|
||||||
- make unit-test-coverage test-check
|
- make unit-test-coverage test-check
|
||||||
|
@ -389,7 +389,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: test-mysql
|
- name: test-mysql
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
user: gitea
|
user: gitea
|
||||||
commands:
|
commands:
|
||||||
- make test-mysql-migration integration-test-coverage
|
- make test-mysql-migration integration-test-coverage
|
||||||
|
@ -490,13 +490,13 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: prepare-test-env
|
- name: prepare-test-env
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
- ./build/test-env-prepare.sh
|
- ./build/test-env-prepare.sh
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
user: gitea
|
user: gitea
|
||||||
commands:
|
commands:
|
||||||
- ./build/test-env-check.sh
|
- ./build/test-env-check.sh
|
||||||
|
@ -511,7 +511,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: test-mysql8
|
- name: test-mysql8
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
user: gitea
|
user: gitea
|
||||||
commands:
|
commands:
|
||||||
- timeout -s ABRT 50m make test-mysql8-migration test-mysql8
|
- timeout -s ABRT 50m make test-mysql8-migration test-mysql8
|
||||||
|
@ -580,13 +580,13 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: prepare-test-env
|
- name: prepare-test-env
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
- ./build/test-env-prepare.sh
|
- ./build/test-env-prepare.sh
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
user: gitea
|
user: gitea
|
||||||
commands:
|
commands:
|
||||||
- ./build/test-env-check.sh
|
- ./build/test-env-check.sh
|
||||||
|
@ -601,7 +601,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: test-mssql
|
- name: test-mssql
|
||||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
|
||||||
user: gitea
|
user: gitea
|
||||||
commands:
|
commands:
|
||||||
- make test-mssql-migration test-mssql
|
- make test-mssql-migration test-mssql
|
||||||
|
@ -660,13 +660,13 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: prepare-test-env
|
- name: prepare-test-env
|
||||||
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-arm64 # https://gitea.com/gitea/test-env
|
||||||
pull: always
|
pull: always
|
||||||
commands:
|
commands:
|
||||||
- ./build/test-env-prepare.sh
|
- ./build/test-env-prepare.sh
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-arm64 # https://gitea.com/gitea/test-env
|
||||||
user: gitea
|
user: gitea
|
||||||
commands:
|
commands:
|
||||||
- ./build/test-env-check.sh
|
- ./build/test-env-check.sh
|
||||||
|
@ -681,7 +681,7 @@ steps:
|
||||||
path: /go
|
path: /go
|
||||||
|
|
||||||
- name: test-sqlite
|
- name: test-sqlite
|
||||||
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
|
image: gitea/test_env:linux-1.20-arm64 # https://gitea.com/gitea/test-env
|
||||||
user: gitea
|
user: gitea
|
||||||
commands:
|
commands:
|
||||||
- timeout -s ABRT 50m make test-sqlite-migration test-sqlite
|
- timeout -s ABRT 50m make test-sqlite-migration test-sqlite
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -29,7 +29,7 @@ AIR_PACKAGE ?= github.com/cosmtrek/air@v1.40.4
|
||||||
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.6.0
|
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.6.0
|
||||||
ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.2
|
ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.2
|
||||||
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.4.0
|
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.4.0
|
||||||
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
|
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2
|
||||||
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.10
|
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.10
|
||||||
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
|
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
|
||||||
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.4
|
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.4
|
||||||
|
|
|
@ -36,6 +36,8 @@ var (
|
||||||
once sync.Once
|
once sync.Once
|
||||||
|
|
||||||
cache *lru.TwoQueueCache
|
cache *lru.TwoQueueCache
|
||||||
|
|
||||||
|
githubStyles = styles.Get("github")
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewContext loads custom highlight map from local config
|
// NewContext loads custom highlight map from local config
|
||||||
|
@ -121,7 +123,7 @@ func CodeFromLexer(lexer chroma.Lexer, code string) string {
|
||||||
return code
|
return code
|
||||||
}
|
}
|
||||||
// style not used for live site but need to pass something
|
// style not used for live site but need to pass something
|
||||||
err = formatter.Format(htmlw, styles.GitHub, iterator)
|
err = formatter.Format(htmlw, githubStyles, iterator)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Can't format code: %v", err)
|
log.Error("Can't format code: %v", err)
|
||||||
return code
|
return code
|
||||||
|
@ -184,7 +186,7 @@ func File(fileName, language string, code []byte) ([]string, string, error) {
|
||||||
lines := make([]string, 0, len(tokensLines))
|
lines := make([]string, 0, len(tokensLines))
|
||||||
for _, tokens := range tokensLines {
|
for _, tokens := range tokensLines {
|
||||||
iterator = chroma.Literator(tokens...)
|
iterator = chroma.Literator(tokens...)
|
||||||
err = formatter.Format(htmlBuf, styles.GitHub, iterator)
|
err = formatter.Format(htmlBuf, githubStyles, iterator)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", fmt.Errorf("can't format code: %w", err)
|
return nil, "", fmt.Errorf("can't format code: %w", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue