Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Run django test after our test #612

Merged
merged 1 commit into from
May 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: "29 15 * * 6"

Expand Down
53 changes: 0 additions & 53 deletions .github/workflows/django.yaml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Lint

on: [push, pull_request]
on:
push:
branches: ["main"]
pull_request:

jobs:
lint:
Expand Down
67 changes: 60 additions & 7 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ on:
pull_request:

jobs:
build:
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"]
Expand Down Expand Up @@ -38,19 +41,69 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "requirements.txt"

- name: Install dependencies
env:
PIP_NO_PYTHON_VERSION_WARNING: 1
PIP_DISABLE_PIP_VERSION_CHECK: 1
- name: Install mysqlclient
run: |
pip install -r requirements.txt
pip install .
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
9 changes: 8 additions & 1 deletion .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Build windows wheels
on:
push:
branches: ["main", "ci"]
pull_request:
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -67,8 +68,14 @@ jobs:
CIBW_TEST_COMMAND: "python -c \"import MySQLdb; print(MySQLdb.version_info)\" "
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
uses: actions/upload-artifact@v3
with:
name: win-wheels
path: mysqlclient/dist/*.whl
path: mysqlclient/dist/*.*
6 changes: 1 addition & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ def get_config_posix(options=None):
if static:
ext_options["language"] = "c++"

print("Options for building extention module:")
for k, v in ext_options.items():
print(f" {k}: {v}")

return ext_options


Expand Down Expand Up @@ -157,7 +153,7 @@ def get_options():
else:
ext_options = get_config_posix(get_options())

print("# Extention options")
print("# Options for building extention module:")
for k, v in ext_options.items():
print(f" {k}: {v}")

Expand Down