use own mysql context manager #14
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
name: Python | |
on: | |
push: | |
paths-ignore: | |
- '*.md' | |
pull_request: | |
paths-ignore: | |
- '*.md' | |
jobs: | |
test-ubuntu: | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Setup MySQL | |
uses: mirromutth/[email protected] | |
with: | |
mysql root password: "123" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends mysql-client | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt -r requirements-test.txt | |
- name: Test | |
run: | | |
while ! mysqladmin ping -h 127.0.0.1 -uroot -p123 --silent; do | |
sleep 1 | |
done | |
mysql -h 127.0.0.1 -uroot -p123 -e "CREATE DATABASE IF NOT EXISTS test" | |
mysql -h 127.0.0.1 -uroot -p123 test < db/db.sql | |
mysql -h 127.0.0.1 -uroot -p123 test < db/test.sql | |
python create_admin.py admin | |
pytest --ruff app --cov=app tests | |
env: | |
MYSQL_DSN: mysql+asyncmy://root:[email protected]:3306/test?charset=utf8mb4 | |
- name: Upload coverage reports to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true |