Skip to content

Commit 9e59bec

Browse files
committed
Action: Add Django test
1 parent 267e784 commit 9e59bec

File tree

3 files changed

+55
-67
lines changed

3 files changed

+55
-67
lines changed

.github/workflows/django.yaml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Django compat test
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- name: Start MySQL
12+
run: |
13+
sudo systemctl start mysql.service
14+
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -proot mysql
15+
mysql -uroot -proot -e "CREATE USER 'scott'@'%' IDENTIFIED BY 'tiger'; GRANT ALL ON *.* TO scott;"
16+
17+
- uses: actions/cache@v2
18+
with:
19+
path: ~/.cache/pip
20+
key: ${{ runner.os }}-django-pip-1
21+
restore-keys: |
22+
${{ runner.os }}-pip-
23+
24+
- name: Set up Python 3.10
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: "3.10"
28+
29+
- uses: actions/checkout@v2
30+
with:
31+
fetch-depth: 2
32+
33+
- name: Install mysqlclient
34+
env:
35+
PIP_NO_PYTHON_VERSION_WARNING: 1
36+
PIP_DISABLE_PIP_VERSION_CHECK: 1
37+
run: |
38+
pip install -U pytest pytest-cov
39+
pip install .
40+
# pip install mysqlclient # Use stable version
41+
42+
- name: Run Django test
43+
env:
44+
DJANGO_VERSION: "2.2.24"
45+
run: |
46+
wget https://github.com/django/django/archive/${DJANGO_VERSION}.tar.gz
47+
tar xf ${DJANGO_VERSION}.tar.gz
48+
pip install django-${DJANGO_VERSION}/
49+
cp ci/test_mysql.py django-${DJANGO_VERSION}/tests/
50+
cd django-${DJANGO_VERSION}/tests/
51+
./runtests.py --parallel=2 --settings=test_mysql

.travis.yml

-63
This file was deleted.

ci/test_mysql.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
"default": {
1717
"ENGINE": "django.db.backends.mysql",
1818
"NAME": "django_default",
19-
"USER": "django",
2019
"HOST": "127.0.0.1",
21-
"PASSWORD": "secret",
20+
"USER": "scott",
21+
"PASSWORD": "tiger",
2222
"TEST": {"CHARSET": "utf8mb4", "COLLATION": "utf8mb4_general_ci"},
2323
},
2424
"other": {
2525
"ENGINE": "django.db.backends.mysql",
2626
"NAME": "django_other",
27-
"USER": "django",
2827
"HOST": "127.0.0.1",
29-
"PASSWORD": "secret",
28+
"USER": "scott",
29+
"PASSWORD": "tiger",
3030
"TEST": {"CHARSET": "utf8mb4", "COLLATION": "utf8mb4_general_ci"},
3131
},
3232
}

0 commit comments

Comments
 (0)