mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-16 12:27:03 +08:00
ci: Run django test after our test (#612)
This commit is contained in:
1
.github/workflows/codeql.yml
vendored
1
.github/workflows/codeql.yml
vendored
@ -4,7 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "29 15 * * 6"
|
- cron: "29 15 * * 6"
|
||||||
|
|
||||||
|
53
.github/workflows/django.yaml
vendored
53
.github/workflows/django.yaml
vendored
@ -1,53 +0,0 @@
|
|||||||
name: Django compat test
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: "Run Django LTS test suite"
|
|
||||||
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
|
|
5
.github/workflows/lint.yaml
vendored
5
.github/workflows/lint.yaml
vendored
@ -1,6 +1,9 @@
|
|||||||
name: Lint
|
name: Lint
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
|
67
.github/workflows/tests.yaml
vendored
67
.github/workflows/tests.yaml
vendored
@ -6,8 +6,11 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
PIP_NO_PYTHON_VERSION_WARNING: 1
|
||||||
|
PIP_DISABLE_PIP_VERSION_CHECK: 1
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.8", "3.9", "3.10", "3.11"]
|
python-version: ["3.8", "3.9", "3.10", "3.11"]
|
||||||
@ -38,15 +41,17 @@ jobs:
|
|||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
cache: "pip"
|
||||||
|
cache-dependency-path: "requirements.txt"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install mysqlclient
|
||||||
env:
|
run: |
|
||||||
PIP_NO_PYTHON_VERSION_WARNING: 1
|
pip install -v .
|
||||||
PIP_DISABLE_PIP_VERSION_CHECK: 1
|
|
||||||
|
- name: Install test dependencies
|
||||||
run: |
|
run: |
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
pip install .
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
env:
|
env:
|
||||||
TESTDB: actions.cnf
|
TESTDB: actions.cnf
|
||||||
@ -54,3 +59,51 @@ jobs:
|
|||||||
pytest --cov=MySQLdb tests
|
pytest --cov=MySQLdb tests
|
||||||
|
|
||||||
- uses: codecov/codecov-action@v3
|
- 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
|
||||||
|
9
.github/workflows/windows.yaml
vendored
9
.github/workflows/windows.yaml
vendored
@ -3,6 +3,7 @@ name: Build windows wheels
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["main", "ci"]
|
branches: ["main", "ci"]
|
||||||
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -67,8 +68,14 @@ jobs:
|
|||||||
CIBW_TEST_COMMAND: "python -c \"import MySQLdb; print(MySQLdb.version_info)\" "
|
CIBW_TEST_COMMAND: "python -c \"import MySQLdb; print(MySQLdb.version_info)\" "
|
||||||
run: "python -m cibuildwheel --prerelease-pythons --output-dir dist"
|
run: "python -m cibuildwheel --prerelease-pythons --output-dir dist"
|
||||||
|
|
||||||
|
- name: Build sdist
|
||||||
|
working-directory: mysqlclient
|
||||||
|
run: |
|
||||||
|
python -m pip install build
|
||||||
|
python -m build -s -o dist
|
||||||
|
|
||||||
- name: Upload Wheel
|
- name: Upload Wheel
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: win-wheels
|
name: win-wheels
|
||||||
path: mysqlclient/dist/*.whl
|
path: mysqlclient/dist/*.*
|
||||||
|
6
setup.py
6
setup.py
@ -78,10 +78,6 @@ def get_config_posix(options=None):
|
|||||||
if static:
|
if static:
|
||||||
ext_options["language"] = "c++"
|
ext_options["language"] = "c++"
|
||||||
|
|
||||||
print("Options for building extention module:")
|
|
||||||
for k, v in ext_options.items():
|
|
||||||
print(f" {k}: {v}")
|
|
||||||
|
|
||||||
return ext_options
|
return ext_options
|
||||||
|
|
||||||
|
|
||||||
@ -157,7 +153,7 @@ if sys.platform == "win32":
|
|||||||
else:
|
else:
|
||||||
ext_options = get_config_posix(get_options())
|
ext_options = get_config_posix(get_options())
|
||||||
|
|
||||||
print("# Extention options")
|
print("# Options for building extention module:")
|
||||||
for k, v in ext_options.items():
|
for k, v in ext_options.items():
|
||||||
print(f" {k}: {v}")
|
print(f" {k}: {v}")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user