forked from aio-libs/aiomysql
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- migrate travis CI tests to github actions, fixes aio-libs#541
- release publishing is not currently implemented - drop python 3.5 and 3.6 support - run tests for python 3.7 to 3.9 - python 3.10 tests fail due to removed `loop` argument, therefore currently disabled - this is only an issue in the test suite afaik - python 3.11 tests currently fail to install `uvloop`, therefore currently disabled - see MagicStack/uvloop#450 - run tests for MySQL 5.7 and 8.0 `latest` - run tests for MariaDB 10.2 to 10.7 and `latest` - bump dev/test dependencies - migrate deprecated test syntax - remove docker integration from tests, for automated builds this is now covered by github actions - async test methods have been broken before already https://app.travis-ci.com/github/aio-libs/aiomysql/jobs/448298144#L2340 - each matrix job is currently limited to 15 minutes total execution, it should be safe to expect the tests to be completed by then. in my tests (with pip cache) the tests usually run about 1.5 minutes. - pytest job is soft limited to 5 minutes, hard limited to 6 minutes to avoid test hangs. in my tests this is typically completed in less than a minute. in broken tests we can easily deadlock otherwise and the test would otherwise keep running for hours. - port fix for `test_issue_3` for MySQL 8.0 compatibility from PyMySQL/PyMySQL#658 - `test_connection_gone_away` fails on MySQL 8.0 - `test_drop_connection_if_timedout` fails on MySQL 8.0, test was patched to close the pool to avoid blocking forever
- Loading branch information
1 parent
6b2b940
commit 6465657
Showing
10 changed files
with
328 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
|
||
jobs: | ||
test: | ||
name: Test | ||
strategy: | ||
matrix: | ||
# service containers are only supported on ubuntu currently | ||
os: | ||
- ubuntu-latest | ||
py: | ||
- '3.7' | ||
- '3.8' | ||
- '3.9' | ||
# - '3.10' | ||
# - '3.11.0-alpha.3' | ||
db: | ||
- 'mysql:5.7' | ||
- 'mysql:8.0' | ||
- 'mysql:latest' | ||
- 'mariadb:10.2' | ||
- 'mariadb:10.3' | ||
- 'mariadb:10.4' | ||
- 'mariadb:10.5' | ||
- 'mariadb:10.6' | ||
- 'mariadb:10.7' | ||
- 'mariadb:latest' | ||
# better readability on matrix job names than setting the env var content directly | ||
asynciodebug: | ||
- aiodebug | ||
- no aiodebug | ||
|
||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 15 | ||
|
||
env: | ||
MYSQL_ROOT_PASSWORD: rootpw | ||
|
||
services: | ||
mysql: | ||
image: '${{ matrix.db }}' | ||
ports: | ||
- 3306:3306 | ||
options: '--name=mysqld' | ||
env: | ||
MYSQL_ROOT_PASSWORD: rootpw | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2.4.0 | ||
|
||
- name: Setup Python ${{ matrix.py }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.py }} | ||
|
||
- name: Get pip cache dir | ||
id: pip-cache | ||
run: | | ||
echo "::set-output name=dir::$(pip cache dir)" # - name: Cache | ||
- name: Cache PyPI | ||
uses: actions/cache@v2.1.7 | ||
with: | ||
key: pip-ci-${{ runner.os }}-${{ matrix.py }} | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
|
||
- name: Update pip, wheel, setuptools, build, twine, codecov | ||
run: | | ||
python -m pip install -U pip wheel setuptools build twine codecov | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade --requirement requirements-dev.txt | ||
- name: Install aiomysql | ||
run: | | ||
python -m pip install . | ||
- name: Check rst | ||
run: | | ||
python setup.py check --restructuredtext | ||
- name: Run pyroma | ||
run: | | ||
python -m pyroma -d . | ||
# this ensures our database is ready. typically by the time the preparations have completed its first start logic. | ||
# unfortunately we need this hacky workaround as GitHub Actions service containers can't reference data from our repo. | ||
- name: Prepare mysql | ||
run: | | ||
# ensure server is started up | ||
while : | ||
do | ||
sleep 1 | ||
mysql -h127.0.0.1 -uroot "-p$MYSQL_ROOT_PASSWORD" -e 'select version()' && break | ||
done | ||
# inject tls configuration | ||
docker container stop mysqld | ||
docker container cp "${{ github.workspace }}/tests/ssl_resources/ssl" mysqld:/etc/mysql/ssl | ||
docker container cp "${{ github.workspace }}/tests/ssl_resources/tls.cnf" mysqld:/etc/mysql/conf.d/aiomysql-tls.cnf | ||
docker container start mysqld | ||
# ensure server is started up | ||
while : | ||
do | ||
sleep 1 | ||
mysql -h127.0.0.1 -uroot "-p$MYSQL_ROOT_PASSWORD" -e 'select version()' && break | ||
done | ||
mysql -h127.0.0.1 -uroot "-p$MYSQL_ROOT_PASSWORD" -e "SET GLOBAL local_infile=on" | ||
- name: Run tests | ||
run: | | ||
export DB="${MATRIX_DB%%:*}" | ||
export DBTAG="${MATRIX_DB##*:}" | ||
# timeout ensures a more or less clean stop by sending a KeyboardInterrupt which will still provide useful logs | ||
timeout --preserve-status --signal=INT --verbose 5m \ | ||
py.test --color=yes --capture=no --verbosity 2 --cov-report term --cov-report xml --cov aiomysql ./tests | ||
env: | ||
PYTHONUNBUFFERED: 1 | ||
PYTHONASYNCIODEBUG: "${{ matrix.asynciodebug == 'aiodebug' && '1' || '' }}" | ||
MATRIX_DB: '${{ matrix.db }}' | ||
timeout-minutes: 6 | ||
|
||
- name: Build coverage flag | ||
run: | | ||
COVERAGE_FLAG="${MATRIX_OS}_${MATRIX_PY}_${MATRIX_DB//:/-}_${MATRIX_AIODEBUG// /-}" | ||
echo "COVERAGE_FLAG=$COVERAGE_FLAG" | tee -a "$GITHUB_ENV" | ||
env: | ||
MATRIX_OS: '${{ matrix.os }}' | ||
MATRIX_PY: '${{ matrix.py }}' | ||
MATRIX_DB: '${{ matrix.db }}' | ||
MATRIX_AIODEBUG: "${{ matrix.asynciodebug }}" | ||
|
||
- name: Upload coverage | ||
uses: codecov/codecov-action@v2.1.0 | ||
with: | ||
file: ./coverage.xml | ||
flags: "${{ env.COVERAGE_FLAG }}" | ||
fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: lint | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2.4.0 | ||
|
||
- name: Setup Python 3.10 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Get pip cache dir | ||
id: pip-cache | ||
run: | | ||
echo "::set-output name=dir::$(pip cache dir)" # - name: Cache | ||
- name: Cache PyPI | ||
uses: actions/cache@v2.1.7 | ||
with: | ||
key: pip-lint | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
|
||
- name: flake8 Lint | ||
uses: py-actions/flake8@v2.0.0 | ||
with: | ||
flake8-version: 4.0.1 | ||
path: aiomysql | ||
args: tests examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
coverage>=4.5.1,<=5.1 | ||
flake8>=3.5.0,<=3.7.9 | ||
ipdb>=0.11,<=0.13.2 | ||
ipython>=7.0.1,<=7.13.0 | ||
pytest>=3.9.1,<=5.4.1 | ||
pytest-cov>=2.6.0,<=2.8.1 | ||
pytest-sugar>=0.9.1,<=0.9.3 | ||
coverage==6.2 | ||
flake8==4.0.1 | ||
ipdb==0.13.9 | ||
pytest==6.2.5 | ||
pytest-cov==3.0.0 | ||
pytest-sugar==0.9.4 | ||
PyMySQL>=0.9,<=0.9.3 | ||
docker>=3.5.1,<=4.2.0 | ||
sphinx>=1.8.1, <=3.0.3 | ||
sphinxcontrib-asyncio==0.2.0 | ||
sqlalchemy>1.2.12,<=1.3.16 | ||
uvloop>=0.11.2,<=0.14.0; python_version >= '3.5' | ||
pyroma==2.6 | ||
uvloop==0.16.0 | ||
pyroma==3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.