Skip to content

Commit adbd8a0

Browse files
committed
Remove dependency on gitea binary
1 parent 2861aa4 commit adbd8a0

File tree

6 files changed

+32
-21
lines changed

6 files changed

+32
-21
lines changed

.drone.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -528,16 +528,23 @@ services:
528528
POSTGRES_INITDB_ARGS: --encoding=UTF8 --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'
529529

530530
steps:
531-
- name: build
532-
image: techknowlogick/xgo:go-1.18.x
531+
- name: deps-frontend
532+
image: node:16
533533
pull: always
534534
commands:
535-
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
536-
- export PATH=$PATH:$GOPATH/bin
537-
- make build
538-
environment:
539-
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
540-
TAGS: bindata sqlite sqlite_unlock_notify
535+
- make deps-frontend
536+
537+
- name: build-frontend
538+
image: node:16
539+
commands:
540+
- make frontend
541+
depends_on: [deps-frontend]
542+
543+
- name: deps-backend
544+
image: golang:1.18
545+
pull: always
546+
commands:
547+
- make deps-backend
541548
volumes:
542549
- name: deps
543550
path: /go
@@ -562,7 +569,7 @@ steps:
562569
NO_DEPS_PLAYWRIGHT: 1
563570
TEST_PGSQL_DBNAME: 'testgitea-e2e'
564571
NPX_FLAGS: '--yes'
565-
depends_on: [build]
572+
depends_on: [build-frontend, deps-backend]
566573
volumes:
567574
- name: deps
568575
path: /go

playwright.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const config = {
3333
// workers: process.env.CI ? 1 : undefined,
3434

3535
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
36-
reporter: process.env.CI ? 'list' : [['list'], ['html', {outputFolder: 'tools/e2e/reports/', open: 'never'}]],
36+
reporter: process.env.CI ? 'list' : [['list'], ['html', {outputFolder: 'tests/e2e/reports/', open: 'never'}]],
3737

3838
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
3939
use: {

tests/e2e/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var c *web.Route
3030
func TestMain(m *testing.M) {
3131
defer log.Close()
3232

33-
tests.InitTest()
33+
tests.InitTest(false)
3434
c = routers.NormalRoutes()
3535

3636
os.Unsetenv("GIT_AUTHOR_NAME")

tests/e2e/example.test.e2e.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ test('Test Register Form', async ({page}, workerInfo) => {
2222
await expect(page.locator('.ui.positive.message.flash-success')).toHaveText('Account was successfully created.');
2323
// Optionally include visual testing
2424
if (process.env.VISUAL_TEST) {
25+
await page.waitForLoadState('networkidle');
2526
// Mock page/version string
2627
await page.locator('footer div.ui.left').evaluate((node) => node.innerHTML = 'MOCK');
2728
await expect(page).toHaveScreenshot({timeout: 20000,
2829
mask: [
2930
page.locator('.dashboard-navbar span>img.ui.avatar.image'),
31+
page.locator('.ui.dropdown.jump.item.tooltip span>img.ui.avatar.image'),
3032
]
3133
});
3234
}

tests/integration/integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func TestMain(m *testing.M) {
8181
graceful.InitManager(managerCtx)
8282
defer cancel()
8383

84-
tests.InitTest()
84+
tests.InitTest(true)
8585
c = routers.NormalRoutes()
8686

8787
// integration test settings...

tests/test_utils.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,22 @@ import (
2929
"github.com/stretchr/testify/assert"
3030
)
3131

32-
func InitTest() {
32+
func InitTest(require_gitea bool) {
3333
giteaRoot := base.SetupGiteaRoot()
3434
if giteaRoot == "" {
3535
fmt.Println("Environment variable $GITEA_ROOT not set")
3636
os.Exit(1)
3737
}
38-
giteaBinary := "gitea"
39-
if runtime.GOOS == "windows" {
40-
giteaBinary += ".exe"
41-
}
42-
setting.AppPath = path.Join(giteaRoot, giteaBinary)
43-
if _, err := os.Stat(setting.AppPath); err != nil {
44-
fmt.Printf("Could not find gitea binary at %s\n", setting.AppPath)
45-
os.Exit(1)
38+
if require_gitea {
39+
giteaBinary := "gitea"
40+
if runtime.GOOS == "windows" {
41+
giteaBinary += ".exe"
42+
}
43+
setting.AppPath = path.Join(giteaRoot, giteaBinary)
44+
if _, err := os.Stat(setting.AppPath); err != nil {
45+
fmt.Printf("Could not find gitea binary at %s\n", setting.AppPath)
46+
os.Exit(1)
47+
}
4648
}
4749

4850
giteaConf := os.Getenv("GITEA_CONF")

0 commit comments

Comments
 (0)