Skip to content

Commit d05a00e

Browse files
authored
ci: Run django test after our test (#612)
1 parent c650aa0 commit d05a00e

File tree

6 files changed

+73
-68
lines changed

6 files changed

+73
-68
lines changed

.github/workflows/codeql.yml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches: [ "main" ]
66
pull_request:
7-
branches: [ "main" ]
87
schedule:
98
- cron: "29 15 * * 6"
109

.github/workflows/django.yaml

-53
This file was deleted.

.github/workflows/lint.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Lint
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
47

58
jobs:
69
lint:

.github/workflows/tests.yaml

+60-7
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ on:
66
pull_request:
77

88
jobs:
9-
build:
9+
test:
1010
runs-on: ubuntu-latest
11+
env:
12+
PIP_NO_PYTHON_VERSION_WARNING: 1
13+
PIP_DISABLE_PIP_VERSION_CHECK: 1
1114
strategy:
1215
matrix:
1316
python-version: ["3.8", "3.9", "3.10", "3.11"]
@@ -38,19 +41,69 @@ jobs:
3841
uses: actions/setup-python@v4
3942
with:
4043
python-version: ${{ matrix.python-version }}
44+
cache: "pip"
45+
cache-dependency-path: "requirements.txt"
4146

42-
- name: Install dependencies
43-
env:
44-
PIP_NO_PYTHON_VERSION_WARNING: 1
45-
PIP_DISABLE_PIP_VERSION_CHECK: 1
47+
- name: Install mysqlclient
4648
run: |
47-
pip install -r requirements.txt
48-
pip install .
49+
pip install -v .
4950
51+
- name: Install test dependencies
52+
run: |
53+
pip install -r requirements.txt
54+
5055
- name: Run tests
5156
env:
5257
TESTDB: actions.cnf
5358
run: |
5459
pytest --cov=MySQLdb tests
5560
5661
- uses: codecov/codecov-action@v3
62+
63+
django-test:
64+
name: "Run Django LTS test suite"
65+
needs: test
66+
runs-on: ubuntu-latest
67+
env:
68+
PIP_NO_PYTHON_VERSION_WARNING: 1
69+
PIP_DISABLE_PIP_VERSION_CHECK: 1
70+
DJANGO_VERSION: "3.2.19"
71+
steps:
72+
- name: Start MySQL
73+
run: |
74+
sudo systemctl start mysql.service
75+
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -proot mysql
76+
mysql -uroot -proot -e "set global innodb_flush_log_at_trx_commit=0;"
77+
mysql -uroot -proot -e "CREATE USER 'scott'@'%' IDENTIFIED BY 'tiger'; GRANT ALL ON *.* TO scott;"
78+
mysql -uroot -proot -e "CREATE DATABASE django_default; CREATE DATABASE django_other;"
79+
80+
- uses: actions/checkout@v3
81+
82+
- name: Set up Python
83+
uses: actions/setup-python@v4
84+
with:
85+
# Django 3.2.9+ supports Python 3.10
86+
# https://docs.djangoproject.com/ja/3.2/releases/3.2/
87+
python-version: "3.10"
88+
cache: "pip"
89+
cache-dependency-path: "ci/django-requirements.txt"
90+
91+
- name: Install mysqlclient
92+
run: |
93+
#pip install -r requirements.txt
94+
#pip install mysqlclient # Use stable version
95+
pip install .
96+
97+
- name: Setup Django
98+
run: |
99+
sudo apt-get install libmemcached-dev
100+
wget https://github.com/django/django/archive/${DJANGO_VERSION}.tar.gz
101+
tar xf ${DJANGO_VERSION}.tar.gz
102+
cp ci/test_mysql.py django-${DJANGO_VERSION}/tests/
103+
cd django-${DJANGO_VERSION}
104+
pip install . -r tests/requirements/py3.txt
105+
106+
- name: Run Django test
107+
run: |
108+
cd django-${DJANGO_VERSION}/tests/
109+
PYTHONPATH=.. python3 ./runtests.py --settings=test_mysql

.github/workflows/windows.yaml

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Build windows wheels
33
on:
44
push:
55
branches: ["main", "ci"]
6+
pull_request:
67
workflow_dispatch:
78

89
jobs:
@@ -67,8 +68,14 @@ jobs:
6768
CIBW_TEST_COMMAND: "python -c \"import MySQLdb; print(MySQLdb.version_info)\" "
6869
run: "python -m cibuildwheel --prerelease-pythons --output-dir dist"
6970

71+
- name: Build sdist
72+
working-directory: mysqlclient
73+
run: |
74+
python -m pip install build
75+
python -m build -s -o dist
76+
7077
- name: Upload Wheel
7178
uses: actions/upload-artifact@v3
7279
with:
7380
name: win-wheels
74-
path: mysqlclient/dist/*.whl
81+
path: mysqlclient/dist/*.*

setup.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ def get_config_posix(options=None):
7878
if static:
7979
ext_options["language"] = "c++"
8080

81-
print("Options for building extention module:")
82-
for k, v in ext_options.items():
83-
print(f" {k}: {v}")
84-
8581
return ext_options
8682

8783

@@ -157,7 +153,7 @@ def get_options():
157153
else:
158154
ext_options = get_config_posix(get_options())
159155

160-
print("# Extention options")
156+
print("# Options for building extention module:")
161157
for k, v in ext_options.items():
162158
print(f" {k}: {v}")
163159

0 commit comments

Comments
 (0)