Skip to content

Commit

Permalink
Action: Add Django test
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed Oct 19, 2021
1 parent 267e784 commit 9e59bec
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 67 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/django.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Django compat test

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-20.04
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 "CREATE USER 'scott'@'%' IDENTIFIED BY 'tiger'; GRANT ALL ON *.* TO scott;"
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-django-pip-1
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"

- uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Install mysqlclient
env:
PIP_NO_PYTHON_VERSION_WARNING: 1
PIP_DISABLE_PIP_VERSION_CHECK: 1
run: |
pip install -U pytest pytest-cov
pip install .
# pip install mysqlclient # Use stable version
- name: Run Django test
env:
DJANGO_VERSION: "2.2.24"
run: |
wget https://github.com/django/django/archive/${DJANGO_VERSION}.tar.gz
tar xf ${DJANGO_VERSION}.tar.gz
pip install django-${DJANGO_VERSION}/
cp ci/test_mysql.py django-${DJANGO_VERSION}/tests/
cd django-${DJANGO_VERSION}/tests/
./runtests.py --parallel=2 --settings=test_mysql
63 changes: 0 additions & 63 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions ci/test_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "django_default",
"USER": "django",
"HOST": "127.0.0.1",
"PASSWORD": "secret",
"USER": "scott",
"PASSWORD": "tiger",
"TEST": {"CHARSET": "utf8mb4", "COLLATION": "utf8mb4_general_ci"},
},
"other": {
"ENGINE": "django.db.backends.mysql",
"NAME": "django_other",
"USER": "django",
"HOST": "127.0.0.1",
"PASSWORD": "secret",
"USER": "scott",
"PASSWORD": "tiger",
"TEST": {"CHARSET": "utf8mb4", "COLLATION": "utf8mb4_general_ci"},
},
}
Expand Down

0 comments on commit 9e59bec

Please sign in to comment.