mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-29 05:06:11 +01:00
Compare commits
9 commits
c18c9e0881
...
152526a687
Author | SHA1 | Date | |
---|---|---|---|
152526a687 | |||
296935b0d7 | |||
e426a52a87 | |||
faa796feb9 | |||
19c9e0a0c2 | |||
ef9a0c8d3d | |||
d1520cf08d | |||
8206d509fc | |||
a5ba7cadf7 |
|
@ -135,20 +135,21 @@ jobs:
|
|||
needs: [backend-checks, frontend-checks, test-unit]
|
||||
container:
|
||||
image: 'code.forgejo.org/oci/node:20-bookworm'
|
||||
name: ${{ format('test-remote-cacher ({0})', matrix.cacher.name) }}
|
||||
strategy:
|
||||
matrix:
|
||||
cacher:
|
||||
# redis
|
||||
- image: docker.io/bitnami/redis:7.2
|
||||
- name: redis
|
||||
image: docker.io/bitnami/redis:7.2
|
||||
options: --tmpfs /bitnami/redis/data
|
||||
# redict
|
||||
- image: registry.redict.io/redict:7.3.0-scratch
|
||||
- name: redict
|
||||
image: registry.redict.io/redict:7.3.0-scratch
|
||||
options: --tmpfs /data
|
||||
# valkey
|
||||
- image: docker.io/bitnami/valkey:7.2
|
||||
- name: valkey
|
||||
image: docker.io/bitnami/valkey:7.2
|
||||
options: --tmpfs /bitnami/redis/data
|
||||
# garnet
|
||||
- image: ghcr.io/microsoft/garnet-alpine:1.0.14
|
||||
- name: garnet
|
||||
image: ghcr.io/microsoft/garnet-alpine:1.0.14
|
||||
options: --tmpfs /data
|
||||
services:
|
||||
cacher:
|
||||
|
@ -215,11 +216,13 @@ jobs:
|
|||
ldap:
|
||||
image: docker.io/gitea/test-openldap:latest
|
||||
pgsql:
|
||||
image: 'code.forgejo.org/oci/postgres:15'
|
||||
image: code.forgejo.org/oci/bitnami/postgresql:15
|
||||
env:
|
||||
POSTGRES_DB: test
|
||||
POSTGRES_PASSWORD: postgres
|
||||
options: --tmpfs /var/lib/postgresql/data
|
||||
POSTGRESQL_DATABASE: test
|
||||
POSTGRESQL_PASSWORD: postgres
|
||||
POSTGRESQL_FSYNC: off
|
||||
POSTGRESQL_EXTRA_FLAGS: -c full_page_writes=off
|
||||
options: --tmpfs /bitnami/postgresql
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/workflows-composite/setup-env
|
||||
|
|
|
@ -6,6 +6,10 @@ A [patch or minor release](https://semver.org/spec/v2.0.0.html) (e.g. upgrading
|
|||
|
||||
The release notes of each release [are available in the corresponding milestone](https://codeberg.org/forgejo/forgejo/milestones), starting with [Forgejo 7.0.7](https://codeberg.org/forgejo/forgejo/milestone/7683) and [Forgejo 8.0.1](https://codeberg.org/forgejo/forgejo/milestone/7682).
|
||||
|
||||
## 9.0.2
|
||||
|
||||
The Forgejo v9.0.2 release notes are [available in the v9.0.2 milestone](https://codeberg.org/forgejo/forgejo/milestone/8610.
|
||||
|
||||
## 9.0.1
|
||||
|
||||
The Forgejo v9.0.1 release notes are [available in the v9.0.1 milestone](https://codeberg.org/forgejo/forgejo/milestone/8544).
|
||||
|
@ -163,6 +167,10 @@ A [companion blog post](https://forgejo.org/2024-07-release-v8-0/) provides addi
|
|||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/2937): <!--number 2937 --><!--number--><!--description -->31 March updates<!--description-->
|
||||
<!--end release-notes-assistant-->
|
||||
|
||||
## 7.0.11
|
||||
|
||||
The Forgejo v7.0.11 release notes are [available in the v7.0.11 milestone](https://codeberg.org/forgejo/forgejo/milestone/8609).
|
||||
|
||||
## 7.0.10
|
||||
|
||||
The Forgejo v7.0.10 release notes are [available in the v7.0.10 milestone](https://codeberg.org/forgejo/forgejo/milestone/8286).
|
||||
|
|
2
go.mod
2
go.mod
|
@ -293,7 +293,7 @@ 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/nektos/act => code.forgejo.org/forgejo/act v1.21.5
|
||||
replace github.com/nektos/act => code.forgejo.org/forgejo/act v1.22.0
|
||||
|
||||
replace github.com/mholt/archiver/v3 => code.forgejo.org/forgejo/archiver/v3 v3.5.1
|
||||
|
||||
|
|
4
go.sum
4
go.sum
|
@ -4,8 +4,8 @@ code.forgejo.org/f3/gof3/v3 v3.7.0 h1:ZfuCP8CGm8ZJbWmL+V0pUu3E0X4FCAA7GfRDy/y5/K
|
|||
code.forgejo.org/f3/gof3/v3 v3.7.0/go.mod h1:oNhOeqD4DZYjVcNjQXIOdDX9b/1tqxi9ITLS8H9/Csw=
|
||||
code.forgejo.org/forgejo-contrib/go-libravatar v0.0.0-20191008002943-06d1c002b251 h1:HTZl3CBk3ABNYtFI6TPLvJgGKFIhKT5CBk0sbOtkDKU=
|
||||
code.forgejo.org/forgejo-contrib/go-libravatar v0.0.0-20191008002943-06d1c002b251/go.mod h1:PphB88CPbx601QrWPMZATeorACeVmQlyv3u+uUMbSaM=
|
||||
code.forgejo.org/forgejo/act v1.21.5 h1:rWI+bhClocogdNwjRrM836rZYY7JBcHY3VUAwkYqEtw=
|
||||
code.forgejo.org/forgejo/act v1.21.5/go.mod h1:+PcvJ9iv+NTFeJSh79ra9Jbk9l0vvyA9D9me5/dbxYM=
|
||||
code.forgejo.org/forgejo/act v1.22.0 h1:NbUf0+vQ48+ddwe4zVkINqnxKYl/to+NUvW7iisPA60=
|
||||
code.forgejo.org/forgejo/act v1.22.0/go.mod h1:+PcvJ9iv+NTFeJSh79ra9Jbk9l0vvyA9D9me5/dbxYM=
|
||||
code.forgejo.org/forgejo/archiver/v3 v3.5.1 h1:UmmbA7D5550uf71SQjarmrn6yKwOGxtEjb3jaYYtmSE=
|
||||
code.forgejo.org/forgejo/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4=
|
||||
code.forgejo.org/forgejo/reply v1.0.2 h1:dMhQCHV6/O3L5CLWNTol+dNzDAuyCK88z4J/lCdgFuQ=
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
auth_model "code.gitea.io/gitea/models/auth"
|
||||
|
@ -206,11 +207,11 @@ func TestAPIListWikiPages(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAPINewWikiPage(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
for _, title := range []string{
|
||||
"New page",
|
||||
"&&&&",
|
||||
} {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
username := "user2"
|
||||
session := loginUser(t, username)
|
||||
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
|
||||
|
@ -386,26 +387,26 @@ func TestAPIListPageRevisions(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAPIWikiNonMasterBranch(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
|
||||
repo, _, f := tests.CreateDeclarativeRepoWithOptions(t, user, tests.DeclarativeRepoOptions{
|
||||
WikiBranch: optional.Some("main"),
|
||||
})
|
||||
defer f()
|
||||
|
||||
uris := []string{
|
||||
"revisions/Home",
|
||||
"pages",
|
||||
"page/Home",
|
||||
}
|
||||
baseURL := fmt.Sprintf("/api/v1/repos/%s/wiki", repo.FullName())
|
||||
for _, uri := range uris {
|
||||
t.Run(uri, func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequestf(t, "GET", "%s/%s", baseURL, uri)
|
||||
MakeRequest(t, req, http.StatusOK)
|
||||
onGiteaRun(t, func(t *testing.T, _ *url.URL) {
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
|
||||
repo, _, f := tests.CreateDeclarativeRepoWithOptions(t, user, tests.DeclarativeRepoOptions{
|
||||
WikiBranch: optional.Some("main"),
|
||||
})
|
||||
}
|
||||
defer f()
|
||||
|
||||
uris := []string{
|
||||
"revisions/Home",
|
||||
"pages",
|
||||
"page/Home",
|
||||
}
|
||||
baseURL := fmt.Sprintf("/api/v1/repos/%s/wiki", repo.FullName())
|
||||
for _, uri := range uris {
|
||||
t.Run(uri, func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequestf(t, "GET", "%s/%s", baseURL, uri)
|
||||
MakeRequest(t, req, http.StatusOK)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -6,9 +6,12 @@ package integration
|
|||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/tests"
|
||||
)
|
||||
|
||||
func TestEasyMDESwitch(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
session := loginUser(t, "user2")
|
||||
testEasyMDESwitch(t, session, "user2/glob/issues/1", false)
|
||||
testEasyMDESwitch(t, session, "user2/glob/issues/new", false)
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -33,8 +32,6 @@ func assertFileEqual(t *testing.T, p string, content []byte) {
|
|||
|
||||
func TestRepoCloneWiki(t *testing.T) {
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
dstPath := t.TempDir()
|
||||
|
||||
r := fmt.Sprintf("%suser2/repo1.wiki.git", u.String())
|
||||
|
|
|
@ -12,6 +12,7 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -59,6 +60,8 @@ func createSSHUrl(gitPath string, u *url.URL) *url.URL {
|
|||
return &u2
|
||||
}
|
||||
|
||||
var rootPathRe = regexp.MustCompile("\\[repository\\]\nROOT\\s=\\s.*")
|
||||
|
||||
func onGiteaRun[T testing.TB](t T, callback func(T, *url.URL)) {
|
||||
defer tests.PrepareTestEnv(t, 1)()
|
||||
s := http.Server{
|
||||
|
@ -77,7 +80,13 @@ func onGiteaRun[T testing.TB](t T, callback func(T, *url.URL)) {
|
|||
require.NoError(t, err)
|
||||
u.Host = listener.Addr().String()
|
||||
|
||||
// Override repository root in config.
|
||||
conf, err := os.ReadFile(setting.CustomConf)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, os.WriteFile(setting.CustomConf, rootPathRe.ReplaceAll(conf, []byte("[repository]\nROOT = "+setting.RepoRootPath)), os.ModePerm))
|
||||
|
||||
defer func() {
|
||||
require.NoError(t, os.WriteFile(setting.CustomConf, conf, os.ModePerm))
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
|
||||
s.Shutdown(ctx)
|
||||
cancel()
|
||||
|
|
|
@ -48,6 +48,8 @@ func exitf(format string, args ...any) {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
var preparedDir string
|
||||
|
||||
func InitTest(requireGitea bool) {
|
||||
log.RegisterEventWriter("test", testlogger.NewTestLoggerWriter)
|
||||
|
||||
|
@ -180,6 +182,44 @@ func InitTest(requireGitea bool) {
|
|||
setting.Database.Path = ":memory:"
|
||||
}
|
||||
|
||||
setting.Repository.Local.LocalCopyPath = os.TempDir()
|
||||
dir, err := os.MkdirTemp("", "prepared-forgejo")
|
||||
if err != nil {
|
||||
log.Fatal("os.MkdirTemp: %v", err)
|
||||
}
|
||||
preparedDir = dir
|
||||
|
||||
setting.Repository.Local.LocalCopyPath, err = os.MkdirTemp("", "local-upload")
|
||||
if err != nil {
|
||||
log.Fatal("os.MkdirTemp: %v", err)
|
||||
}
|
||||
|
||||
if err := unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "tests/gitea-repositories-meta"), dir); err != nil {
|
||||
log.Fatal("os.RemoveAll: %v", err)
|
||||
}
|
||||
ownerDirs, err := os.ReadDir(dir)
|
||||
if err != nil {
|
||||
log.Fatal("os.ReadDir: %v", err)
|
||||
}
|
||||
fmt.Println(ownerDirs)
|
||||
|
||||
for _, ownerDir := range ownerDirs {
|
||||
if !ownerDir.Type().IsDir() {
|
||||
continue
|
||||
}
|
||||
repoDirs, err := os.ReadDir(filepath.Join(dir, ownerDir.Name()))
|
||||
if err != nil {
|
||||
log.Fatal("os.ReadDir: %v", err)
|
||||
}
|
||||
for _, repoDir := range repoDirs {
|
||||
_ = os.MkdirAll(filepath.Join(dir, ownerDir.Name(), repoDir.Name(), "objects", "pack"), 0o755)
|
||||
_ = os.MkdirAll(filepath.Join(dir, ownerDir.Name(), repoDir.Name(), "objects", "info"), 0o755)
|
||||
_ = os.MkdirAll(filepath.Join(dir, ownerDir.Name(), repoDir.Name(), "refs", "heads"), 0o755)
|
||||
_ = os.MkdirAll(filepath.Join(dir, ownerDir.Name(), repoDir.Name(), "refs", "tag"), 0o755)
|
||||
_ = os.MkdirAll(filepath.Join(dir, ownerDir.Name(), repoDir.Name(), "refs", "pull"), 0o755)
|
||||
}
|
||||
}
|
||||
|
||||
routers.InitWebInstalled(graceful.GetManager().HammerContext())
|
||||
}
|
||||
|
||||
|
@ -228,28 +268,10 @@ func cancelProcesses(t testing.TB, delay time.Duration) {
|
|||
}
|
||||
|
||||
func PrepareGitRepoDirectory(t testing.TB) {
|
||||
require.NoError(t, util.RemoveAll(setting.RepoRootPath))
|
||||
require.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "tests/gitea-repositories-meta"), setting.RepoRootPath))
|
||||
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
|
||||
if err != nil {
|
||||
require.NoError(t, err, "unable to read the new repo root: %v\n", err)
|
||||
}
|
||||
for _, ownerDir := range ownerDirs {
|
||||
if !ownerDir.Type().IsDir() {
|
||||
continue
|
||||
}
|
||||
repoDirs, err := os.ReadDir(filepath.Join(setting.RepoRootPath, ownerDir.Name()))
|
||||
if err != nil {
|
||||
require.NoError(t, err, "unable to read the new repo root: %v\n", err)
|
||||
}
|
||||
for _, repoDir := range repoDirs {
|
||||
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "pack"), 0o755)
|
||||
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "info"), 0o755)
|
||||
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "heads"), 0o755)
|
||||
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "tag"), 0o755)
|
||||
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "pull"), 0o755)
|
||||
}
|
||||
}
|
||||
var err error
|
||||
setting.RepoRootPath, err = os.MkdirTemp(t.TempDir(), "forgejo-repo-rooth")
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, unittest.CopyDir(preparedDir, setting.RepoRootPath))
|
||||
}
|
||||
|
||||
func PrepareArtifactsStorage(t testing.TB) {
|
||||
|
|
Loading…
Reference in a new issue