Skip to content

Commit 62d6814

Browse files
committed
Setup CI to run againt MySQL.
1 parent 80d41a0 commit 62d6814

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

.github/workflows/test.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ jobs:
2626
--health-interval 10s
2727
--health-timeout 5s
2828
--health-retries 5
29+
mysql:
30+
image: mysql:8.0
31+
env:
32+
MYSQL_USER: mysql
33+
MYSQL_PASSWORD: mysql
34+
MYSQL_DATABASE: syzygy
35+
MYSQL_RANDOM_ROOT_PASSWORD: 1
36+
ports:
37+
- 3306:3306
38+
options: >-
39+
--health-cmd "mysqladmin ping"
40+
--health-interval 10s
41+
--health-timeout 5s
42+
--health-retries 5
2943
3044
steps:
3145
- uses: actions/checkout@v2

tests/settings/mysql.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import os
2+
3+
from . import * # noqa
4+
5+
DB_HOST = os.environ.get("DB_HOST", "127.0.0.1")
6+
DB_PORT = os.environ.get("DB_PORT", "3306")
7+
DB_USER = os.environ.get("DB_USER", "mysql")
8+
DB_PASSWORD = os.environ.get("DB_PASSWORD", "mysql")
9+
10+
DATABASES = {
11+
"default": {
12+
"ENGINE": "django.db.backends.mysql",
13+
"HOST": DB_HOST,
14+
"PORT": DB_PORT,
15+
"NAME": "syzygy",
16+
"USER": DB_USER,
17+
"PASSWORD": DB_PASSWORD,
18+
}
19+
}

tox.ini

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ envlist =
77
isort
88
mypy
99
pypi
10-
py{38,39}-{3.2,4.2}-{sqlite,postgresql}
11-
py310-{3.2,4.2,5.0,main}-{sqlite,postgresql}
12-
py{311,312}-{4.2,5.0,main}-{sqlite,postgresql}
10+
py{38,39}-{3.2,4.2}-{sqlite,postgresql,mysql}
11+
py310-{3.2,4.2,5.0,main}-{sqlite,postgresql,mysql}
12+
py{311,312}-{4.2,5.0,main}-{sqlite,postgresql,mysql}
1313

1414
[gh-actions]
1515
python =
@@ -30,6 +30,7 @@ usedevelop = true
3030
setenv =
3131
DJANGO_SETTINGS_MODULE=tests.settings
3232
postgresql: DJANGO_SETTINGS_MODULE=tests.settings.postgresql
33+
mysql: DJANGO_SETTINGS_MODULE=tests.settings.mysql
3334
passenv =
3435
GITHUB_*
3536
DB_*
@@ -43,6 +44,7 @@ deps =
4344
5.0: Django>=5,<5.1
4445
main: https://github.com/django/django/archive/main.tar.gz
4546
postgresql: psycopg2-binary
47+
mysql: mysqlclient
4648
ignore_outcome =
4749
main: true
4850

0 commit comments

Comments
 (0)