Skip to content

Commit

Permalink
test_env: hardcode major go version in use (#23464)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
techknowlogick and lafriks authored Mar 14, 2023
1 parent 6e75739 commit 32204fc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
40 changes: 20 additions & 20 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ steps:
depends_on: [deps-frontend]

- 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
commands:
- make lint-backend
Expand All @@ -58,7 +58,7 @@ steps:
path: /go

- 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:
- make golangci-lint-windows vet
environment:
Expand All @@ -73,7 +73,7 @@ steps:
path: /go

- 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:
- make lint-backend
environment:
Expand Down Expand Up @@ -234,13 +234,13 @@ steps:
path: /go

- 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
commands:
- ./build/test-env-prepare.sh

- 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
commands:
- ./build/test-env-check.sh
Expand All @@ -255,7 +255,7 @@ steps:
path: /go

- 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
commands:
- timeout -s ABRT 50m make test-pgsql-migration test-pgsql
Expand Down Expand Up @@ -336,13 +336,13 @@ steps:
path: /go

- 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
commands:
- ./build/test-env-prepare.sh

- 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
commands:
- ./build/test-env-check.sh
Expand All @@ -357,7 +357,7 @@ steps:
path: /go

- 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
commands:
- make unit-test-coverage test-check
Expand All @@ -373,7 +373,7 @@ steps:
path: /go

- 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
commands:
- make unit-test-coverage test-check
Expand All @@ -389,7 +389,7 @@ steps:
path: /go

- 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
commands:
- make test-mysql-migration integration-test-coverage
Expand Down Expand Up @@ -490,13 +490,13 @@ steps:
path: /go

- 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
commands:
- ./build/test-env-prepare.sh

- 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
commands:
- ./build/test-env-check.sh
Expand All @@ -511,7 +511,7 @@ steps:
path: /go

- 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
commands:
- timeout -s ABRT 50m make test-mysql8-migration test-mysql8
Expand Down Expand Up @@ -580,13 +580,13 @@ steps:
path: /go

- 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
commands:
- ./build/test-env-prepare.sh

- 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
commands:
- ./build/test-env-check.sh
Expand All @@ -601,7 +601,7 @@ steps:
path: /go

- 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
commands:
- make test-mssql-migration test-mssql
Expand Down Expand Up @@ -660,13 +660,13 @@ steps:
path: /go

- 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
commands:
- ./build/test-env-prepare.sh

- 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
commands:
- ./build/test-env-check.sh
Expand All @@ -681,7 +681,7 @@ steps:
path: /go

- 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
commands:
- timeout -s ABRT 50m make test-sqlite-migration test-sqlite
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.2
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
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.4
Expand Down
6 changes: 4 additions & 2 deletions modules/highlight/highlight.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ var (
once sync.Once

cache *lru.TwoQueueCache

githubStyles = styles.Get("github")
)

// NewContext loads custom highlight map from local config
Expand Down Expand Up @@ -121,7 +123,7 @@ func CodeFromLexer(lexer chroma.Lexer, code string) string {
return code
}
// 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 {
log.Error("Can't format code: %v", err)
return code
Expand Down Expand Up @@ -184,7 +186,7 @@ func File(fileName, language string, code []byte) ([]string, string, error) {
lines := make([]string, 0, len(tokensLines))
for _, tokens := range tokensLines {
iterator = chroma.Literator(tokens...)
err = formatter.Format(htmlBuf, styles.GitHub, iterator)
err = formatter.Format(htmlBuf, githubStyles, iterator)
if err != nil {
return nil, "", fmt.Errorf("can't format code: %w", err)
}
Expand Down

0 comments on commit 32204fc

Please sign in to comment.