diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e453616..edeac80 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,12 +4,13 @@ on: workflow_dispatch: inputs: version: - description: Version to publish (3.7, 3.8, all,...) (only one) + description: Version to publish (3.8, all,...) (only one) required: true push: branches: - 'main' - 'feature/*' + - 'feat/*' jobs: build: @@ -21,6 +22,12 @@ jobs: MYSQL_PASSWORD: password MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' MYSQL_PORT: 33061 + MYSQL_8_HOST: 127.0.0.1 + MYSQL_8_DATABASE: test_db + MYSQL_8_USER: test_user + MYSQL_8_PASSWORD: password + MYSQL_8_ALLOW_EMPTY_PASSWORD: 'yes' + MYSQL_8_PORT: 33063 MARIADB_HOST: 127.0.0.1 MARIADB_DATABASE: test_db MARIADB_USER: test_user @@ -65,6 +72,17 @@ jobs: ports: - 33061:3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + mysql-8: + image: mysql:8 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: ${{env.MYSQL_8_ALLOW_EMPTY_PASSWORD}} + MYSQL_USER: ${{env.MYSQL_8_USER}} + MYSQL_PASSWORD: ${{env.MYSQL_8_PASSWORD}} + MYSQL_ROOT_PASSWORD: ${{env.MYSQL_8_ROOT_PASSWORD}} + MYSQL_DATABASE: ${{env.MYSQL_8_DATABASE}} + ports: + - 33063:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 mariadb: image: mariadb env: @@ -92,7 +110,7 @@ jobs: strategy: fail-fast: false matrix: - version: [ "3.7","3.8","3.9","3.10","3.11","3.12","3.13" ] + version: [ "3.8","3.9","3.10","3.11","3.12","3.13" ] steps: - name: Checkout repository uses: actions/checkout@v3 @@ -123,6 +141,10 @@ jobs: if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version run: | echo "GRANT ALL on *.* to '${{env.MYSQL_USER}}';"| mysql -u root -h ${{env.MYSQL_HOST}} --port=${{env.MYSQL_PORT}} + - name: Mysql 8 Grant + if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version + run: | + echo "GRANT ALL on *.* to '${{env.MYSQL_8_USER}}';"| mysql -u root -h ${{env.MYSQL_8_HOST}} --port=${{env.MYSQL_8_PORT}} - name: MariaDB Grant if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version run: | @@ -130,7 +152,7 @@ jobs: - name: Test Databases if: steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version run: | - docker run --network host -v /"$(pwd)/tests":/app -w /app -e MYSQL_HOST=$MYSQL_HOST -e MYSQL_DATABASE=$MYSQL_DATABASE -e MYSQL_USER=$MYSQL_USER -e MYSQL_PORT=$MYSQL_PORT -e MYSQL_PASSWORD=$MYSQL_PASSWORD -e MARIADB_HOST=$MARIADB_HOST -e MARIADB_DATABASE=$MARIADB_DATABASE -e MARIADB_USER=$MARIADB_USER -e MARIADB_PORT=$MARIADB_PORT -e MARIADB_PASSWORD=$MARIADB_PASSWORD -e POSTGRES_HOST=$POSTGRES_HOST -e POSTGRES_DB=$POSTGRES_DB -e POSTGRES_USER=$POSTGRES_USER -e POSTGRES_PORT=$POSTGRES_PORT -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD -e MSSQL_HOST -e MSSQL_PORT -e MSSQL_DATABASE -e MSSQL_USER -e MSSQL_PASSWORD orbisk/django-test:${{env.PYTHON_VERSION}} sh -c "cd /app && pip install -r requirements.txt && python manage.py test" + docker run --network host -v /"$(pwd)/tests":/app -w /app -e MYSQL_HOST=$MYSQL_HOST -e MYSQL_DATABASE=$MYSQL_DATABASE -e MYSQL_USER=$MYSQL_USER -e MYSQL_PORT=$MYSQL_PORT -e MYSQL_PASSWORD=$MYSQL_PASSWORD -e MYSQL_8_HOST=$MYSQL_8_HOST -e MYSQL_8_DATABASE=$MYSQL_8_DATABASE -e MYSQL_8_USER=$MYSQL_8_USER -e MYSQL_8_PORT=$MYSQL_8_PORT -e MYSQL_8_PASSWORD=$MYSQL_8_PASSWORD -e MARIADB_HOST=$MARIADB_HOST -e MARIADB_DATABASE=$MARIADB_DATABASE -e MARIADB_USER=$MARIADB_USER -e MARIADB_PORT=$MARIADB_PORT -e MARIADB_PASSWORD=$MARIADB_PASSWORD -e POSTGRES_HOST=$POSTGRES_HOST -e POSTGRES_DB=$POSTGRES_DB -e POSTGRES_USER=$POSTGRES_USER -e POSTGRES_PORT=$POSTGRES_PORT -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD -e MSSQL_HOST -e MSSQL_PORT -e MSSQL_DATABASE -e MSSQL_USER -e MSSQL_PASSWORD orbisk/django-test:${{env.PYTHON_VERSION}} sh -c "cd /app && pip install -r requirements.txt && python manage.py test" - name: Push Image if: (steps.changes.outputs.src == 'true' || steps.changes.outputs.docker == 'true' || github.event.inputs.version == 'all' || github.event.inputs.version == matrix.version) && github.ref == 'refs/heads/main' run: docker push -a orbisk/django-test diff --git a/README.md b/README.md index 77f49eb..b2abaf2 100644 --- a/README.md +++ b/README.md @@ -48,19 +48,20 @@ started. - 🟠 Beta/Experimental (please share your experiences) - 🔴 Currently not Supported (open an Issue or Pull request if needed) -| Python version | | uv preinstalled | -|----------------|----|-----------------| -| `^3.13.0` | 🟢 | 🟢 (`^3.13.0`) | -| `^3.12.4` | 🟢 | 🟢 (`^3.12.7`) | -| `^3.11.2` | 🟢 | 🟢 (`^3.11.10`) | -| `^3.10.10` | 🟢 | 🟢 (`^3.10.15`) | -| `^3.9.16` | 🟢 | 🟢 (`^3.9.20`) | -| `^3.8.16` | 🟢 | 🟢 (`^3.8.20`) | -| `^3.7.16` | 🟢 | 🔴 | -| `^2.x` | 🔴 | 🔴 | +| Python version | | uv preinstalled | +|----------------|------------------------|:----------------| +| `^3.13.0` | 🟢 | 🟢 (`^3.13.0`) | +| `^3.12.4` | 🟢 | 🟢 (`^3.12.7`) | +| `^3.11.2` | 🟢 | 🟢 (`^3.11.10`) | +| `^3.10.10` | 🟢 | 🟢 (`^3.10.15`) | +| `^3.9.16` | 🟢 | 🟢 (`^3.9.20`) | +| `^3.8.16` | 🟢 | 🟢 (`^3.8.20`) | +| `^3.7.16` | 🟡 ([see](#python-37)) | 🔴 | +| `^2.x` | 🔴 | 🔴 | | MySQL*️⃣ | | |----------|----| +| `^9.0.0` | 🟢 | | `^8.0.0` | 🟢 | | `<=5.7` | 🟡 | @@ -138,3 +139,10 @@ MSSQL is currently only supported/tested with the following versions: Microsoft ODBC Driver 18 for SQL Server' does currently not work with mssql as ci service with self-signed ssl certs. If you have any solution, feel free to open an Issue or PR) +## Limitations + +### Python 3.7 + +Python 3.7 is not covered by our CI/CD tests anymore. This means that we can't guarantee that the image will work as +expected with Python 3.7. The reason is that packages like `mssql-django` dropped support for Python 3.7, so we can't +test it anymore. \ No newline at end of file diff --git a/tests/app_mysql_8/__init__.py b/tests/app_mysql_8/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/app_mysql_8/migrations/0001_initial.py b/tests/app_mysql_8/migrations/0001_initial.py new file mode 100644 index 0000000..ddd3b6c --- /dev/null +++ b/tests/app_mysql_8/migrations/0001_initial.py @@ -0,0 +1,21 @@ +# Generated by Django 4.1.7 on 2023-03-14 13:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='TestModel', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('value', models.IntegerField()), + ], + ), + ] diff --git a/tests/app_mysql_8/migrations/__init__.py b/tests/app_mysql_8/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/app_mysql_8/models.py b/tests/app_mysql_8/models.py new file mode 100644 index 0000000..9262bc0 --- /dev/null +++ b/tests/app_mysql_8/models.py @@ -0,0 +1,8 @@ +from django.db import models + + +# Create your models here. + + +class TestModel(models.Model): + value = models.IntegerField() diff --git a/tests/app_mysql_8/router.py b/tests/app_mysql_8/router.py new file mode 100644 index 0000000..96a111c --- /dev/null +++ b/tests/app_mysql_8/router.py @@ -0,0 +1,8 @@ +from django.conf import settings + +from tests.base_db_router import BaseDBRouter + + +class DBRouter(BaseDBRouter): + route_app_labels = {"app_mysql_8"} + db = settings.DB_MYSQL_8 diff --git a/tests/app_mysql_8/tests.py b/tests/app_mysql_8/tests.py new file mode 100644 index 0000000..21c4cc3 --- /dev/null +++ b/tests/app_mysql_8/tests.py @@ -0,0 +1,9 @@ +from django.conf import settings +from django.test import TestCase + + +class Test(TestCase): + databases = ['default', settings.DB_MYSQL_8] + + def test(self): + self.assertTrue(True) diff --git a/tests/tests/settings.py b/tests/tests/settings.py index 88f1e82..9560b03 100644 --- a/tests/tests/settings.py +++ b/tests/tests/settings.py @@ -39,6 +39,7 @@ 'django.contrib.messages', 'django.contrib.staticfiles', "app_mysql", + "app_mysql_8", "app_mariadb", "app_postgres", "app_mssql", @@ -79,6 +80,7 @@ # https://docs.djangoproject.com/en/4.1/ref/settings/#databases DB_MYSQL = "mysql" +DB_MYSQL_8 = "mysql_8" DB_MARIADB = "mariadb" DB_MSSQL = "mssql" DB_POSTGRES = "postgres" @@ -97,6 +99,14 @@ "USER": env.str("MYSQL_USER"), "PASSWORD": env.str("MYSQL_PASSWORD"), }, + DB_MYSQL_8: { + "ENGINE": "django.db.backends.mysql", + "HOST": env.str("MYSQL_8_HOST"), + "PORT": env.int("MYSQL_8_PORT"), + "NAME": env.str("MYSQL_8_DATABASE"), + "USER": env.str("MYSQL_8_USER"), + "PASSWORD": env.str("MYSQL_8_PASSWORD"), + }, DB_MARIADB: { "ENGINE": "django.db.backends.mysql", "HOST": env.str("MARIADB_HOST"), @@ -125,6 +135,7 @@ DATABASE_ROUTERS = [ 'app_mysql.router.DBRouter', + 'app_mysql_8.router.DBRouter', 'app_mariadb.router.DBRouter', 'app_postgres.router.DBRouter', 'app_mssql.router.DBRouter',