Skip to content

Add pre-commit config and fix all the things #554

Add pre-commit config and fix all the things

Add pre-commit config and fix all the things #554

Workflow file for this run

name: pytest
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
db-backend: [mysql, postgres]
python-version: ['3.9', '3.12']
services:
postgres:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres_password
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install prerequisites
run: |
sudo apt update
sudo apt install -y libpq-dev postgresql postgresql-client
python -m pip install --upgrade pip
- name: Install Daiquiri
run: |
pip install -e .[ci]
- name: Prepare testing app
run: |
cp testing/config/settings/${{ matrix.db-backend }}.py testing/config/settings/local.py
mkdir testing/log testing/download
- name: Prepare MySQL database
run: |
sudo systemctl start mysql.service
mysql --user=root --password=root < testing/sql/mysql/setup.sql
- name: Prepare PostgreSQL database
run: |
psql postgresql://postgres:postgres_password@localhost:5432 -f testing/sql/postgres/setup.sql
psql postgresql://postgres:postgres_password@localhost:5432/test_daiquiri_data -c 'VACUUM ANALYSE;'
- name: Run tests
run: |
pytest --reuse-db --cov=daiquiri
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: '${{ matrix.db-backend }}: ${{ matrix.python-version }}'
COVERALLS_PARALLEL: true
coveralls:
name: Indicate completion to coveralls
needs: build
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Run Coveralls finish
run: |
pip install coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}