5353ifeq ($(IS_WINDOWS ) ,yes)
5454 GOFLAGS := -v -buildmode=exe
5555 EXECUTABLE ?= gitea.exe
56+ EXECUTABLE_E2E ?= gitea-e2e.exe
5657else
5758 GOFLAGS := -v
5859 EXECUTABLE ?= gitea
60+ EXECUTABLE_E2E ?= gitea-e2e
5961endif
6062
6163ifeq ($(shell sed --version 2>/dev/null | grep -q GNU && echo gnu) ,gnu)
@@ -115,7 +117,7 @@ LDFLAGS := $(LDFLAGS) -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
115117
116118LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/riscv64
117119
118- GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO ) list code.gitea.io/gitea/models/migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration code.gitea.io/gitea/tests/e2e ,$(shell $(GO ) list ./... | grep -v /vendor/) )
120+ GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO ) list code.gitea.io/gitea/models/migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration,$(shell $(GO ) list ./... | grep -v /vendor/) )
119121MIGRATE_TEST_PACKAGES ?= $(shell $(GO ) list code.gitea.io/gitea/models/migrations/...)
120122
121123WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
@@ -153,10 +155,6 @@ GO_SOURCES := $(wildcard *.go)
153155GO_SOURCES += $(shell find $(GO_DIRS ) -type f -name "* .go")
154156GO_SOURCES += $(GENERATED_GO_DEST )
155157
156- # Force installation of playwright dependencies by setting this flag
157- ifdef DEPS_PLAYWRIGHT
158- PLAYWRIGHT_FLAGS += --with-deps
159- endif
160158
161159SWAGGER_SPEC := templates/swagger/v1_json.tmpl
162160SWAGGER_SPEC_INPUT := templates/swagger/v1_input.json
@@ -187,7 +185,7 @@ all: build
187185.PHONY : help
188186help : Makefile # # print Makefile help information.
189187 @awk ' BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m[TARGETS] default target: build\033[0m\n\n\033[35mTargets:\033[0m\n"} /^[0-9A-Za-z._-]+:.*?##/ { printf " \033[36m%-45s\033[0m %s\n", $$1, $$2 }' Makefile # $(MAKEFILE_LIST)
190- @printf " \033[36m%-46s\033[0m %s\n" " test-e2e[#TestSpecificName] " " test end to end using playwright"
188+ @printf " \033[36m%-46s\033[0m %s\n" " test-e2e" " test end to end using playwright"
191189 @printf " \033[36m%-46s\033[0m %s\n" " test[#TestSpecificName]" " run unit test"
192190 @printf " \033[36m%-46s\033[0m %s\n" " test-sqlite[#TestSpecificName]" " run integration test for sqlite"
193191
@@ -204,9 +202,8 @@ clean-all: clean ## delete backend, frontend and integration files
204202
205203.PHONY : clean
206204clean : # # delete backend and integration files
207- rm -rf $(EXECUTABLE ) $(DIST ) $(BINDATA_DEST_WILDCARD ) \
205+ rm -rf $(EXECUTABLE ) $(EXECUTABLE_E2E ) $( DIST ) $(BINDATA_DEST_WILDCARD ) \
208206 integrations* .test \
209- e2e* .test \
210207 tests/integration/gitea-integration-* \
211208 tests/integration/indexers-* \
212209 tests/sqlite.ini tests/mysql.ini tests/pgsql.ini tests/mssql.ini man/ \
@@ -535,47 +532,12 @@ test-mssql-migration: migrations.mssql.test migrations.individual.mssql.test
535532
536533.PHONY : playwright
537534playwright : deps-frontend
538- $(NODE_VARS ) pnpm exec playwright install $(PLAYWRIGHT_FLAGS )
539-
540- .PHONY : test-e2e%
541- test-e2e% : TEST_TYPE ?= e2e
542- # Clear display env variable. Otherwise, chromium tests can fail.
543- DISPLAY=
535+ @# on GitHub Actions VMs, playwright's system deps are pre-installed
536+ @$(NODE_VARS ) pnpm exec playwright install $(if $(GITHUB_ACTIONS ) ,,--with-deps) chromium $(if $(CI ) ,firefox) $(PLAYWRIGHT_FLAGS )
544537
545538.PHONY : test-e2e
546- test-e2e : test-e2e-sqlite
547-
548- .PHONY : test-e2e-sqlite
549- test-e2e-sqlite : playwright e2e.sqlite.test generate-ini-sqlite
550- GITEA_TEST_CONF=tests/sqlite.ini ./e2e.sqlite.test
551-
552- .PHONY : test-e2e-sqlite\# %
553- test-e2e-sqlite\#% : playwright e2e.sqlite.test generate-ini-sqlite
554- GITEA_TEST_CONF=tests/sqlite.ini ./e2e.sqlite.test -test.run TestE2e/$*
555-
556- .PHONY : test-e2e-mysql
557- test-e2e-mysql : playwright e2e.mysql.test generate-ini-mysql
558- GITEA_TEST_CONF=tests/mysql.ini ./e2e.mysql.test
559-
560- .PHONY : test-e2e-mysql\# %
561- test-e2e-mysql\#% : playwright e2e.mysql.test generate-ini-mysql
562- GITEA_TEST_CONF=tests/mysql.ini ./e2e.mysql.test -test.run TestE2e/$*
563-
564- .PHONY : test-e2e-pgsql
565- test-e2e-pgsql : playwright e2e.pgsql.test generate-ini-pgsql
566- GITEA_TEST_CONF=tests/pgsql.ini ./e2e.pgsql.test
567-
568- .PHONY : test-e2e-pgsql\# %
569- test-e2e-pgsql\#% : playwright e2e.pgsql.test generate-ini-pgsql
570- GITEA_TEST_CONF=tests/pgsql.ini ./e2e.pgsql.test -test.run TestE2e/$*
571-
572- .PHONY : test-e2e-mssql
573- test-e2e-mssql : playwright e2e.mssql.test generate-ini-mssql
574- GITEA_TEST_CONF=tests/mssql.ini ./e2e.mssql.test
575-
576- .PHONY : test-e2e-mssql\# %
577- test-e2e-mssql\#% : playwright e2e.mssql.test generate-ini-mssql
578- GITEA_TEST_CONF=tests/mssql.ini ./e2e.mssql.test -test.run TestE2e/$*
539+ test-e2e : playwright $(EXECUTABLE_E2E )
540+ @EXECUTABLE=$(EXECUTABLE_E2E ) ./tools/test-e2e.sh $(GITEA_TEST_E2E_FLAGS )
579541
580542.PHONY : bench-sqlite
581543bench-sqlite : integrations.sqlite.test generate-ini-sqlite
@@ -671,18 +633,6 @@ migrations.individual.sqlite.test: $(GO_SOURCES) generate-ini-sqlite
671633migrations.individual.sqlite.test\#% : $(GO_SOURCES ) generate-ini-sqlite
672634 GITEA_TEST_CONF=tests/sqlite.ini $(GO ) test $(GOTESTFLAGS ) -tags ' $(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$*
673635
674- e2e.mysql.test : $(GO_SOURCES )
675- $(GO ) test $(GOTESTFLAGS ) -c code.gitea.io/gitea/tests/e2e -o e2e.mysql.test
676-
677- e2e.pgsql.test : $(GO_SOURCES )
678- $(GO ) test $(GOTESTFLAGS ) -c code.gitea.io/gitea/tests/e2e -o e2e.pgsql.test
679-
680- e2e.mssql.test : $(GO_SOURCES )
681- $(GO ) test $(GOTESTFLAGS ) -c code.gitea.io/gitea/tests/e2e -o e2e.mssql.test
682-
683- e2e.sqlite.test : $(GO_SOURCES )
684- $(GO ) test $(GOTESTFLAGS ) -c code.gitea.io/gitea/tests/e2e -o e2e.sqlite.test -tags ' $(TEST_TAGS)'
685-
686636.PHONY : check
687637check : test
688638
@@ -721,6 +671,9 @@ ifneq ($(and $(STATIC),$(findstring pam,$(TAGS))),)
721671endif
722672 CGO_ENABLED="$(CGO_ENABLED)" CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(EXTLDFLAGS) $(LDFLAGS)' -o $@
723673
674+ $(EXECUTABLE_E2E ) : $(GO_SOURCES )
675+ CGO_ENABLED=1 $(GO ) build $(GOFLAGS ) $(EXTRA_GOFLAGS ) -tags ' $(TEST_TAGS)' -ldflags ' -s -w $(EXTLDFLAGS) $(LDFLAGS)' -o $@
676+
724677.PHONY : release
725678release : frontend generate release-windows release-linux release-darwin release-freebsd release-copy release-compress vendor release-sources release-check
726679
0 commit comments