Add test environment for Mysql8 (#5234)

This commit is contained in:
Lunny Xiao 2019-03-18 03:17:18 +08:00 committed by techknowlogick
parent b3ad5eb414
commit 4a6b011b15
4 changed files with 120 additions and 4 deletions

View File

@ -164,6 +164,22 @@ pipeline:
when: when:
event: [ tag ] event: [ tag ]
test-mysql8:
image: golang:1.11
pull: true
group: test
environment:
TAGS: bindata
TEST_LDAP: "1"
commands:
- curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
- apt-get install -y git-lfs
- (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.test)' | sh)) &
- make test-mysql8-migration
- make test-mysql8
when:
event: [ push, tag, pull_request ]
test-pgsql: test-pgsql:
image: golang:1.12 image: golang:1.12
pull: true pull: true
@ -406,6 +422,15 @@ services:
when: when:
event: [ push, tag, pull_request ] event: [ push, tag, pull_request ]
mysql8:
image: mysql:8.0
environment:
- MYSQL_DATABASE=test
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_DATABASE=testgitea
when:
event: [ push, tag, pull_request ]
pgsql: pgsql:
image: postgres:9.5 image: postgres:9.5
environment: environment:

3
.gitignore vendored
View File

@ -51,14 +51,17 @@ coverage.all
/log /log
/public/img/avatar /public/img/avatar
/integrations/gitea-integration-mysql /integrations/gitea-integration-mysql
/integrations/gitea-integration-mysql8
/integrations/gitea-integration-pgsql /integrations/gitea-integration-pgsql
/integrations/gitea-integration-sqlite /integrations/gitea-integration-sqlite
/integrations/gitea-integration-mssql /integrations/gitea-integration-mssql
/integrations/indexers-mysql /integrations/indexers-mysql
/integrations/indexers-mysql8
/integrations/indexers-pgsql /integrations/indexers-pgsql
/integrations/indexers-sqlite /integrations/indexers-sqlite
/integrations/indexers-mssql /integrations/indexers-mssql
/integrations/mysql.ini /integrations/mysql.ini
/integrations/mysql8.ini
/integrations/pgsql.ini /integrations/pgsql.ini
/integrations/mssql.ini /integrations/mssql.ini
/node_modules /node_modules

View File

@ -52,6 +52,10 @@ TEST_MYSQL_HOST ?= mysql:3306
TEST_MYSQL_DBNAME ?= testgitea TEST_MYSQL_DBNAME ?= testgitea
TEST_MYSQL_USERNAME ?= root TEST_MYSQL_USERNAME ?= root
TEST_MYSQL_PASSWORD ?= TEST_MYSQL_PASSWORD ?=
TEST_MYSQL8_HOST ?= mysql8:3306
TEST_MYSQL8_DBNAME ?= testgitea
TEST_MYSQL8_USERNAME ?= root
TEST_MYSQL8_PASSWORD ?=
TEST_PGSQL_HOST ?= pgsql:5432 TEST_PGSQL_HOST ?= pgsql:5432
TEST_PGSQL_DBNAME ?= testgitea TEST_PGSQL_DBNAME ?= testgitea
TEST_PGSQL_USERNAME ?= postgres TEST_PGSQL_USERNAME ?= postgres
@ -80,9 +84,9 @@ clean:
$(GO) clean -i ./... $(GO) clean -i ./...
rm -rf $(EXECUTABLE) $(DIST) $(BINDATA) \ rm -rf $(EXECUTABLE) $(DIST) $(BINDATA) \
integrations*.test \ integrations*.test \
integrations/gitea-integration-pgsql/ integrations/gitea-integration-mysql/ integrations/gitea-integration-sqlite/ integrations/gitea-integration-mssql/ \ integrations/gitea-integration-pgsql/ integrations/gitea-integration-mysql/ integrations/gitea-integration-mysql8/ integrations/gitea-integration-sqlite/ \
integrations/indexers-mysql/ integrations/indexers-pgsql integrations/indexers-sqlite integrations/indexers-mssql \ integrations/gitea-integration-mssql/ integrations/indexers-mysql/ integrations/indexers-mysql8/ integrations/indexers-pgsql integrations/indexers-sqlite \
integrations/mysql.ini integrations/pgsql.ini integrations/mssql.ini integrations/indexers-mssql integrations/mysql.ini integrations/mysql8.ini integrations/pgsql.ini integrations/mssql.ini
.PHONY: fmt .PHONY: fmt
fmt: fmt:
@ -209,6 +213,11 @@ generate-ini:
-e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \ -e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
-e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \ -e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
integrations/mysql.ini.tmpl > integrations/mysql.ini integrations/mysql.ini.tmpl > integrations/mysql.ini
sed -e 's|{{TEST_MYSQL8_HOST}}|${TEST_MYSQL8_HOST}|g' \
-e 's|{{TEST_MYSQL8_DBNAME}}|${TEST_MYSQL8_DBNAME}|g' \
-e 's|{{TEST_MYSQL8_USERNAME}}|${TEST_MYSQL8_USERNAME}|g' \
-e 's|{{TEST_MYSQL8_PASSWORD}}|${TEST_MYSQL8_PASSWORD}|g' \
integrations/mysql8.ini.tmpl > integrations/mysql8.ini
sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \ sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
-e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \ -e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
-e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \ -e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
@ -228,6 +237,14 @@ test-mysql: integrations.test generate-ini
test-mysql-migration: migrations.test generate-ini test-mysql-migration: migrations.test generate-ini
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./migrations.test GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./migrations.test
.PHONY: test-mysql8
test-mysql8: integrations.test generate-ini
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./integrations.test
.PHONY: test-mysql8-migration
test-mysql8-migration: migrations.test generate-ini
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./migrations.test
.PHONY: test-pgsql .PHONY: test-pgsql
test-pgsql: integrations.test generate-ini test-pgsql: integrations.test generate-ini
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test
@ -236,7 +253,6 @@ test-pgsql: integrations.test generate-ini
test-pgsql-migration: migrations.test generate-ini test-pgsql-migration: migrations.test generate-ini
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./migrations.test GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./migrations.test
.PHONY: test-mssql .PHONY: test-mssql
test-mssql: integrations.test generate-ini test-mssql: integrations.test generate-ini
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.test GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.test

View File

@ -0,0 +1,72 @@
APP_NAME = Gitea: Git with a cup of tea
RUN_MODE = prod
[database]
DB_TYPE = mysql
HOST = {{TEST_MYSQL8_HOST}}
NAME = {{TEST_MYSQL8_DBNAME}}
USER = {{TEST_MYSQL8_USERNAME}}
PASSWD = {{TEST_MYSQL8_PASSWORD}}
SSL_MODE = disable
[indexer]
ISSUE_INDEXER_PATH = integrations/indexers-mysql8/issues.bleve
REPO_INDEXER_ENABLED = true
REPO_INDEXER_PATH = integrations/indexers-mysql8/repos.bleve
[repository]
ROOT = integrations/gitea-integration-mysql8/gitea-repositories
[repository.local]
LOCAL_COPY_PATH = tmp/local-repo-mysql8
LOCAL_WIKI_PATH = tmp/local-wiki-mysql8
[server]
SSH_DOMAIN = localhost
HTTP_PORT = 3004
ROOT_URL = http://localhost:3004/
DISABLE_SSH = false
SSH_LISTEN_HOST = localhost
SSH_PORT = 2204
START_SSH_SERVER = true
LFS_START_SERVER = true
LFS_CONTENT_PATH = data/lfs-mysql8
OFFLINE_MODE = false
LFS_JWT_SECRET = Tv_MjmZuHqpIY6GFl12ebgkRAMt4RlWt0v4EHKSXO0w
APP_DATA_PATH = integrations/gitea-integration-mysql8/data
[mailer]
ENABLED = false
[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = false
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
NO_REPLY_ADDRESS = noreply.example.org
[picture]
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = false
[session]
PROVIDER = file
PROVIDER_CONFIG = data/sessions-mysql8
[log]
MODE = console,file
ROOT_PATH = mysql8-log
[log.console]
LEVEL = Warn
[log.file]
LEVEL = Debug
[security]
INSTALL_LOCK = true
SECRET_KEY = 9pCviYTWSb
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE0OTU1NTE2MTh9.hhSVGOANkaKk3vfCd2jDOIww4pUk0xtg9JRde5UogyQ