diff --git a/.air.toml b/.air.toml index 0610088303179..069a88924388b 100644 --- a/.air.toml +++ b/.air.toml @@ -5,6 +5,6 @@ tmp_dir = ".air" cmd = "make backend" bin = "gitea" include_ext = ["go", "tmpl"] -exclude_dir = ["modules/git/tests", "services/gitdiff/testdata", "modules/avatar/testdata"] -include_dir = ["cmd", "models", "modules", "options", "routers", "services", "templates"] +exclude_dir = ["modules/git/tests", "services/gitdiff/testdata", "modules/avatar/testdata", "models/fixtures", "models/migrations/fixtures", "modules/migration/file_format_testdata", "modules/avatar/identicon/testdata"] +include_dir = ["cmd", "models", "modules", "options", "routers", "services"] exclude_regex = ["_test.go$", "_gen.go$"] diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000..1ce2a87611e81 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,114 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# IntelliJ +.idea +# Goland's output filename can not be set manually +/go_build_* + +# MS VSCode +.vscode +__debug_bin + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +*coverage.out +coverage.all +cpu.out + +/modules/migration/bindata.go +/modules/migration/bindata.go.hash +/modules/options/bindata.go +/modules/options/bindata.go.hash +/modules/public/bindata.go +/modules/public/bindata.go.hash +/modules/templates/bindata.go +/modules/templates/bindata.go.hash + +*.db +*.log + +/gitea +/gitea-vet +/debug +/integrations.test + +/bin +/dist +/custom/* +!/custom/conf +/custom/conf/* +!/custom/conf/app.example.ini +/data +/indexers +/log +/public/img/avatar +/tests/integration/gitea-integration-* +/tests/integration/indexers-* +/tests/e2e/gitea-e2e-* +/tests/e2e/indexers-* +/tests/e2e/reports +/tests/e2e/test-artifacts +/tests/e2e/test-snapshots +/tests/*.ini +/node_modules +/yarn.lock +/yarn-error.log +/npm-debug.log* +/public/js +/public/serviceworker.js +/public/css +/public/fonts +/public/img/webpack +/vendor +/web_src/fomantic/node_modules +/web_src/fomantic/build/* +!/web_src/fomantic/build/semantic.js +!/web_src/fomantic/build/semantic.css +!/web_src/fomantic/build/themes +/web_src/fomantic/build/themes/* +!/web_src/fomantic/build/themes/default +/web_src/fomantic/build/themes/default/assets/* +!/web_src/fomantic/build/themes/default/assets/fonts +/web_src/fomantic/build/themes/default/assets/fonts/* +!/web_src/fomantic/build/themes/default/assets/fonts/icons.woff2 +!/web_src/fomantic/build/themes/default/assets/fonts/outline-icons.woff2 +/VERSION +/.air +/.go-licenses + +# Snapcraft +snap/.snapcraft/ +parts/ +stage/ +prime/ +*.snap +*.snap-build +*_source.tar.bz2 +.DS_Store + +# Make evidence files +/.make_evidence + +# Manpage +/man diff --git a/.drone.yml b/.drone.yml index 8a73e84a0005f..3df7512fd0aa4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,6 +12,9 @@ trigger: - push - tag - pull_request + paths: + exclude: + - docs/** volumes: - name: deps @@ -25,7 +28,7 @@ steps: - make deps-frontend - name: deps-backend - image: golang:1.19 + image: golang:1.20 pull: always commands: - make deps-backend @@ -39,18 +42,8 @@ steps: - make lint-frontend depends_on: [deps-frontend] - - name: security-check - image: golang:1.19 - pull: always - commands: - - make security-check - depends_on: [deps-backend] - volumes: - - name: deps - path: /go - - name: lint-backend - image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.19-amd64 # https://gitea.com/gitea/test-env pull: always commands: - make lint-backend @@ -64,7 +57,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.19-amd64 # https://gitea.com/gitea/test-env commands: - make golangci-lint-windows vet environment: @@ -79,7 +72,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.19-amd64 # https://gitea.com/gitea/test-env commands: - make lint-backend environment: @@ -98,7 +91,7 @@ steps: depends_on: [deps-frontend] - name: checks-backend - image: golang:1.19 + image: golang:1.20 commands: - make --always-make checks-backend # ensure the 'go-licenses' make target runs depends_on: [deps-backend] @@ -119,10 +112,9 @@ steps: depends_on: [deps-frontend] - name: build-backend-no-gcc - image: golang:1.18 # this step is kept as the lowest version of golang that we support + image: golang:1.19 # this step is kept as the lowest version of golang that we support pull: always environment: - GO111MODULE: on GOPROXY: https://goproxy.io commands: - go build -o gitea_no_gcc # test if build succeeds without the sqlite tag @@ -132,9 +124,8 @@ steps: path: /go - name: build-backend-arm64 - image: golang:1.19 + image: golang:1.20 environment: - GO111MODULE: on GOPROXY: https://goproxy.io GOOS: linux GOARCH: arm64 @@ -148,9 +139,8 @@ steps: path: /go - name: build-backend-windows - image: golang:1.19 + image: golang:1.20 environment: - GO111MODULE: on GOPROXY: https://goproxy.io GOOS: windows GOARCH: amd64 @@ -163,9 +153,8 @@ steps: path: /go - name: build-backend-386 - image: golang:1.19 + image: golang:1.20 environment: - GO111MODULE: on GOPROXY: https://goproxy.io GOOS: linux GOARCH: 386 @@ -193,6 +182,9 @@ trigger: - push - tag - pull_request + paths: + exclude: + - docs/** volumes: - name: deps @@ -240,6 +232,10 @@ services: MINIO_ACCESS_KEY: 123456 MINIO_SECRET_KEY: 12345678 + - name: smtpimap + image: tabascoterrier/docker-imap-devel:latest + pull: always + steps: - name: fetch-tags image: docker:git @@ -253,7 +249,7 @@ steps: - pull_request - name: deps-backend - image: golang:1.19 + image: golang:1.20 pull: always commands: - make deps-backend @@ -268,13 +264,13 @@ steps: - git update-ref refs/heads/tag_test ${DRONE_COMMIT_SHA} - name: prepare-test-env - image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.19-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.19-amd64 # https://gitea.com/gitea/test-env user: gitea commands: - ./build/test-env-check.sh @@ -289,7 +285,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.19-amd64 # https://gitea.com/gitea/test-env user: gitea commands: - make unit-test-coverage test-check @@ -305,7 +301,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.19-amd64 # https://gitea.com/gitea/test-env user: gitea commands: - make unit-test-coverage test-check @@ -321,7 +317,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.19-amd64 # https://gitea.com/gitea/test-env user: gitea commands: - make test-mysql-migration integration-test-coverage @@ -338,7 +334,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.19-amd64 # https://gitea.com/gitea/test-env user: gitea commands: - timeout -s ABRT 50m make test-mysql8-migration test-mysql8 @@ -354,7 +350,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.19-amd64 # https://gitea.com/gitea/test-env user: gitea commands: - make test-mssql-migration test-mssql @@ -370,7 +366,7 @@ steps: path: /go - name: generate-coverage - image: golang:1.19 + image: golang:1.20 commands: - make coverage environment: @@ -416,6 +412,9 @@ trigger: - push - tag - pull_request + paths: + exclude: + - docs/** volumes: - name: deps @@ -446,7 +445,7 @@ steps: - pull_request - name: deps-backend - image: golang:1.19 + image: golang:1.20 pull: always commands: - make deps-backend @@ -455,13 +454,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.19-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.19-arm64 # https://gitea.com/gitea/test-env user: gitea commands: - ./build/test-env-check.sh @@ -476,7 +475,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.19-arm64 # https://gitea.com/gitea/test-env user: gitea commands: - timeout -s ABRT 50m make test-sqlite-migration test-sqlite @@ -492,7 +491,7 @@ steps: path: /go - name: test-pgsql - image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.19-arm64 # https://gitea.com/gitea/test-env user: gitea commands: - timeout -s ABRT 50m make test-pgsql-migration test-pgsql @@ -523,6 +522,9 @@ depends_on: trigger: event: - pull_request + paths: + exclude: + - docs/** volumes: - name: deps @@ -561,9 +563,9 @@ steps: # TODO: We should probably build all dependencies into a test image - name: test-e2e - image: mcr.microsoft.com/playwright:v1.27.0-focal + image: mcr.microsoft.com/playwright:v1.29.2-focal commands: - - curl -sLO https://go.dev/dl/go1.19.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz + - curl -sLO https://go.dev/dl/go1.20.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz - groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea - apt-get -qq update && apt-get -qqy install build-essential - export TEST_PGSQL_SCHEMA='' @@ -610,7 +612,7 @@ steps: from_secret: crowdin_key - name: update - image: alpine:3.13 + image: alpine:3.17 pull: always commands: - ./build/update-locales.sh @@ -662,7 +664,7 @@ trigger: steps: - name: download - image: golang:1.19 + image: golang:1.20 pull: always commands: - timeout -s ABRT 40m make generate-license generate-gitignore @@ -702,6 +704,9 @@ trigger: - "release/*" event: - push + paths: + exclude: + - docs/** depends_on: - testing-amd64 @@ -726,7 +731,7 @@ steps: - make deps-frontend - name: deps-backend - image: golang:1.19 + image: golang:1.20 pull: always commands: - make deps-backend @@ -735,7 +740,7 @@ steps: path: /go - name: static - image: techknowlogick/xgo:go-1.19.x + image: techknowlogick/xgo:go-1.20.x pull: always commands: # Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved @@ -769,10 +774,16 @@ steps: image: woodpeckerci/plugin-s3:latest pull: always settings: - acl: public-read - bucket: gitea-artifacts - endpoint: https://ams3.digitaloceanspaces.com - path_style: true + acl: + from_secret: aws_s3_acl + region: + from_secret: aws_s3_region + bucket: + from_secret: aws_s3_bucket + endpoint: + from_secret: aws_s3_endpoint + path_style: + from_secret: aws_s3_path_style source: "dist/release/*" strip_prefix: dist/release/ target: "/gitea/${DRONE_BRANCH##release/v}" @@ -790,10 +801,16 @@ steps: - name: release-main image: woodpeckerci/plugin-s3:latest settings: - acl: public-read - bucket: gitea-artifacts - endpoint: https://ams3.digitaloceanspaces.com - path_style: true + acl: + from_secret: aws_s3_acl + region: + from_secret: aws_s3_region + bucket: + from_secret: aws_s3_bucket + endpoint: + from_secret: aws_s3_endpoint + path_style: + from_secret: aws_s3_path_style source: "dist/release/*" strip_prefix: dist/release/ target: /gitea/main @@ -847,7 +864,7 @@ steps: - make deps-frontend - name: deps-backend - image: golang:1.19 + image: golang:1.20 pull: always commands: - make deps-backend @@ -856,7 +873,7 @@ steps: path: /go - name: static - image: techknowlogick/xgo:go-1.19.x + image: techknowlogick/xgo:go-1.20.x pull: always commands: # Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved @@ -892,10 +909,16 @@ steps: image: woodpeckerci/plugin-s3:latest pull: always settings: - acl: public-read - bucket: gitea-artifacts - endpoint: https://ams3.digitaloceanspaces.com - path_style: true + acl: + from_secret: aws_s3_acl + region: + from_secret: aws_s3_region + bucket: + from_secret: aws_s3_bucket + endpoint: + from_secret: aws_s3_endpoint + path_style: + from_secret: aws_s3_path_style source: "dist/release/*" strip_prefix: dist/release/ target: "/gitea/${DRONE_TAG##v}" @@ -935,13 +958,14 @@ trigger: - push - tag - pull_request + paths: + include: + - docs/** steps: - name: build-docs - image: plugins/hugo:latest - pull: always + image: golang:1.20 commands: - - apk add --no-cache make bash curl - cd docs - make trans-copy clean build @@ -975,7 +999,10 @@ depends_on: trigger: ref: - - "refs/tags/**" + include: + - "refs/tags/**" + exclude: + - "refs/tags/**-rc*" event: exclude: - cron @@ -989,7 +1016,7 @@ steps: - git fetch --tags --force - name: publish - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: auto_tag: true @@ -1001,13 +1028,17 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: - pull_request - name: publish-rootless - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest settings: dockerfile: Dockerfile.rootless auto_tag: true @@ -1019,6 +1050,80 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 + when: + event: + exclude: + - pull_request +--- + +kind: pipeline +type: docker +name: docker-linux-amd64-release-candidate-version + +platform: + os: linux + arch: amd64 + +depends_on: + - testing-amd64 + - testing-arm64 + +trigger: + ref: + - "refs/tags/**-rc*" + event: + exclude: + - cron + +steps: + - name: fetch-tags + image: docker:git + pull: always + commands: + - git config --global --add safe.directory /drone/src + - git fetch --tags --force + + - name: publish + image: plugins/docker:latest + pull: always + settings: + tags: ${DRONE_TAG##v}-linux-amd64 + repo: gitea/gitea + build_args: + - GOPROXY=https://goproxy.io + password: + from_secret: docker_password + username: + from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 + when: + event: + exclude: + - pull_request + + - name: publish-rootless + image: plugins/docker:latest + settings: + dockerfile: Dockerfile.rootless + tags: ${DRONE_TAG##v}-linux-amd64-rootless + repo: gitea/gitea + build_args: + - GOPROXY=https://goproxy.io + password: + from_secret: docker_password + username: + from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: @@ -1053,7 +1158,7 @@ steps: - git fetch --tags --force - name: publish - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: auto_tag: false @@ -1065,13 +1170,17 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: - pull_request - name: publish-rootless - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest settings: dockerfile: Dockerfile.rootless auto_tag: false @@ -1083,6 +1192,10 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: @@ -1116,7 +1229,7 @@ steps: - git fetch --tags --force - name: publish - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: auto_tag: false @@ -1128,13 +1241,17 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: - pull_request - name: publish-rootless - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest settings: dockerfile: Dockerfile.rootless auto_tag: false @@ -1146,6 +1263,10 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: @@ -1154,7 +1275,7 @@ steps: --- kind: pipeline type: docker -name: docker-linux-arm64-dry-run +name: docker-linux-amd64-dry-run platform: os: linux @@ -1166,10 +1287,13 @@ depends_on: trigger: ref: - "refs/pull/**" + paths: + exclude: + - docs/** steps: - name: dryrun - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: dry_run: true @@ -1180,6 +1304,7 @@ steps: environment: PLUGIN_MIRROR: from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: - pull_request @@ -1199,7 +1324,10 @@ depends_on: trigger: ref: - - "refs/tags/**" + include: + - "refs/tags/**" + exclude: + - "refs/tags/**-rc*" event: exclude: - cron @@ -1213,7 +1341,7 @@ steps: - git fetch --tags --force - name: publish - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: auto_tag: true @@ -1225,13 +1353,17 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: - pull_request - name: publish-rootless - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest settings: dockerfile: Dockerfile.rootless auto_tag: true @@ -1243,6 +1375,80 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 + when: + event: + exclude: + - pull_request + +--- +kind: pipeline +type: docker +name: docker-linux-arm64-release-candidate-version + +platform: + os: linux + arch: arm64 + +depends_on: + - testing-amd64 + - testing-arm64 + +trigger: + ref: + - "refs/tags/**-rc*" + event: + exclude: + - cron + +steps: + - name: fetch-tags + image: docker:git + pull: always + commands: + - git config --global --add safe.directory /drone/src + - git fetch --tags --force + + - name: publish + image: plugins/docker:latest + pull: always + settings: + tags: ${DRONE_TAG##v}-linux-arm64 + repo: gitea/gitea + build_args: + - GOPROXY=https://goproxy.io + password: + from_secret: docker_password + username: + from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 + when: + event: + exclude: + - pull_request + + - name: publish-rootless + image: plugins/docker:latest + settings: + dockerfile: Dockerfile.rootless + tags: ${DRONE_TAG##v}-linux-arm64-rootless + repo: gitea/gitea + build_args: + - GOPROXY=https://goproxy.io + password: + from_secret: docker_password + username: + from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: @@ -1277,7 +1483,7 @@ steps: - git fetch --tags --force - name: publish - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: auto_tag: false @@ -1289,13 +1495,17 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: - pull_request - name: publish-rootless - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest settings: dockerfile: Dockerfile.rootless auto_tag: false @@ -1307,6 +1517,10 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: @@ -1340,7 +1554,7 @@ steps: - git fetch --tags --force - name: publish - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: auto_tag: false @@ -1352,13 +1566,17 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: - pull_request - name: publish-rootless - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest settings: dockerfile: Dockerfile.rootless auto_tag: false @@ -1370,6 +1588,10 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: @@ -1417,7 +1639,9 @@ trigger: depends_on: - docker-linux-amd64-release-version + - docker-linux-amd64-release-candidate-version - docker-linux-arm64-release-version + - docker-linux-arm64-release-candidate-version --- kind: pipeline @@ -1499,6 +1723,8 @@ depends_on: - docker-linux-arm64-release - docker-linux-amd64-release-version - docker-linux-arm64-release-version + - docker-linux-amd64-release-candidate-version + - docker-linux-arm64-release-candidate-version - docker-linux-amd64-release-branch - docker-linux-arm64-release-branch - docker-manifest diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 4dafc8f492186..a73df2ee344ce 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -84,6 +84,7 @@ rules: id-length: [0] id-match: [0] implicit-arrow-linebreak: [0] + import/consistent-type-specifier-style: [0] import/default: [0] import/dynamic-import-chunkname: [0] import/export: [2] @@ -103,6 +104,7 @@ rules: import/no-default-export: [0] import/no-deprecated: [0] import/no-dynamic-require: [0] + import/no-empty-named-blocks: [2] import/no-extraneous-dependencies: [2] import/no-import-module-exports: [0] import/no-internal-modules: [0] @@ -147,7 +149,7 @@ rules: jquery/no-global-eval: [2] jquery/no-grep: [2] jquery/no-has: [2] - jquery/no-hide: [0] + jquery/no-hide: [2] jquery/no-html: [0] jquery/no-in-array: [2] jquery/no-is-array: [2] @@ -164,13 +166,13 @@ rules: jquery/no-proxy: [2] jquery/no-ready: [0] jquery/no-serialize: [2] - jquery/no-show: [0] + jquery/no-show: [2] jquery/no-size: [2] jquery/no-sizzle: [0] jquery/no-slide: [0] jquery/no-submit: [0] jquery/no-text: [0] - jquery/no-toggle: [0] + jquery/no-toggle: [2] jquery/no-trigger: [0] jquery/no-trim: [2] jquery/no-val: [0] @@ -199,7 +201,7 @@ rules: newline-per-chained-call: [0] no-alert: [0] no-array-constructor: [2] - no-async-promise-executor: [2] + no-async-promise-executor: [0] no-await-in-loop: [0] no-bitwise: [0] no-buffer-constructor: [0] @@ -229,6 +231,7 @@ rules: no-empty-character-class: [2] no-empty-function: [0] no-empty-pattern: [2] + no-empty-static-block: [2] no-empty: [2, {allowEmptyCatch: true}] no-eq-null: [2] no-eval: [2] @@ -254,7 +257,7 @@ rules: no-irregular-whitespace: [2] no-iterator: [2] no-label-var: [2] - no-labels: [2] + no-labels: [0] # handled by no-restricted-syntax no-lone-blocks: [2] no-lonely-if: [0] no-loop-func: [0] @@ -269,6 +272,7 @@ rules: no-negated-condition: [0] no-nested-ternary: [0] no-new-func: [2] + no-new-native-nonconstructor: [2] no-new-object: [2] no-new-symbol: [2] no-new-wrappers: [2] @@ -333,7 +337,7 @@ rules: no-void: [2] no-warning-comments: [0] no-whitespace-before-property: [2] - no-with: [2] + no-with: [0] # handled by no-restricted-syntax nonblock-statement-body-position: [2] object-curly-newline: [0] object-curly-spacing: [2, never] @@ -378,11 +382,11 @@ rules: sonarjs/no-duplicated-branches: [0] sonarjs/no-element-overwrite: [2] sonarjs/no-empty-collection: [2] - sonarjs/no-extra-arguments: [0] + sonarjs/no-extra-arguments: [2] sonarjs/no-gratuitous-expressions: [2] sonarjs/no-identical-conditions: [2] - sonarjs/no-identical-expressions: [0] - sonarjs/no-identical-functions: [0] + sonarjs/no-identical-expressions: [2] + sonarjs/no-identical-functions: [2, 5] sonarjs/no-ignored-return: [2] sonarjs/no-inverted-boolean-check: [2] sonarjs/no-nested-switch: [0] @@ -394,7 +398,7 @@ rules: sonarjs/no-small-switch: [0] sonarjs/no-unused-collection: [2] sonarjs/no-use-of-empty-return-value: [2] - sonarjs/no-useless-catch: [0] + sonarjs/no-useless-catch: [2] sonarjs/non-existent-operator: [2] sonarjs/prefer-immediate-return: [0] sonarjs/prefer-object-literal: [0] @@ -443,6 +447,7 @@ rules: unicorn/no-invalid-remove-event-listener: [2] unicorn/no-keyword-prefix: [0] unicorn/no-lonely-if: [2] + unicorn/no-negated-condition: [0] unicorn/no-nested-ternary: [0] unicorn/no-new-array: [0] unicorn/no-new-buffer: [0] @@ -453,6 +458,7 @@ rules: unicorn/no-static-only-class: [2] unicorn/no-thenable: [2] unicorn/no-this-assignment: [2] + unicorn/no-typeof-undefined: [2] unicorn/no-unnecessary-await: [2] unicorn/no-unreadable-array-destructuring: [0] unicorn/no-unreadable-iife: [2] @@ -491,7 +497,7 @@ rules: unicorn/prefer-native-coercion-functions: [2] unicorn/prefer-negative-index: [2] unicorn/prefer-node-append: [0] - unicorn/prefer-node-protocol: [0] + unicorn/prefer-node-protocol: [2] unicorn/prefer-node-remove: [0] unicorn/prefer-number-properties: [0] unicorn/prefer-object-from-entries: [2] @@ -503,6 +509,7 @@ rules: unicorn/prefer-regexp-test: [2] unicorn/prefer-replace-all: [0] unicorn/prefer-set-has: [0] + unicorn/prefer-set-size: [2] unicorn/prefer-spread: [0] unicorn/prefer-starts-ends-with: [2] unicorn/prefer-string-slice: [0] diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3a12bb8f721e6..b752abb794dec 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,9 +1,9 @@ - Please check the following: - -1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for bug fixes. -2. Read contributing guidelines: https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md -3. Describe what your pull request does and which issue you're targeting (if any) - ---> +1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for backports. +2. Make sure you have read contributing guidelines: https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md . +3. Describe what your pull request does and which issue you're targeting (if any). +4. It is recommended to enable "Allow edits by maintainers", so maintainers can help more easily. +5. Your input here will be included in the commit message when this PR has been merged. If you don't want some content to be included, please separate them with a line like `---`. +6. Delete all these tips before posting. + diff --git a/.gitpod.yml b/.gitpod.yml index 0b6ad1f30ec7a..a184e6376ebb3 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -7,10 +7,6 @@ tasks: command: | gp sync-done setup exit 0 - - name: Run frontend - command: | - gp sync-await setup - make watch-frontend - name: Run backend command: | gp sync-await setup @@ -19,9 +15,15 @@ tasks: echo -e "\n[database]\nDB_TYPE = sqlite3\nPATH = $GITPOD_REPO_ROOT/data/gitea.db" >> custom/conf/app.ini export TAGS="sqlite sqlite_unlock_notify" make watch-backend + - name: Run frontend + command: | + gp sync-await setup + make watch-frontend + openMode: split-right - name: Run docs before: sudo bash -c "$(grep 'https://github.com/gohugoio/hugo/releases/download' Makefile | tr -d '\')" # install hugo command: cd docs && make clean update && hugo server -D -F --baseUrl $(gp url 1313) --liveReloadPort=443 --appendPort=false --bind=0.0.0.0 + openMode: split-right vscode: extensions: diff --git a/.golangci.yml b/.golangci.yml index 99133badd9b86..263149f773ecb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,34 +1,34 @@ linters: enable: - - gosimple - - deadcode - - typecheck - - govet - - errcheck - - staticcheck - - unused - - structcheck - - varcheck + - bidichk + # - deadcode # deprecated - https://github.com/golangci/golangci-lint/issues/1841 + - depguard - dupl - #- gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time. - - gofmt + - errcheck - gocritic - - bidichk - - ineffassign - - revive + # - gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time. + - gofmt - gofumpt - - depguard + - gosimple + - govet + - ineffassign - nakedret - - unconvert - - wastedassign - nolintlint + - revive + - staticcheck + # - structcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841 - stylecheck + - typecheck + - unconvert + - unused + # - varcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841 + # - wastedassign # disabled - https://github.com/golangci/golangci-lint/issues/2649 enable-all: false disable-all: true fast: false run: - go: 1.19 + go: "1.20" timeout: 10m skip-dirs: - node_modules @@ -74,15 +74,17 @@ linters-settings: - name: modifies-value-receiver gofumpt: extra-rules: true - lang-version: "1.19" + lang-version: "1.20" depguard: - # TODO: use depguard to replace import checks in gitea-vet list-type: denylist # Check the list against standard lib. include-go-root: true packages-with-error-message: - encoding/json: "use gitea's modules/json instead of encoding/json" - github.com/unknwon/com: "use gitea's util and replacements" + - io/ioutil: "use os or io instead" + - golang.org/x/exp: "it's experimental and unreliable." + - code.gitea.io/gitea/modules/git/internal: "do not use the internal package, use AddXxx function instead" issues: max-issues-per-linter: 0 diff --git a/.stylelintrc.yaml b/.stylelintrc.yaml index 9bad55d371e5c..62660fcf94409 100644 --- a/.stylelintrc.yaml +++ b/.stylelintrc.yaml @@ -1,32 +1,137 @@ -extends: stylelint-config-standard +plugins: + - stylelint-declaration-strict-value + +ignoreFiles: + - "**/*.go" overrides: - - files: ["**/*.less"] - customSyntax: postcss-less + - files: ["**/chroma/*", "**/codemirror/*", "**/standalone/*", "**/console/*"] + rules: + scale-unlimited/declaration-strict-value: null + - files: ["**/chroma/*", "**/codemirror/*"] + rules: + block-no-empty: null rules: alpha-value-notation: null + annotation-no-unknown: true + at-rule-allowed-list: null + at-rule-disallowed-list: null at-rule-empty-line-before: null - block-closing-brace-empty-line-before: null + at-rule-no-unknown: true + at-rule-no-vendor-prefix: true + at-rule-property-required-list: null + block-no-empty: true color-function-notation: null + color-hex-alpha: null color-hex-length: null + color-named: null + color-no-hex: null + color-no-invalid-hex: true comment-empty-line-before: null + comment-no-empty: true + comment-pattern: null + comment-whitespace-inside: null + comment-word-disallowed-list: null + custom-media-pattern: null + custom-property-empty-line-before: null + custom-property-no-missing-var-function: true + custom-property-pattern: null + declaration-block-no-duplicate-custom-properties: true + declaration-block-no-duplicate-properties: [true, {ignore: [consecutive-duplicates-with-different-values]}] declaration-block-no-redundant-longhand-properties: null + declaration-block-no-shorthand-property-overrides: null declaration-block-single-line-max-declarations: null declaration-empty-line-before: null + declaration-no-important: null + declaration-property-max-values: null + declaration-property-unit-allowed-list: null + declaration-property-unit-disallowed-list: null + declaration-property-value-allowed-list: null + declaration-property-value-disallowed-list: null + declaration-property-value-no-unknown: true + font-family-name-quotes: always-where-recommended + font-family-no-duplicate-names: true + font-family-no-missing-generic-family-keyword: true + font-weight-notation: null + function-allowed-list: null + function-calc-no-unspaced-operator: true + function-disallowed-list: null + function-linear-gradient-no-nonstandard-direction: true + function-name-case: lower function-no-unknown: null + function-url-no-scheme-relative: null + function-url-quotes: always + function-url-scheme-allowed-list: null + function-url-scheme-disallowed-list: null hue-degree-notation: null - indentation: 2 - max-line-length: null + import-notation: string + keyframe-block-no-duplicate-selectors: true + keyframe-declaration-no-important: true + keyframe-selector-notation: null + keyframes-name-pattern: null + length-zero-no-unit: true + max-nesting-depth: null + media-feature-name-allowed-list: null + media-feature-name-disallowed-list: null + media-feature-name-no-unknown: true + media-feature-name-no-vendor-prefix: true + media-feature-name-unit-allowed-list: null + media-feature-name-value-allowed-list: null + media-feature-range-notation: null + named-grid-areas-no-invalid: true no-descending-specificity: null + no-duplicate-at-import-rules: true + no-duplicate-selectors: true + no-empty-source: true + no-invalid-double-slash-comments: true no-invalid-position-at-import-rule: null - number-leading-zero: never + no-irregular-whitespace: true + no-unknown-animations: null number-max-precision: null + property-allowed-list: null + property-disallowed-list: null + property-no-unknown: true property-no-vendor-prefix: null rule-empty-line-before: null + rule-selector-property-disallowed-list: null + scale-unlimited/declaration-strict-value: [color, {ignoreValues: /^(inherit|transparent|unset|initial|currentcolor)$/}] + selector-attribute-name-disallowed-list: null + selector-attribute-operator-allowed-list: null + selector-attribute-operator-disallowed-list: null + selector-attribute-quotes: always selector-class-pattern: null + selector-combinator-allowed-list: null + selector-combinator-disallowed-list: null + selector-disallowed-list: null selector-id-pattern: null + selector-max-attribute: null + selector-max-class: null + selector-max-combinators: null + selector-max-compound-selectors: null + selector-max-id: null + selector-max-pseudo-class: null + selector-max-specificity: null + selector-max-type: null + selector-max-universal: null + selector-nested-pattern: null + selector-no-qualifying-type: null + selector-no-vendor-prefix: true + selector-not-notation: null + selector-pseudo-class-allowed-list: null + selector-pseudo-class-disallowed-list: null + selector-pseudo-class-no-unknown: true + selector-pseudo-element-allowed-list: null selector-pseudo-element-colon-notation: double + selector-pseudo-element-disallowed-list: null + selector-pseudo-element-no-unknown: true + selector-type-case: lower + selector-type-no-unknown: [true, {ignore: [custom-elements]}] shorthand-property-no-redundant-values: true - string-quotes: null - value-no-vendor-prefix: null + string-no-newline: true + time-min-milliseconds: null + unit-allowed-list: null + unit-disallowed-list: null + unit-no-unknown: true + value-keyword-case: null + value-no-vendor-prefix: [true, {ignoreValues: [box, inline-box]}] diff --git a/CHANGELOG.md b/CHANGELOG.md index 1150d70081ebd..324b0cdfd6023 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,716 @@ This changelog goes through all the changes that have been made in each release without substantial changes to our git log; to see the highlights of what has been added to each release, please refer to the [blog](https://blog.gitea.io). +## [1.19.0](https://github.com/go-gitea/gitea/releases/tag/1.19.0) - 2023-03-19 + +* BREAKING + * Add loading yaml label template files (#22976) (#23232) + * Make issue and code search support camel case for Bleve (#22829) + * Repositories: by default disable all units except code and pulls on forks (#22541) + * Support template for merge message description (#22248) + * Remove ONLY_SHOW_RELEVANT_REPOS setting (#21962) + * Implement actions (#21937) + * Remove deprecated DSA host key from Docker Container (#21522) + * Improve valid user name check (#20136) +* SECURITY + * Return 404 instead of 403 if user can not access the repo (#23155) (#23158) + * Support scoped access tokens (#20908) +* FEATURES + * Add support for commit cross references (#22645) + * Scoped labels (#22585) + * Add Chef package registry (#22554) + * Support asciicast files as new markup (#22448) + * cgo cross-compile for freebsd (#22397) + * Add cron method to gc LFS MetaObjects (#22385) + * Add new captcha: cloudflare turnstile (#22369) + * Enable `@`- completion popup on the release description textarea (#22359) + * make /{username}.png redirect to user/org avatar (#22356) + * Add Conda package registry (#22262) + * Support org/user level projects (#22235) + * Add Mermaid copy button (#22225) + * Add user secrets (#22191) + * Secrets storage with SecretKey encrypted (#22142) + * Preview images for Issue cards in Project Board view (#22112) + * Add support for incoming emails (#22056) + * Add Cargo package registry (#21888) + * Add option to prohibit fork if user reached maximum limit of repositories (#21848) + * Add attention blocks within quote blocks for `Note` and `Warning` (#21711) + * Add Feed for Releases and Tags (#21696) + * Add package registry cleanup rules (#21658) + * Add "Copy" button to file view of raw text (#21629) + * Allow disable sitemap (#21617) + * Add package registry quota limits (#21584) + * Map OIDC groups to Orgs/Teams (#21441) + * Keep languages defined in .gitattributes (#21403) + * Add Webhook authorization header (#20926) + * Supports wildcard protected branch (#20825) + * Copy citation file content, in APA and BibTex format, on repo home page (#19999) +* API + * Match api migration behavior to web behavior (#23552) (#23573) + * Purge API comment (#23451) (#23452) + * User creation API: allow custom "created" timestamps (#22549) + * Add `updated_at` field to PullReview API object (#21812) + * Add API management for issue/pull and comment attachments (#21783) + * Add API endpoint to get latest release (#21267) + * Support system hook API (#14537) +* ENHANCEMENTS + * Add `.patch` to `attachment.ALLOWED_TYPES` (#23580) (#23582) + * Fix sticky header in diff view (#23554) (#23568) + * Refactor merge/update git command calls (#23366) (#23544) + * Fix review comment context menu clipped bug (#23523) (#23543) + * Imrove scroll behavior to hash issuecomment(scroll position, auto expand if file is folded, and on refreshing) (#23513) (#23540) + * Increase horizontal page padding (#23507) (#23537) + * Use octicon-verified for gpg signatures (#23529) (#23536) + * Make time tooltips interactive (#23526) (#23527) + * Replace Less with CSS (#23508) + * Fix 'View File' button in code search (#23478) (#23483) + * Convert GitHub event on actions and fix some pull_request events. (#23037) (#23471) + * Support reflogs (#22451) (#23438) + * Fix actions frontend bugs (pagination, long name alignment) and small simplify (#23370) (#23436) + * Scoped label display and documentation tweaks (#23430) (#23433) + * Add missing tabs to org projects page (#22705) (#23412) + * Fix and move "Use this template" button (#23398) (#23408) + * Handle OpenID discovery URL errors a little nicer when creating/editing sources (#23397) (#23403) + * Rename `canWriteUnit` to `canWriteProjects` (#23386) (#23399) + * Refactor and tidy-up the merge/update branch code (#22568) (#23365) + * Refactor `setting.Database.UseXXX` to methods (#23354) (#23356) + * Fix incorrect project links and use symlink icon for org-wide projects (#23325) (#23336) + * Fix PR view misalignment caused by long name file (#23321) (#23335) + * Scoped labels: don't require holding alt key to remove (#23303) (#23331) + * Add context when rendering labels or emojis (#23281) (#23319) + * Change interactiveBorder to fix popup preview (#23169) (#23314) + * Scoped labels: set aria-disabled on muted Exclusive option for a11y (#23306) (#23311) + * update to mermaid v10 (#23178) (#23299) + * Fix code wrap for unbroken lines (#23268) (#23293) + * Use async await to fix empty quote reply at first time (#23168) (#23256) + * Fix switched citation format (#23250) (#23253) + * Allow `