Skip to content

Commit 73e1a93

Browse files
committed
Merge main branch
2 parents 7596f9b + c3b2e44 commit 73e1a93

File tree

1,570 files changed

+40437
-29003
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,570 files changed

+40437
-29003
lines changed

.drone.yml

+94-6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ steps:
3939
- make lint-frontend
4040
depends_on: [deps-frontend]
4141

42+
- name: security-check
43+
image: golang:1.19
44+
pull: always
45+
commands:
46+
- make security-check
47+
depends_on: [deps-backend]
48+
volumes:
49+
- name: deps
50+
path: /go
51+
4252
- name: lint-backend
4353
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
4454
pull: always
@@ -90,7 +100,7 @@ steps:
90100
- name: checks-backend
91101
image: golang:1.19
92102
commands:
93-
- make checks-backend
103+
- make --always-make checks-backend # ensure the 'go-licenses' make target runs
94104
depends_on: [deps-backend]
95105
volumes:
96106
- name: deps
@@ -106,7 +116,7 @@ steps:
106116
image: node:18
107117
commands:
108118
- make frontend
109-
depends_on: [test-frontend]
119+
depends_on: [deps-frontend]
110120

111121
- name: build-backend-no-gcc
112122
image: golang:1.18 # this step is kept as the lowest version of golang that we support
@@ -498,6 +508,78 @@ steps:
498508
- name: deps
499509
path: /go
500510

511+
---
512+
kind: pipeline
513+
type: docker
514+
name: testing-e2e
515+
516+
platform:
517+
os: linux
518+
arch: amd64
519+
520+
depends_on:
521+
- compliance
522+
523+
trigger:
524+
event:
525+
- pull_request
526+
527+
volumes:
528+
- name: deps
529+
temp: {}
530+
531+
services:
532+
- name: pgsql
533+
pull: default
534+
image: postgres:10
535+
environment:
536+
POSTGRES_DB: testgitea-e2e
537+
POSTGRES_PASSWORD: postgres
538+
POSTGRES_INITDB_ARGS: --encoding=UTF8 --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'
539+
540+
steps:
541+
- name: deps-frontend
542+
image: node:18
543+
pull: always
544+
commands:
545+
- make deps-frontend
546+
547+
- name: build-frontend
548+
image: node:18
549+
commands:
550+
- make frontend
551+
depends_on: [deps-frontend]
552+
553+
- name: deps-backend
554+
image: golang:1.18
555+
pull: always
556+
commands:
557+
- make deps-backend
558+
volumes:
559+
- name: deps
560+
path: /go
561+
562+
# TODO: We should probably build all dependencies into a test image
563+
- name: test-e2e
564+
image: mcr.microsoft.com/playwright:v1.27.0-focal
565+
commands:
566+
- curl -sLO https://go.dev/dl/go1.19.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
567+
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea
568+
- apt-get -qq update && apt-get -qqy install build-essential
569+
- export TEST_PGSQL_SCHEMA=''
570+
- ./build/test-env-prepare.sh
571+
- su gitea bash -c "export PATH=$PATH:/usr/local/go/bin && timeout -s ABRT 40m make test-e2e-pgsql"
572+
environment:
573+
GOPROXY: https://goproxy.io
574+
GOSUMDB: sum.golang.org
575+
USE_REPO_TEST_DIR: 1
576+
TEST_PGSQL_DBNAME: 'testgitea-e2e'
577+
DEBIAN_FRONTEND: noninteractive
578+
depends_on: [build-frontend, deps-backend]
579+
volumes:
580+
- name: deps
581+
path: /go
582+
501583
---
502584
kind: pipeline
503585
name: update_translations
@@ -544,6 +626,8 @@ steps:
544626
commit_message: "[skip ci] Updated translations via Crowdin"
545627
remote: "[email protected]:go-gitea/gitea.git"
546628
environment:
629+
DRONE_COMMIT_AUTHOR_EMAIL: "[email protected]"
630+
DRONE_COMMIT_AUTHOR: GiteaBot
547631
GIT_PUSH_SSH_KEY:
548632
from_secret: git_push_ssh_key
549633

@@ -588,12 +672,14 @@ steps:
588672
pull: always
589673
settings:
590674
author_email: "[email protected]"
591-
author_name: GiteaBot
675+
author_name: "GiteaBot"
592676
branch: main
593677
commit: true
594-
commit_message: "[skip ci] Updated licenses and gitignores "
678+
commit_message: "[skip ci] Updated licenses and gitignores"
595679
remote: "[email protected]:go-gitea/gitea.git"
596680
environment:
681+
DRONE_COMMIT_AUTHOR_EMAIL: "[email protected]"
682+
DRONE_COMMIT_AUTHOR: "GiteaBot"
597683
GIT_PUSH_SSH_KEY:
598684
from_secret: git_push_ssh_key
599685

@@ -653,12 +739,13 @@ steps:
653739
pull: always
654740
commands:
655741
# Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved
656-
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
742+
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
657743
- export PATH=$PATH:$GOPATH/bin
658744
- make release
659745
environment:
660746
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
661747
TAGS: bindata sqlite sqlite_unlock_notify
748+
DEBIAN_FRONTEND: noninteractive
662749
volumes:
663750
- name: deps
664751
path: /go
@@ -773,12 +860,13 @@ steps:
773860
pull: always
774861
commands:
775862
# Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved
776-
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
863+
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
777864
- export PATH=$PATH:$GOPATH/bin
778865
- make release
779866
environment:
780867
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
781868
TAGS: bindata sqlite sqlite_unlock_notify
869+
DEBIAN_FRONTEND: noninteractive
782870
depends_on: [fetch-tags]
783871
volumes:
784872
- name: deps

.eslintrc.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ overrides:
3535
rules:
3636
import/no-unresolved: [0]
3737
import/no-extraneous-dependencies: [0]
38-
- files: ["*.test.js"]
39-
env:
40-
jest: true
4138
- files: ["*.config.js"]
4239
rules:
4340
import/no-unused-modules: [0]
@@ -46,7 +43,7 @@ rules:
4643
accessor-pairs: [2]
4744
array-bracket-newline: [0]
4845
array-bracket-spacing: [2, never]
49-
array-callback-return: [0]
46+
array-callback-return: [2, {checkForEach: true}]
5047
array-element-newline: [0]
5148
arrow-body-style: [0]
5249
arrow-parens: [2, always]
@@ -185,6 +182,7 @@ rules:
185182
linebreak-style: [2, unix]
186183
lines-around-comment: [0]
187184
lines-between-class-members: [0]
185+
logical-assignment-operators: [0]
188186
max-classes-per-file: [0]
189187
max-depth: [0]
190188
max-len: [0]
@@ -245,7 +243,7 @@ rules:
245243
no-floating-decimal: [0]
246244
no-func-assign: [2]
247245
no-global-assign: [2]
248-
no-implicit-coercion: [0]
246+
no-implicit-coercion: [2]
249247
no-implicit-globals: [0]
250248
no-implied-eval: [2]
251249
no-import-assign: [2]
@@ -322,7 +320,7 @@ rules:
322320
no-unused-private-class-members: [2]
323321
no-unused-vars: [2, {args: all, argsIgnorePattern: ^_, varsIgnorePattern: ^_, caughtErrorsIgnorePattern: ^_, destructuredArrayIgnorePattern: ^_, ignoreRestSiblings: false}]
324322
no-use-before-define: [2, {functions: false, classes: true, variables: true, allowNamedExports: true}]
325-
no-useless-backreference: [0]
323+
no-useless-backreference: [2]
326324
no-useless-call: [2]
327325
no-useless-catch: [2]
328326
no-useless-computed-key: [2]
@@ -353,7 +351,7 @@ rules:
353351
prefer-named-capture-group: [0]
354352
prefer-numeric-literals: [2]
355353
prefer-object-has-own: [0]
356-
prefer-object-spread: [0]
354+
prefer-object-spread: [2]
357355
prefer-promise-reject-errors: [2, {allowEmptyReject: false}]
358356
prefer-regex-literals: [2]
359357
prefer-rest-params: [2]
@@ -455,6 +453,7 @@ rules:
455453
unicorn/no-static-only-class: [2]
456454
unicorn/no-thenable: [2]
457455
unicorn/no-this-assignment: [2]
456+
unicorn/no-unnecessary-await: [2]
458457
unicorn/no-unreadable-array-destructuring: [0]
459458
unicorn/no-unreadable-iife: [2]
460459
unicorn/no-unsafe-regex: [0]
@@ -519,6 +518,7 @@ rules:
519518
unicorn/require-number-to-fixed-digits-argument: [2]
520519
unicorn/require-post-message-target-origin: [0]
521520
unicorn/string-content: [0]
521+
unicorn/switch-case-braces: [0]
522522
unicorn/template-indent: [2]
523523
unicorn/text-encoding-identifier-case: [0]
524524
unicorn/throw-new-error: [2]

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
* text=auto eol=lf
22
*.tmpl linguist-language=Handlebars
3+
/assets/*.json linguist-generated
34
/public/vendor/** -text -eol linguist-vendored
45
/vendor/** -text -eol linguist-vendored
56
/web_src/fomantic/build/** linguist-generated

.gitignore

+9-15
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,14 @@ cpu.out
6363
/indexers
6464
/log
6565
/public/img/avatar
66-
/integrations/gitea-integration-mysql
67-
/integrations/gitea-integration-mysql8
68-
/integrations/gitea-integration-pgsql
69-
/integrations/gitea-integration-sqlite
70-
/integrations/gitea-integration-mssql
71-
/integrations/indexers-mysql
72-
/integrations/indexers-mysql8
73-
/integrations/indexers-pgsql
74-
/integrations/indexers-sqlite
75-
/integrations/indexers-mssql
76-
/integrations/sqlite.ini
77-
/integrations/mysql.ini
78-
/integrations/mysql8.ini
79-
/integrations/pgsql.ini
80-
/integrations/mssql.ini
66+
/tests/integration/gitea-integration-*
67+
/tests/integration/indexers-*
68+
/tests/e2e/gitea-e2e-*
69+
/tests/e2e/indexers-*
70+
/tests/e2e/reports
71+
/tests/e2e/test-artifacts
72+
/tests/e2e/test-snapshots
73+
/tests/*.ini
8174
/node_modules
8275
/yarn.lock
8376
/yarn-error.log
@@ -102,6 +95,7 @@ cpu.out
10295
!/web_src/fomantic/build/themes/default/assets/fonts/outline-icons.woff2
10396
/VERSION
10497
/.air
98+
/.go-licenses
10599

106100
# Snapcraft
107101
snap/.snapcraft/

.gitpod.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
tasks:
2+
- name: Setup
3+
init: |
4+
make deps
5+
make build
6+
command: |
7+
gp sync-done setup
8+
exit 0
9+
- name: Run frontend
10+
command: |
11+
gp sync-await setup
12+
make watch-frontend
13+
- name: Run backend
14+
command: |
15+
gp sync-await setup
16+
mkdir -p custom/conf/
17+
echo -e "[server]\nROOT_URL=$(gp url 3000)/" > custom/conf/app.ini
18+
echo -e "\n[database]\nDB_TYPE = sqlite3\nPATH = $GITPOD_REPO_ROOT/data/gitea.db" >> custom/conf/app.ini
19+
export TAGS="sqlite sqlite_unlock_notify"
20+
make watch-backend
21+
- name: Run docs
22+
before: sudo bash -c "$(grep 'https://github.com/gohugoio/hugo/releases/download' Makefile | tr -d '\')" # install hugo
23+
command: cd docs && make clean update && hugo server -D -F --baseUrl $(gp url 1313) --liveReloadPort=443 --appendPort=false --bind=0.0.0.0
24+
25+
vscode:
26+
extensions:
27+
- editorconfig.editorconfig
28+
- dbaeumer.vscode-eslint
29+
- golang.go
30+
- stylelint.vscode-stylelint
31+
- DavidAnson.vscode-markdownlint
32+
- johnsoncodehk.volar
33+
- ms-azuretools.vscode-docker
34+
- zixuanchen.vitest-explorer
35+
36+
ports:
37+
- name: Gitea
38+
port: 3000
39+
- name: Docs
40+
port: 1313

.golangci.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ linters:
1212
- dupl
1313
#- gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time.
1414
- gofmt
15-
- misspell
1615
- gocritic
1716
- bidichk
1817
- ineffassign
@@ -40,7 +39,7 @@ linters-settings:
4039
stylecheck:
4140
checks: ["all", "-ST1005", "-ST1003"]
4241
nakedret:
43-
max-func-lines: 0
42+
max-func-lines: 0
4443
gocritic:
4544
disabled-checks:
4645
- ifElseChain
@@ -86,6 +85,8 @@ linters-settings:
8685
- github.com/unknwon/com: "use gitea's util and replacements"
8786

8887
issues:
88+
max-issues-per-linter: 0
89+
max-same-issues: 0
8990
exclude-rules:
9091
# Exclude some linters from running on tests files.
9192
- path: _test\.go
@@ -146,9 +147,6 @@ issues:
146147
- path: models/issue_comment_list.go
147148
linters:
148149
- dupl
149-
- linters:
150-
- misspell
151-
text: '`Unknwon` is a misspelling of `Unknown`'
152150
- path: models/update.go
153151
linters:
154152
- unused
@@ -171,3 +169,7 @@ issues:
171169
- path: models/user/openid.go
172170
linters:
173171
- golint
172+
- path: models/user/badge.go
173+
linters:
174+
- revive
175+
text: "exported: type name will be used as user.UserBadge by other packages, and that stutters; consider calling this Badge"

0 commit comments

Comments
 (0)