Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
* upstream/main: (31 commits)
  Show OAuth2 errors to end users (go-gitea#25261)
  [skip ci] Updated translations via Crowdin
  Fix index generation parallelly failure (go-gitea#25235)
  Fix variable in template (go-gitea#25267)
  Add template linting via djlint (go-gitea#25212)
  Fix edit OAuth application width (go-gitea#25262)
  Use flex to align SVG and text (go-gitea#25163)
  GitHub Actions enhancements for frontend (go-gitea#25150)
  Add missing `v` in migrations.go (go-gitea#25252)
  Change form actions to fetch for submit review box (go-gitea#25219)
  Fix panic when migrating a repo from GitHub with issues (go-gitea#25246)
  Fix description of drop custom_labels migration (go-gitea#25243)
  Fix all possible setting error related storages and added some tests (go-gitea#23911)
  [skip ci] Updated translations via Crowdin
  Revert overflow: overlay (revert go-gitea#21850) (go-gitea#25231)
  Support changing labels of Actions runner without re-registration (go-gitea#24806)
  Improve AJAX link and modal confirm dialog (go-gitea#25210)
  Use inline SVG for built-in OAuth providers (go-gitea#25171)
  Disable `Create column` button while the column name is empty  (go-gitea#25192)
  Fix profile render when the README.md size is larger than 1024 bytes (go-gitea#25131)
  ...
  • Loading branch information
zjjhot committed Jun 15, 2023
2 parents 1fa6c06 + 73ae718 commit de2c98c
Show file tree
Hide file tree
Showing 225 changed files with 10,426 additions and 1,390 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/files-changed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
actions:
description: "whether actions files changed"
value: ${{ jobs.detect.outputs.actions }}
templates:
description: "whether templates files changed"
value: ${{ jobs.detect.outputs.templates }}

jobs:
detect:
Expand All @@ -27,6 +30,7 @@ jobs:
frontend: ${{ steps.changes.outputs.frontend }}
docs: ${{ steps.changes.outputs.docs }}
actions: ${{ steps.changes.outputs.actions }}
templates: ${{ steps.changes.outputs.templates }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
Expand All @@ -35,7 +39,7 @@ jobs:
filters: |
backend:
- "**/*.go"
- "**/*.tmpl"
- "templates/**/*.tmpl"
- "go.mod"
- "go.sum"
Expand All @@ -51,3 +55,6 @@ jobs:
actions:
- ".github/workflows/*"
templates:
- "templates/**/*.tmpl"
37 changes: 24 additions & 13 deletions .github/workflows/pull-compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: ./.github/workflows/files-changed.yml

lint-backend:
if: needs.files-changed.outputs.backend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
Expand All @@ -26,8 +26,21 @@ jobs:
env:
TAGS: bindata sqlite sqlite_unlock_notify

lint-templates:
if: needs.files-changed.outputs.templates == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- run: pip install poetry
- run: make deps-py
- run: make lint-templates

lint-go-windows:
if: needs.files-changed.outputs.backend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
Expand All @@ -44,7 +57,7 @@ jobs:
GOARCH: amd64

lint-go-gogit:
if: needs.files-changed.outputs.backend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
Expand All @@ -59,7 +72,7 @@ jobs:
TAGS: bindata gogit sqlite sqlite_unlock_notify

checks-backend:
if: needs.files-changed.outputs.backend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
Expand All @@ -72,7 +85,7 @@ jobs:
- run: make --always-make checks-backend # ensure the "go-licenses" make target runs

frontend:
if: needs.files-changed.outputs.frontend == 'true'
if: needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
Expand All @@ -83,9 +96,10 @@ jobs:
- run: make deps-frontend
- run: make lint-frontend
- run: make checks-frontend
- run: make frontend

backend:
if: needs.files-changed.outputs.backend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
Expand All @@ -94,12 +108,9 @@ jobs:
with:
go-version: ">=1.20"
check-latest: true
- uses: actions/setup-node@v3
with:
node-version: 20
# no frontend build here as backend should be able to build
# even without any frontend files
- run: make deps-backend deps-tools
- run: make deps-frontend
- run: make frontend
- run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
- name: build-backend-arm64
run: make backend # test cross compile
Expand All @@ -120,7 +131,7 @@ jobs:
GOARCH: 386

docs:
if: needs.files-changed.outputs.docs == 'true'
if: needs.files-changed.outputs.docs == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
Expand All @@ -133,7 +144,7 @@ jobs:
- run: make docs # test if build could succeed

actions:
if: needs.files-changed.outputs.actions == 'true'
if: needs.files-changed.outputs.actions == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/pull-db-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: ./.github/workflows/files-changed.yml

test-pgsql:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
services:
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
USE_REPO_TEST_DIR: 1

test-sqlite:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
Expand All @@ -81,7 +81,7 @@ jobs:
USE_REPO_TEST_DIR: 1

test-unit:
if: needs.files-changed.outputs.backend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
services:
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}

test-mysql5:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
services:
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200"

test-mysql8:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
services:
Expand Down Expand Up @@ -222,7 +222,7 @@ jobs:
USE_REPO_TEST_DIR: 1

test-mssql:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
services:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-docker-dryrun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: ./.github/workflows/files-changed.yml

docker-dryrun:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: ./.github/workflows/files-changed.yml

test-e2e:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ cpu.out
/tests/*.ini
/tests/**/*.git/**/*.sample
/node_modules
/.venv
/yarn.lock
/yarn-error.log
/npm-debug.log*
Expand Down
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ help:
@echo " - deps-frontend install frontend dependencies"
@echo " - deps-backend install backend dependencies"
@echo " - deps-tools install tool dependencies"
@echo " - deps-py install python dependencies"
@echo " - lint lint everything"
@echo " - lint-fix lint everything and fix issues"
@echo " - lint-actions lint action workflow files"
Expand All @@ -214,6 +215,7 @@ help:
@echo " - lint-css-fix lint css files and fix issues"
@echo " - lint-md lint markdown files"
@echo " - lint-swagger lint swagger files"
@echo " - lint-templates lint template files"
@echo " - checks run various consistency checks"
@echo " - checks-frontend check frontend files"
@echo " - checks-backend check backend files"
Expand Down Expand Up @@ -417,6 +419,10 @@ lint-editorconfig:
lint-actions:
$(GO) run $(ACTIONLINT_PACKAGE)

.PHONY: lint-templates
lint-templates: .venv
@poetry run djlint $(shell find templates -type f -iname '*.tmpl')

.PHONY: watch
watch:
@bash build/watch.sh
Expand Down Expand Up @@ -893,7 +899,10 @@ deps-docs:
fi

.PHONY: deps
deps: deps-frontend deps-backend deps-tools deps-docs
deps: deps-frontend deps-backend deps-tools deps-docs deps-py

.PHONY: deps-py
deps-py: .venv

.PHONY: deps-frontend
deps-frontend: node_modules
Expand All @@ -920,6 +929,10 @@ node_modules: package-lock.json
npm install --no-save
@touch node_modules

.venv: poetry.lock
poetry install
@touch .venv

.PHONY: npm-update
npm-update: node-check | node_modules
npx updates -cu
Expand Down
6 changes: 3 additions & 3 deletions cmd/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@ func runDump(ctx *cli.Context) error {
}

excludes = append(excludes, setting.RepoRootPath)
excludes = append(excludes, setting.LFS.Path)
excludes = append(excludes, setting.Attachment.Path)
excludes = append(excludes, setting.Packages.Path)
excludes = append(excludes, setting.LFS.Storage.Path)
excludes = append(excludes, setting.Attachment.Storage.Path)
excludes = append(excludes, setting.Packages.Storage.Path)
excludes = append(excludes, setting.Log.RootPath)
excludes = append(excludes, absFileName)
if err := addRecursiveExclude(w, "data", setting.AppDataPath, excludes, verbose); err != nil {
Expand Down
28 changes: 15 additions & 13 deletions cmd/migrate_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,30 +179,32 @@ func runMigrateStorage(ctx *cli.Context) error {
switch strings.ToLower(ctx.String("storage")) {
case "":
fallthrough
case string(storage.LocalStorageType):
case string(setting.LocalStorageType):
p := ctx.String("path")
if p == "" {
log.Fatal("Path must be given when storage is loal")
return nil
}
dstStorage, err = storage.NewLocalStorage(
stdCtx,
storage.LocalStorageConfig{
&setting.Storage{
Path: p,
})
case string(storage.MinioStorageType):
case string(setting.MinioStorageType):
dstStorage, err = storage.NewMinioStorage(
stdCtx,
storage.MinioStorageConfig{
Endpoint: ctx.String("minio-endpoint"),
AccessKeyID: ctx.String("minio-access-key-id"),
SecretAccessKey: ctx.String("minio-secret-access-key"),
Bucket: ctx.String("minio-bucket"),
Location: ctx.String("minio-location"),
BasePath: ctx.String("minio-base-path"),
UseSSL: ctx.Bool("minio-use-ssl"),
InsecureSkipVerify: ctx.Bool("minio-insecure-skip-verify"),
ChecksumAlgorithm: ctx.String("minio-checksum-algorithm"),
&setting.Storage{
MinioConfig: setting.MinioStorageConfig{
Endpoint: ctx.String("minio-endpoint"),
AccessKeyID: ctx.String("minio-access-key-id"),
SecretAccessKey: ctx.String("minio-secret-access-key"),
Bucket: ctx.String("minio-bucket"),
Location: ctx.String("minio-location"),
BasePath: ctx.String("minio-base-path"),
UseSSL: ctx.Bool("minio-use-ssl"),
InsecureSkipVerify: ctx.Bool("minio-insecure-skip-verify"),
ChecksumAlgorithm: ctx.String("minio-checksum-algorithm"),
},
})
default:
return fmt.Errorf("unsupported storage type: %s", ctx.String("storage"))
Expand Down
3 changes: 2 additions & 1 deletion cmd/migrate_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
packages_module "code.gitea.io/gitea/modules/packages"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/storage"
packages_service "code.gitea.io/gitea/services/packages"

Expand Down Expand Up @@ -57,7 +58,7 @@ func TestMigratePackages(t *testing.T) {

dstStorage, err := storage.NewLocalStorage(
ctx,
storage.LocalStorageConfig{
&setting.Storage{
Path: p,
})
assert.NoError(t, err)
Expand Down
21 changes: 21 additions & 0 deletions custom/conf/app.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2392,6 +2392,10 @@ LEVEL = Info
;; Enable/Disable package registry capabilities
;ENABLED = true
;;
;STORAGE_TYPE = local
;; override the minio base path if storage type is minio
;MINIO_BASE_PATH = packages/
;;
;; Path for chunked uploads. Defaults to APP_DATA_PATH + `tmp/package-upload`
;CHUNKED_UPLOAD_PATH = tmp/package-upload
;;
Expand Down Expand Up @@ -2452,6 +2456,19 @@ LEVEL = Info
;; storage type
;STORAGE_TYPE = local

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; repo-archive storage will override storage
;;
;[repo-archive]
;STORAGE_TYPE = local
;;
;; Where your lfs files reside, default is data/lfs.
;PATH = data/repo-archive
;;
;; override the minio base path if storage type is minio
;MINIO_BASE_PATH = repo-archive/

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; settings for repository archives, will override storage setting
Expand All @@ -2471,6 +2488,9 @@ LEVEL = Info
;;
;; Where your lfs files reside, default is data/lfs.
;PATH = data/lfs
;;
;; override the minio base path if storage type is minio
;MINIO_BASE_PATH = lfs/

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down Expand Up @@ -2520,6 +2540,7 @@ LEVEL = Info
; [actions]
;; Enable/Disable actions capabilities
;ENABLED = false
;;
;; Default address to get action plugins, e.g. the default value means downloading from "https://gitea.com/actions/checkout" for "uses: actions/checkout@v3"
;DEFAULT_ACTIONS_URL = https://gitea.com

Expand Down
Loading

0 comments on commit de2c98c

Please sign in to comment.