Skip to content

Commit 8b92077

Browse files
authored
Action: Run Django tests (#519)
1 parent 267e784 commit 8b92077

File tree

3 files changed

+57
-67
lines changed

3 files changed

+57
-67
lines changed

Diff for: .github/workflows/django.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Django compat test
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-20.04
9+
steps:
10+
- name: Start MySQL
11+
run: |
12+
sudo systemctl start mysql.service
13+
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -proot mysql
14+
mysql -uroot -proot -e "CREATE USER 'scott'@'%' IDENTIFIED BY 'tiger'; GRANT ALL ON *.* TO scott;"
15+
16+
- uses: actions/cache@v2
17+
with:
18+
path: ~/.cache/pip
19+
key: ${{ runner.os }}-django-pip-1
20+
restore-keys: |
21+
${{ runner.os }}-pip-
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v2
25+
with:
26+
# https://www.mail-archive.com/[email protected]/msg209056.html
27+
python-version: "3.8"
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 tblib
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+
sudo apt-get install libmemcached-dev
47+
wget https://github.com/django/django/archive/${DJANGO_VERSION}.tar.gz
48+
tar xf ${DJANGO_VERSION}.tar.gz
49+
cp ci/test_mysql.py django-${DJANGO_VERSION}/tests/
50+
cd django-${DJANGO_VERSION}/tests/
51+
pip install ..
52+
pip install -r requirements/py3.txt
53+
PYTHONPATH=.. python3 ./runtests.py --settings=test_mysql

Diff for: .travis.yml

-63
This file was deleted.

Diff for: 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)