Convert Stats to use a local database session #78
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: Test | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
container: ubuntu:20.04 | |
strategy: | |
matrix: | |
include: | |
- database: sqlite | |
database_url: "sqlite://" | |
- database: mysql | |
database_url: "mysql://pytrainer:pytrainer@mysql/pytrainer" | |
- database: postgresql | |
database_url: "postgresql://pytrainer:pytrainer@postgres/pytrainer" | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: pytrainer | |
MYSQL_USER: pytrainer | |
MYSQL_PASSWORD: pytrainer | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd "mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: pytrainer | |
POSTGRES_PASSWORD: pytrainer | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: install distribution packaged dependencies | |
timeout-minutes: 5 | |
run: | | |
apt-get update | |
DEBIAN_FRONTEND=noninteractive apt-get install -y xvfb python3-pip python3-setuptools python3-gi gir1.2-gtk-3.0 python3-lxml python3-cairo python3-gi-cairo python3-matplotlib python3-psycopg2 python3-mysqldb locales-all git | |
- name: install pip dependencies | |
run: pip install -e .[mysql,postgresql] | |
- name: run tests | |
timeout-minutes: 5 | |
env: | |
PYTRAINER_ALCHEMYURL: ${{ matrix.database_url }} | |
TZ: Europe/Kaliningrad | |
LC_TIME: C | |
run: xvfb-run python3 -Wall -m unittest | |
test_tox: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox tox-gh-actions | |
- name: Test with tox | |
run: tox |