Skip to content

Commit

Permalink
Setup CI to run againt MySQL.
Browse files Browse the repository at this point in the history
  • Loading branch information
charettes committed Nov 25, 2024
1 parent 80d41a0 commit 0d5f50b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 12 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:8.0
env:
MYSQL_USER: mysql
MYSQL_PASSWORD: mysql
MYSQL_DATABASE: test_syzygy
MYSQL_RANDOM_ROOT_PASSWORD: 1
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -58,11 +72,16 @@ jobs:
run: |
tox
env:
DB_NAME: postgres
DB_USER: postgres
DB_PASSWORD: postgres
DB_HOST: localhost
DB_PORT: 5432
DB_POSTGRES_NAME: postgres
DB_POSTGRES_USER: postgres
DB_POSTGRES_PASSWORD: postgres
DB_POSTGRES_HOST: localhost
DB_POSTGRES_PORT: 5432
DB_MYSQL_NAME: syzygy
DB_MYSQL_USER: mysql
DB_MYSQL_PASSWORD: mysql
DB_MYSQL_HOST: "127.0.0.1"
DB_MYSQL_PORT: 3306

- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
Expand Down
21 changes: 21 additions & 0 deletions tests/settings/mysql.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os

from . import * # noqa

DB_HOST = os.environ.get("DB_MYSQL_HOST", "127.0.0.1")
DB_PORT = os.environ.get("DB_MYSQL_PORT", "3306")
DB_USER = os.environ.get("DB_MYSQL_USER", "mysql")
DB_PASSWORD = os.environ.get("DB_MYSQL_PASSWORD", "mysql")
DB_NAME = os.environ.get("DB_MYSQL_NAME", "mysql")


DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"HOST": DB_HOST,
"PORT": DB_PORT,
"NAME": DB_NAME,
"USER": DB_USER,
"PASSWORD": DB_PASSWORD,
}
}
8 changes: 4 additions & 4 deletions tests/settings/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from . import * # noqa

DB_HOST = os.environ.get("DB_HOST", "localhost")
DB_PORT = os.environ.get("DB_PORT", "5432")
DB_USER = os.environ.get("DB_USER", "postgres")
DB_PASSWORD = os.environ.get("DB_PASSWORD", "postgres")
DB_HOST = os.environ.get("DB_POSTGRES_HOST", "localhost")
DB_PORT = os.environ.get("DB_POSTGRES_PORT", "5432")
DB_USER = os.environ.get("DB_POSTGRES_USER", "postgres")
DB_PASSWORD = os.environ.get("DB_POSTGRES_PASSWORD", "postgres")

DATABASES = {
"default": {
Expand Down
8 changes: 5 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ envlist =
isort
mypy
pypi
py{38,39}-{3.2,4.2}-{sqlite,postgresql}
py310-{3.2,4.2,5.0,main}-{sqlite,postgresql}
py{311,312}-{4.2,5.0,main}-{sqlite,postgresql}
py{38,39}-{3.2,4.2}-{sqlite,postgresql,mysql}
py310-{3.2,4.2,5.0,main}-{sqlite,postgresql,mysql}
py{311,312}-{4.2,5.0,main}-{sqlite,postgresql,mysql}

[gh-actions]
python =
Expand All @@ -30,6 +30,7 @@ usedevelop = true
setenv =
DJANGO_SETTINGS_MODULE=tests.settings
postgresql: DJANGO_SETTINGS_MODULE=tests.settings.postgresql
mysql: DJANGO_SETTINGS_MODULE=tests.settings.mysql
passenv =
GITHUB_*
DB_*
Expand All @@ -43,6 +44,7 @@ deps =
5.0: Django>=5,<5.1
main: https://github.com/django/django/archive/main.tar.gz
postgresql: psycopg2-binary
mysql: mysqlclient
ignore_outcome =
main: true

Expand Down

0 comments on commit 0d5f50b

Please sign in to comment.