-
Notifications
You must be signed in to change notification settings - Fork 435
109 lines (94 loc) · 3.34 KB
/
tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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.8", "3.9", "3.10", "3.11"]
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@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "requirements.txt"
- 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@v3
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: "3.2.19"
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@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
# Django 3.2.9+ supports Python 3.10
# https://docs.djangoproject.com/ja/3.2/releases/3.2/
python-version: "3.10"
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