name: Test on: push: branches: ["main"] pull_request: jobs: test: runs-on: ubuntu-latest env: PIP_NO_PYTHON_VERSION_WARNING: 1 PIP_DISABLE_PIP_VERSION_CHECK: 1 strategy: matrix: python-version: ["3.10", "3.12", "3.14", "3.14t"] include: - python-version: "3.11" mariadb: 1 steps: - if: ${{ matrix.mariadb }} name: Start MariaDB # https://github.com/actions/runner-images/blob/9d9b3a110dfc98100cdd09cb2c957b9a768e2979/images/linux/scripts/installers/mysql.sh#L10-L13 run: | docker pull mariadb:10.11 docker run -d -e MARIADB_ROOT_PASSWORD=root -p 3306:3306 --rm --name mariadb mariadb:10.11 sudo apt-get -y install libmariadb-dev mysql --version mysql -uroot -proot -h127.0.0.1 -e "CREATE DATABASE mysqldb_test" - if: ${{ !matrix.mariadb }} name: Start MySQL run: | sudo systemctl start mysql.service mysql --version mysql -uroot -proot -e "CREATE DATABASE mysqldb_test" - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: "pip" cache-dependency-path: "requirements.txt" allow-prereleases: true - name: Install mysqlclient run: | pip install -v . - name: Install test dependencies run: | pip install -r requirements.txt - name: Run tests env: TESTDB: actions.cnf run: | pytest --cov=MySQLdb tests - uses: codecov/codecov-action@v5 django-test: name: "Run Django LTS test suite" needs: test runs-on: ubuntu-latest env: PIP_NO_PYTHON_VERSION_WARNING: 1 PIP_DISABLE_PIP_VERSION_CHECK: 1 DJANGO_VERSION: "4.2.28" steps: - name: Start MySQL run: | sudo systemctl start mysql.service mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -proot mysql mysql -uroot -proot -e "set global innodb_flush_log_at_trx_commit=0;" mysql -uroot -proot -e "CREATE USER 'scott'@'%' IDENTIFIED BY 'tiger'; GRANT ALL ON *.* TO scott;" mysql -uroot -proot -e "CREATE DATABASE django_default; CREATE DATABASE django_other;" - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" cache: "pip" cache-dependency-path: "ci/django-requirements.txt" - name: Install mysqlclient run: | #pip install -r requirements.txt #pip install mysqlclient # Use stable version pip install . - name: Setup Django run: | sudo apt-get install libmemcached-dev wget https://github.com/django/django/archive/${DJANGO_VERSION}.tar.gz tar xf ${DJANGO_VERSION}.tar.gz cp ci/test_mysql.py django-${DJANGO_VERSION}/tests/ cd django-${DJANGO_VERSION} pip install . -r tests/requirements/py3.txt - name: Run Django test run: | cd django-${DJANGO_VERSION}/tests/ PYTHONPATH=.. python3 ./runtests.py --settings=test_mysql