Skip to content

tests

tests #219

Workflow file for this run

name: tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
type: [ "opened", "reopened", "synchronize" ]
schedule:
- cron: '0 12 * * 0' # run once a week on Sunday
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
tests:
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: P0sTGrE5*Pa55W0rt!
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
matrix:
python_version:
# [Python version, tox env]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
sqlalchemy_version:
- "sqlalchemy12"
- "sqlalchemy13"
- "sqlalchemy14"
- "sqlalchemy2x"
runs-on: ubuntu-latest
name: ${{ matrix.python_version[1] }}-${{ matrix.sqlalchemy_version }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version[0] }}
- uses: mirromutth/[email protected]
if: matrix.python_version[1] != 'flake8'
with:
mysql root password: TTI06Z80U875E39U
- name: Setup PostgreSQL environment
run: |
echo "localhost:5432:*:postgres:P0sTGrE5*Pa55W0rt!" >> ~/.pgpass
chmod 600 ~/.pgpass
- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.*', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test
env:
POSTGRES_HOST: localhost
POSTGRES_USER: postgres
MYSQL_HOST: 127.0.0.1
MYSQL_USER: root
MYSQL_PASS: TTI06Z80U875E39U
run: tox -e ${{ matrix.python_version[1] }} -- -vv --timeout=60
- name: Coverage
if: matrix.python_version[0] == '3.8' && matrix.sqlalchemy_version == 'sqlalchemy2x'
run: |
tox -e coverage -- -vv --timeout=60
pip install coveralls
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
POSTGRES_HOST: localhost
POSTGRES_USER: postgres
MYSQL_HOST: 127.0.0.1
MYSQL_USER: root
MYSQL_PASS: TTI06Z80U875E39U