Skip to content

Commit 32204fc

Browse files
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 <[email protected]>
1 parent 6e75739 commit 32204fc

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

.drone.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ steps:
4444
depends_on: [deps-frontend]
4545

4646
- name: lint-backend
47-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
47+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
4848
pull: always
4949
commands:
5050
- make lint-backend
@@ -58,7 +58,7 @@ steps:
5858
path: /go
5959

6060
- name: lint-backend-windows
61-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
61+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
6262
commands:
6363
- make golangci-lint-windows vet
6464
environment:
@@ -73,7 +73,7 @@ steps:
7373
path: /go
7474

7575
- name: lint-backend-gogit
76-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
76+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
7777
commands:
7878
- make lint-backend
7979
environment:
@@ -234,13 +234,13 @@ steps:
234234
path: /go
235235

236236
- name: prepare-test-env
237-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
237+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
238238
pull: always
239239
commands:
240240
- ./build/test-env-prepare.sh
241241

242242
- name: build
243-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
243+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
244244
user: gitea
245245
commands:
246246
- ./build/test-env-check.sh
@@ -255,7 +255,7 @@ steps:
255255
path: /go
256256

257257
- name: test-pgsql
258-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
258+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
259259
user: gitea
260260
commands:
261261
- timeout -s ABRT 50m make test-pgsql-migration test-pgsql
@@ -336,13 +336,13 @@ steps:
336336
path: /go
337337

338338
- name: prepare-test-env
339-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
339+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
340340
pull: always
341341
commands:
342342
- ./build/test-env-prepare.sh
343343

344344
- name: build
345-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
345+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
346346
user: gitea
347347
commands:
348348
- ./build/test-env-check.sh
@@ -357,7 +357,7 @@ steps:
357357
path: /go
358358

359359
- name: unit-test
360-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
360+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
361361
user: gitea
362362
commands:
363363
- make unit-test-coverage test-check
@@ -373,7 +373,7 @@ steps:
373373
path: /go
374374

375375
- name: unit-test-gogit
376-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
376+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
377377
user: gitea
378378
commands:
379379
- make unit-test-coverage test-check
@@ -389,7 +389,7 @@ steps:
389389
path: /go
390390

391391
- name: test-mysql
392-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
392+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
393393
user: gitea
394394
commands:
395395
- make test-mysql-migration integration-test-coverage
@@ -490,13 +490,13 @@ steps:
490490
path: /go
491491

492492
- name: prepare-test-env
493-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
493+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
494494
pull: always
495495
commands:
496496
- ./build/test-env-prepare.sh
497497

498498
- name: build
499-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
499+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
500500
user: gitea
501501
commands:
502502
- ./build/test-env-check.sh
@@ -511,7 +511,7 @@ steps:
511511
path: /go
512512

513513
- name: test-mysql8
514-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
514+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
515515
user: gitea
516516
commands:
517517
- timeout -s ABRT 50m make test-mysql8-migration test-mysql8
@@ -580,13 +580,13 @@ steps:
580580
path: /go
581581

582582
- name: prepare-test-env
583-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
583+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
584584
pull: always
585585
commands:
586586
- ./build/test-env-prepare.sh
587587

588588
- name: build
589-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
589+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
590590
user: gitea
591591
commands:
592592
- ./build/test-env-check.sh
@@ -601,7 +601,7 @@ steps:
601601
path: /go
602602

603603
- name: test-mssql
604-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
604+
image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
605605
user: gitea
606606
commands:
607607
- make test-mssql-migration test-mssql
@@ -660,13 +660,13 @@ steps:
660660
path: /go
661661

662662
- name: prepare-test-env
663-
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
663+
image: gitea/test_env:linux-1.20-arm64 # https://gitea.com/gitea/test-env
664664
pull: always
665665
commands:
666666
- ./build/test-env-prepare.sh
667667

668668
- name: build
669-
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
669+
image: gitea/test_env:linux-1.20-arm64 # https://gitea.com/gitea/test-env
670670
user: gitea
671671
commands:
672672
- ./build/test-env-check.sh
@@ -681,7 +681,7 @@ steps:
681681
path: /go
682682

683683
- name: test-sqlite
684-
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
684+
image: gitea/test_env:linux-1.20-arm64 # https://gitea.com/gitea/test-env
685685
user: gitea
686686
commands:
687687
- timeout -s ABRT 50m make test-sqlite-migration test-sqlite

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ AIR_PACKAGE ?= github.com/cosmtrek/[email protected]
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/[email protected]
3030
ERRCHECK_PACKAGE ?= github.com/kisielk/[email protected]
3131
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
32-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected].0
32+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected].2
3333
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3434
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/[email protected]
3535
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]

modules/highlight/highlight.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ var (
3636
once sync.Once
3737

3838
cache *lru.TwoQueueCache
39+
40+
githubStyles = styles.Get("github")
3941
)
4042

4143
// NewContext loads custom highlight map from local config
@@ -121,7 +123,7 @@ func CodeFromLexer(lexer chroma.Lexer, code string) string {
121123
return code
122124
}
123125
// style not used for live site but need to pass something
124-
err = formatter.Format(htmlw, styles.GitHub, iterator)
126+
err = formatter.Format(htmlw, githubStyles, iterator)
125127
if err != nil {
126128
log.Error("Can't format code: %v", err)
127129
return code
@@ -184,7 +186,7 @@ func File(fileName, language string, code []byte) ([]string, string, error) {
184186
lines := make([]string, 0, len(tokensLines))
185187
for _, tokens := range tokensLines {
186188
iterator = chroma.Literator(tokens...)
187-
err = formatter.Format(htmlBuf, styles.GitHub, iterator)
189+
err = formatter.Format(htmlBuf, githubStyles, iterator)
188190
if err != nil {
189191
return nil, "", fmt.Errorf("can't format code: %w", err)
190192
}

0 commit comments

Comments
 (0)