diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ddc6d6e2..9bab6e0c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -4,7 +4,6 @@ on: push: branches: [ "main" ] pull_request: - branches: [ "main" ] schedule: - cron: "29 15 * * 6" diff --git a/.github/workflows/django.yaml b/.github/workflows/django.yaml deleted file mode 100644 index a7e076ce..00000000 --- a/.github/workflows/django.yaml +++ /dev/null @@ -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 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 77a13c22..343b00fd 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,6 +1,9 @@ name: Lint -on: [push, pull_request] +on: + push: + branches: ["main"] + pull_request: jobs: lint: diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 743f1eb3..c770ff9b 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -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"] @@ -38,15 +41,17 @@ 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 @@ -54,3 +59,51 @@ jobs: 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 diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 0c7184d2..23c04320 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -3,6 +3,7 @@ name: Build windows wheels on: push: branches: ["main", "ci"] + pull_request: workflow_dispatch: jobs: @@ -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/*.* diff --git a/setup.py b/setup.py index 5594df54..2fa4cbbd 100644 --- a/setup.py +++ b/setup.py @@ -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 @@ -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}")