Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
* upstream/main:
  Harmonize title formatting in `docs/content/doc/development/api-usage.en-us.md` (go-gitea#24529)
  automate locking closed threads (go-gitea#24525)
  [skip ci] Updated translations via Crowdin
  Display warning when user try to rename default branch (go-gitea#24512)
  Upgrade to Node 20 on CI, enable actions cancellation (go-gitea#24524)
  Fix incorrectly quoted translation (go-gitea#24514)
  Fix color for transfer related buttons when having no permission to act (go-gitea#24510)
  Fix some mistakes when using `ignSignIn` (go-gitea#24415)
  Remove unused zapx replace statement on go.mod (go-gitea#24515)
  Don't display creating page button in a mirror wiki repository (go-gitea#24395)
  Improve template system and panic recovery (go-gitea#24461)
  Faster git.GetDivergingCommits (go-gitea#24482)
  Merge setting.InitXXX into one function with options (go-gitea#24389)
  • Loading branch information
zjjhot committed May 5, 2023
2 parents 5c32bab + 78fdbaf commit 43987ed
Show file tree
Hide file tree
Showing 72 changed files with 617 additions and 568 deletions.
8 changes: 4 additions & 4 deletions .drone.yml
Expand Up @@ -33,7 +33,7 @@ steps:
- git fetch --tags --force

- name: deps-frontend
image: node:18
image: node:20
pull: always
commands:
- make deps-frontend
Expand All @@ -51,7 +51,7 @@ steps:
image: techknowlogick/xgo:go-1.20.x
pull: always
commands:
# Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved
# Upgrade to node 20 once https://github.com/techknowlogick/xgo/issues/163 is resolved
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
- export PATH=$PATH:$GOPATH/bin
- make release
Expand Down Expand Up @@ -161,7 +161,7 @@ steps:
- git fetch --tags --force

- name: deps-frontend
image: node:18
image: node:20
pull: always
commands:
- make deps-frontend
Expand All @@ -179,7 +179,7 @@ steps:
image: techknowlogick/xgo:go-1.20.x
pull: always
commands:
# Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved
# Upgrade to node 20 once https://github.com/techknowlogick/xgo/issues/163 is resolved
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
- export PATH=$PATH:$GOPATH/bin
- make release
Expand Down
23 changes: 0 additions & 23 deletions .github/lock.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/lock.yml
@@ -0,0 +1,21 @@
name: 'Lock Threads'

on:
schedule:
- cron: '0 0 * * *' # Run once a day
workflow_dispatch:

permissions:
issues: write
pull-requests: write

concurrency:
group: lock

jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v4
with:
issue-inactive-days: 45
8 changes: 6 additions & 2 deletions .github/workflows/pull-compliance.yml
Expand Up @@ -2,6 +2,10 @@ name: "Pull: Compliance Tests"

on: [pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
lint_basic:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -79,7 +83,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- name: deps-frontend
run: make deps-frontend
- name: lint frontend
Expand All @@ -100,7 +104,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- name: deps-backend
run: make deps-backend deps-tools
- name: deps-frontend
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/pull-compliance_docs.yml
Expand Up @@ -6,16 +6,20 @@ on:
- "docs/**"
- "*.md"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
compliance-docs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- name: install dependencies
run: make deps-frontend
- name: lint markdown
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pull-db_test.yml
Expand Up @@ -2,6 +2,10 @@ name: "Pull: Database Tests"

on: [pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
# PostgreSQL Tests
db_pgsql_test:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pull-docker_dryrun.yml
Expand Up @@ -2,6 +2,10 @@ name: "Pull: Docker Dry Run"

on: [pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
docker_dryrun:
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/pull-e2e.yml
Expand Up @@ -2,6 +2,10 @@ name: "Pull: E2E Tests"

on: [pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
e2e_tests:
runs-on: ubuntu-latest
Expand All @@ -15,7 +19,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- name: build
run: make deps-frontend frontend deps-backend
- name: Install playwright browsers
Expand Down
3 changes: 1 addition & 2 deletions cmd/actions.go
Expand Up @@ -42,8 +42,7 @@ func runGenerateActionsRunnerToken(c *cli.Context) error {
ctx, cancel := installSignals()
defer cancel()

setting.InitProviderFromExistingFile()
setting.LoadCommonSettings()
setting.Init(&setting.Options{})

scope := c.String("scope")

Expand Down
3 changes: 1 addition & 2 deletions cmd/cmd.go
Expand Up @@ -57,8 +57,7 @@ func confirm() (bool, error) {
}

func initDB(ctx context.Context) error {
setting.InitProviderFromExistingFile()
setting.LoadCommonSettings()
setting.Init(&setting.Options{})
setting.LoadDBSetting()
setting.InitSQLLog(false)

Expand Down
3 changes: 1 addition & 2 deletions cmd/doctor.go
Expand Up @@ -87,8 +87,7 @@ func runRecreateTable(ctx *cli.Context) error {
golog.SetPrefix("")
golog.SetOutput(log.NewLoggerAsWriter("INFO", log.GetLogger(log.DEFAULT)))

setting.InitProviderFromExistingFile()
setting.LoadCommonSettings()
setting.Init(&setting.Options{})
setting.LoadDBSetting()

setting.Log.EnableXORMLog = ctx.Bool("debug")
Expand Down
3 changes: 1 addition & 2 deletions cmd/dump.go
Expand Up @@ -185,8 +185,7 @@ func runDump(ctx *cli.Context) error {
}
fileName += "." + outType
}
setting.InitProviderFromExistingFile()
setting.LoadCommonSettings()
setting.Init(&setting.Options{})

// make sure we are logging to the console no matter what the configuration tells us do to
// FIXME: don't use CfgProvider directly
Expand Down
5 changes: 3 additions & 2 deletions cmd/embedded.go
Expand Up @@ -106,8 +106,9 @@ func initEmbeddedExtractor(c *cli.Context) error {
log.DelNamedLogger(log.DEFAULT)

// Read configuration file
setting.InitProviderAllowEmpty()
setting.LoadCommonSettings()
setting.Init(&setting.Options{
AllowEmpty: true,
})

patterns, err := compileCollectPatterns(c.Args())
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions cmd/mailer.go
Expand Up @@ -16,8 +16,7 @@ func runSendMail(c *cli.Context) error {
ctx, cancel := installSignals()
defer cancel()

setting.InitProviderFromExistingFile()
setting.LoadCommonSettings()
setting.Init(&setting.Options{})

if err := argsSet(c, "title"); err != nil {
return err
Expand Down
6 changes: 0 additions & 6 deletions cmd/main_test.go
Expand Up @@ -7,14 +7,8 @@ import (
"testing"

"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/setting"
)

func init() {
setting.SetCustomPathAndConf("", "", "")
setting.InitProviderAndLoadCommonSettingsForTest()
}

func TestMain(m *testing.M) {
unittest.MainTest(m, &unittest.TestOptions{
GiteaRootPath: "..",
Expand Down
3 changes: 1 addition & 2 deletions cmd/restore_repo.go
Expand Up @@ -51,8 +51,7 @@ func runRestoreRepository(c *cli.Context) error {
ctx, cancel := installSignals()
defer cancel()

setting.InitProviderFromExistingFile()
setting.LoadCommonSettings()
setting.Init(&setting.Options{})
var units []string
if s := c.String("units"); s != "" {
units = strings.Split(s, ",")
Expand Down
3 changes: 1 addition & 2 deletions cmd/serv.go
Expand Up @@ -62,8 +62,7 @@ func setup(ctx context.Context, debug bool) {
} else {
_ = log.NewLogger(1000, "console", "console", `{"level":"fatal","stacktracelevel":"NONE","stderr":true}`)
}
setting.InitProviderFromExistingFile()
setting.LoadCommonSettings()
setting.Init(&setting.Options{})
if debug {
setting.RunMode = "dev"
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/web.go
Expand Up @@ -177,8 +177,7 @@ func runWeb(ctx *cli.Context) error {

log.Info("Global init")
// Perform global initialization
setting.InitProviderFromExistingFile()
setting.LoadCommonSettings()
setting.Init(&setting.Options{})
routers.GlobalInitInstalled(graceful.GetManager().HammerContext())

// We check that AppDataPath exists here (it should have been created during installation)
Expand Down
2 changes: 1 addition & 1 deletion docs/content/doc/development/api-usage.en-us.md
Expand Up @@ -119,7 +119,7 @@ curl -v "http://localhost/api/v1/repos/search?limit=1"
< x-total-count: 5252
```
## API Guide:
## API Guide
API Reference guide is auto-generated by swagger and available on:
`https://gitea.your.host/api/swagger`
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Expand Up @@ -290,8 +290,6 @@ replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1

replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142115-2c99e1ffdfa0

replace github.com/blevesearch/zapx/v15 v15.3.6 => github.com/zeripath/zapx/v15 v15.3.6-alignment-fix

replace github.com/nektos/act => gitea.com/gitea/act v0.243.4

exclude github.com/gofrs/uuid v3.2.0+incompatible
Expand Down
6 changes: 0 additions & 6 deletions models/asymkey/main_test.go
Expand Up @@ -8,14 +8,8 @@ import (
"testing"

"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/setting"
)

func init() {
setting.SetCustomPathAndConf("", "", "")
setting.InitProviderAndLoadCommonSettingsForTest()
}

func TestMain(m *testing.M) {
unittest.MainTest(m, &unittest.TestOptions{
GiteaRootPath: filepath.Join("..", ".."),
Expand Down
6 changes: 0 additions & 6 deletions models/dbfs/main_test.go
Expand Up @@ -8,14 +8,8 @@ import (
"testing"

"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/setting"
)

func init() {
setting.SetCustomPathAndConf("", "", "")
setting.InitProviderAndLoadCommonSettingsForTest()
}

func TestMain(m *testing.M) {
unittest.MainTest(m, &unittest.TestOptions{
GiteaRootPath: filepath.Join("..", ".."),
Expand Down
6 changes: 0 additions & 6 deletions models/issues/main_test.go
Expand Up @@ -9,7 +9,6 @@ import (

issues_model "code.gitea.io/gitea/models/issues"
"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/setting"

_ "code.gitea.io/gitea/models"
_ "code.gitea.io/gitea/models/repo"
Expand All @@ -18,11 +17,6 @@ import (
"github.com/stretchr/testify/assert"
)

func init() {
setting.SetCustomPathAndConf("", "", "")
setting.InitProviderAndLoadCommonSettingsForTest()
}

func TestFixturesAreConsistent(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
unittest.CheckConsistencyFor(t,
Expand Down
6 changes: 0 additions & 6 deletions models/main_test.go
Expand Up @@ -11,18 +11,12 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/setting"

_ "code.gitea.io/gitea/models/system"

"github.com/stretchr/testify/assert"
)

func init() {
setting.SetCustomPathAndConf("", "", "")
setting.InitProviderAndLoadCommonSettingsForTest()
}

// TestFixturesAreConsistent assert that test fixtures are consistent
func TestFixturesAreConsistent(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
Expand Down
2 changes: 1 addition & 1 deletion models/migrations/base/tests.go
Expand Up @@ -150,7 +150,7 @@ func MainTest(m *testing.M) {
setting.AppDataPath = tmpDataPath

setting.SetCustomPathAndConf("", "", "")
setting.InitProviderAndLoadCommonSettingsForTest()
unittest.InitSettings()
if err = git.InitFull(context.Background()); err != nil {
fmt.Printf("Unable to InitFull: %v\n", err)
os.Exit(1)
Expand Down

0 comments on commit 43987ed

Please sign in to comment.