Skip to content

Commit 418867b

Browse files
committed
Simplify Makefile
1 parent f69f99f commit 418867b

File tree

3 files changed

+30
-24
lines changed

3 files changed

+30
-24
lines changed

.drone.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -541,28 +541,20 @@ steps:
541541
commands:
542542
- git update-ref refs/heads/tag_test ${DRONE_COMMIT_SHA}
543543

544-
- name: build
545-
pull: always
546-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
547-
commands:
548-
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
549-
- make build
550-
environment:
551-
GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
552-
GOSUMDB: sum.golang.org
553-
TAGS: bindata sqlite sqlite_unlock_notify
554-
544+
# TODO: We should probably build all dependencies into a test image
555545
- name: test-e2e
556-
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
546+
image: mcr.microsoft.com/playwright:v1.18.1-focal
557547
commands:
558-
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
559-
- timeout -s ABRT 40m make test-e2e-pgsql
560-
environment:
548+
- curl -sL https://go.dev/dl/go1.17.6.linux-amd64.tar.gz -o go1.17.6.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.17.6.linux-amd64.tar.gz
549+
- groupadd --gid 1001 gitea
550+
- useradd -m --gid 1001 --uid 1001 gitea
551+
- ./build/test-env-prepare.sh
552+
- su gitea GOPROXY=$GOPROXY GOSUMDB=$GOSUMDB TAGS=$TAGS NO_DEPS_PLAYWRIGHT=$NO_DEPS_PLAYWRIGHT bash -c "export PATH=$PATH:/usr/local/go/bin && timeout -s ABRT 40m make test-e2e-pgsql"
561553
GOPROXY: https://goproxy.cn
554+
GOSUMDB: sum.golang.org
562555
TAGS: bindata
563556
USE_REPO_TEST_DIR: 1
564-
depends_on:
565-
- build
557+
NO_DEPS_PLAYWRIGHT: 1
566558

567559
---
568560
kind: pipeline

Makefile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,15 @@ ifeq ($(filter $(TAGS_SPLIT),bindata),bindata)
132132
GO_SOURCES += $(BINDATA_DEST)
133133
endif
134134

135+
<<<<<<< HEAD
136+
=======
137+
ifneq ($(NO_DEPS_PLAYWRIGHT),1)
138+
PLAYWRIGHT_FLAGS += --with-deps
139+
endif
140+
141+
#To update swagger use: GO111MODULE=on go get -u github.com/go-swagger/go-swagger/cmd/swagger
142+
SWAGGER := $(GO) run github.com/go-swagger/go-swagger/cmd/swagger
143+
>>>>>>> d2c9f5bba (Simplify Makefile)
135144
SWAGGER_SPEC := templates/swagger/v1_json.tmpl
136145
SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl \| JSEscape \| Safe}}/api/v1"|g
137146
SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl \| JSEscape \| Safe}}/api/v1"|"basePath": "/api/v1"|g
@@ -501,20 +510,18 @@ test-e2e: test-e2e-pgsql
501510

502511
.PHONY: test-e2e\#%
503512
test-e2e\#%: test-e2e-pgsql\#%
504-
echo "Why do I need this?"
513+
true
505514

506515
# Can I share the database with integration tests? Is it cleaned up between tests?
507516
.PHONY: test-e2e-pgsql
508517
test-e2e-pgsql: build generate-ini-pgsql
509-
npx playwright install --with-deps
510-
GITEA_ROOT="$(CURDIR)" ./$(EXECUTABLE) web -c integrations/pgsql.ini --quiet & \
511-
(wait $i && npx playwright test && killall gitea)
518+
npx playwright install $(PLAYWRIGHT_FLAGS)
519+
GITEA_ROOT=$(CURDIR) GITEA_EXECUTABLE=$(EXECUTABLE) ./tools/e2e/run_e2e.sh
512520

513521
.PHONY: test-e2e-pgsql\#%
514522
test-e2e-pgsql\#%: build generate-ini-pgsql
515-
npx playwright install --with-deps
516-
GITEA_ROOT="$(CURDIR)" ./$(EXECUTABLE) web -c integrations/pgsql.ini --quiet & \
517-
(wait $i && npx playwright test $* && killall gitea)
523+
npx playwright install $(PLAYWRIGHT_FLAGS)
524+
GITEA_ROOT=$(CURDIR) GITEA_EXECUTABLE=$(EXECUTABLE) E2E_TESTS=$* ./tools/e2e/run_e2e.sh
518525

519526
.PHONY: bench-sqlite
520527
bench-sqlite: integrations.sqlite.test generate-ini-sqlite

tools/e2e/run_e2e.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
./${GITEA_EXECUTABLE:-gitea} web -c integrations/pgsql.ini --quiet &
5+
npx playwright test ${E2E_TESTS:-""}
6+
7+
trap 'kill $(jobs -p)' EXIT

0 commit comments

Comments
 (0)