Skip to content

Commit 4a6b011

Browse files
lunnytechknowlogick
authored andcommitted
Add test environment for Mysql8 (#5234)
1 parent b3ad5eb commit 4a6b011

File tree

4 files changed

+120
-4
lines changed

4 files changed

+120
-4
lines changed

.drone.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,22 @@ pipeline:
164164
when:
165165
event: [ tag ]
166166

167+
test-mysql8:
168+
image: golang:1.11
169+
pull: true
170+
group: test
171+
environment:
172+
TAGS: bindata
173+
TEST_LDAP: "1"
174+
commands:
175+
- curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
176+
- apt-get install -y git-lfs
177+
- (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.test)' | sh)) &
178+
- make test-mysql8-migration
179+
- make test-mysql8
180+
when:
181+
event: [ push, tag, pull_request ]
182+
167183
test-pgsql:
168184
image: golang:1.12
169185
pull: true
@@ -406,6 +422,15 @@ services:
406422
when:
407423
event: [ push, tag, pull_request ]
408424

425+
mysql8:
426+
image: mysql:8.0
427+
environment:
428+
- MYSQL_DATABASE=test
429+
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
430+
- MYSQL_DATABASE=testgitea
431+
when:
432+
event: [ push, tag, pull_request ]
433+
409434
pgsql:
410435
image: postgres:9.5
411436
environment:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,17 @@ coverage.all
5151
/log
5252
/public/img/avatar
5353
/integrations/gitea-integration-mysql
54+
/integrations/gitea-integration-mysql8
5455
/integrations/gitea-integration-pgsql
5556
/integrations/gitea-integration-sqlite
5657
/integrations/gitea-integration-mssql
5758
/integrations/indexers-mysql
59+
/integrations/indexers-mysql8
5860
/integrations/indexers-pgsql
5961
/integrations/indexers-sqlite
6062
/integrations/indexers-mssql
6163
/integrations/mysql.ini
64+
/integrations/mysql8.ini
6265
/integrations/pgsql.ini
6366
/integrations/mssql.ini
6467
/node_modules

Makefile

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ TEST_MYSQL_HOST ?= mysql:3306
5252
TEST_MYSQL_DBNAME ?= testgitea
5353
TEST_MYSQL_USERNAME ?= root
5454
TEST_MYSQL_PASSWORD ?=
55+
TEST_MYSQL8_HOST ?= mysql8:3306
56+
TEST_MYSQL8_DBNAME ?= testgitea
57+
TEST_MYSQL8_USERNAME ?= root
58+
TEST_MYSQL8_PASSWORD ?=
5559
TEST_PGSQL_HOST ?= pgsql:5432
5660
TEST_PGSQL_DBNAME ?= testgitea
5761
TEST_PGSQL_USERNAME ?= postgres
@@ -80,9 +84,9 @@ clean:
8084
$(GO) clean -i ./...
8185
rm -rf $(EXECUTABLE) $(DIST) $(BINDATA) \
8286
integrations*.test \
83-
integrations/gitea-integration-pgsql/ integrations/gitea-integration-mysql/ integrations/gitea-integration-sqlite/ integrations/gitea-integration-mssql/ \
84-
integrations/indexers-mysql/ integrations/indexers-pgsql integrations/indexers-sqlite integrations/indexers-mssql \
85-
integrations/mysql.ini integrations/pgsql.ini integrations/mssql.ini
87+
integrations/gitea-integration-pgsql/ integrations/gitea-integration-mysql/ integrations/gitea-integration-mysql8/ integrations/gitea-integration-sqlite/ \
88+
integrations/gitea-integration-mssql/ integrations/indexers-mysql/ integrations/indexers-mysql8/ integrations/indexers-pgsql integrations/indexers-sqlite \
89+
integrations/indexers-mssql integrations/mysql.ini integrations/mysql8.ini integrations/pgsql.ini integrations/mssql.ini
8690

8791
.PHONY: fmt
8892
fmt:
@@ -209,6 +213,11 @@ generate-ini:
209213
-e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
210214
-e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
211215
integrations/mysql.ini.tmpl > integrations/mysql.ini
216+
sed -e 's|{{TEST_MYSQL8_HOST}}|${TEST_MYSQL8_HOST}|g' \
217+
-e 's|{{TEST_MYSQL8_DBNAME}}|${TEST_MYSQL8_DBNAME}|g' \
218+
-e 's|{{TEST_MYSQL8_USERNAME}}|${TEST_MYSQL8_USERNAME}|g' \
219+
-e 's|{{TEST_MYSQL8_PASSWORD}}|${TEST_MYSQL8_PASSWORD}|g' \
220+
integrations/mysql8.ini.tmpl > integrations/mysql8.ini
212221
sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
213222
-e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
214223
-e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
@@ -228,6 +237,14 @@ test-mysql: integrations.test generate-ini
228237
test-mysql-migration: migrations.test generate-ini
229238
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./migrations.test
230239

240+
.PHONY: test-mysql8
241+
test-mysql8: integrations.test generate-ini
242+
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./integrations.test
243+
244+
.PHONY: test-mysql8-migration
245+
test-mysql8-migration: migrations.test generate-ini
246+
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./migrations.test
247+
231248
.PHONY: test-pgsql
232249
test-pgsql: integrations.test generate-ini
233250
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test
@@ -236,7 +253,6 @@ test-pgsql: integrations.test generate-ini
236253
test-pgsql-migration: migrations.test generate-ini
237254
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./migrations.test
238255

239-
240256
.PHONY: test-mssql
241257
test-mssql: integrations.test generate-ini
242258
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.test

integrations/mysql8.ini.tmpl

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
APP_NAME = Gitea: Git with a cup of tea
2+
RUN_MODE = prod
3+
4+
[database]
5+
DB_TYPE = mysql
6+
HOST = {{TEST_MYSQL8_HOST}}
7+
NAME = {{TEST_MYSQL8_DBNAME}}
8+
USER = {{TEST_MYSQL8_USERNAME}}
9+
PASSWD = {{TEST_MYSQL8_PASSWORD}}
10+
SSL_MODE = disable
11+
12+
[indexer]
13+
ISSUE_INDEXER_PATH = integrations/indexers-mysql8/issues.bleve
14+
REPO_INDEXER_ENABLED = true
15+
REPO_INDEXER_PATH = integrations/indexers-mysql8/repos.bleve
16+
17+
[repository]
18+
ROOT = integrations/gitea-integration-mysql8/gitea-repositories
19+
20+
[repository.local]
21+
LOCAL_COPY_PATH = tmp/local-repo-mysql8
22+
LOCAL_WIKI_PATH = tmp/local-wiki-mysql8
23+
24+
[server]
25+
SSH_DOMAIN = localhost
26+
HTTP_PORT = 3004
27+
ROOT_URL = http://localhost:3004/
28+
DISABLE_SSH = false
29+
SSH_LISTEN_HOST = localhost
30+
SSH_PORT = 2204
31+
START_SSH_SERVER = true
32+
LFS_START_SERVER = true
33+
LFS_CONTENT_PATH = data/lfs-mysql8
34+
OFFLINE_MODE = false
35+
LFS_JWT_SECRET = Tv_MjmZuHqpIY6GFl12ebgkRAMt4RlWt0v4EHKSXO0w
36+
APP_DATA_PATH = integrations/gitea-integration-mysql8/data
37+
38+
[mailer]
39+
ENABLED = false
40+
41+
[service]
42+
REGISTER_EMAIL_CONFIRM = false
43+
ENABLE_NOTIFY_MAIL = false
44+
DISABLE_REGISTRATION = false
45+
ENABLE_CAPTCHA = false
46+
REQUIRE_SIGNIN_VIEW = false
47+
DEFAULT_KEEP_EMAIL_PRIVATE = false
48+
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
49+
NO_REPLY_ADDRESS = noreply.example.org
50+
51+
[picture]
52+
DISABLE_GRAVATAR = false
53+
ENABLE_FEDERATED_AVATAR = false
54+
55+
[session]
56+
PROVIDER = file
57+
PROVIDER_CONFIG = data/sessions-mysql8
58+
59+
[log]
60+
MODE = console,file
61+
ROOT_PATH = mysql8-log
62+
63+
[log.console]
64+
LEVEL = Warn
65+
66+
[log.file]
67+
LEVEL = Debug
68+
69+
[security]
70+
INSTALL_LOCK = true
71+
SECRET_KEY = 9pCviYTWSb
72+
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE0OTU1NTE2MTh9.hhSVGOANkaKk3vfCd2jDOIww4pUk0xtg9JRde5UogyQ

0 commit comments

Comments
 (0)