| 1 |
name: Test |
| 2 |
|
| 3 |
on: [push, pull_request] |
| 4 |
|
| 5 |
jobs: |
| 6 |
test: |
| 7 |
runs-on: ubuntu-latest |
| 8 |
timeout-minutes: 15 |
| 9 |
container: ubuntu:20.04 |
| 10 |
strategy: |
| 11 |
matrix: |
| 12 |
include: |
| 13 |
- database: sqlite |
| 14 |
database_url: "sqlite://" |
| 15 |
- database: mysql |
| 16 |
database_url: "mysql://pytrainer:pytrainer@mysql/pytrainer" |
| 17 |
- database: postgresql |
| 18 |
database_url: "postgresql://pytrainer:pytrainer@postgres/pytrainer" |
| 19 |
services: |
| 20 |
mysql: |
| 21 |
image: mysql:5.7 |
| 22 |
env: |
| 23 |
MYSQL_ALLOW_EMPTY_PASSWORD: yes |
| 24 |
MYSQL_DATABASE: pytrainer |
| 25 |
MYSQL_USER: pytrainer |
| 26 |
MYSQL_PASSWORD: pytrainer |
| 27 |
ports: |
| 28 |
- 3306:3306 |
| 29 |
options: >- |
| 30 |
--health-cmd "mysqladmin ping" |
| 31 |
--health-interval 10s |
| 32 |
--health-timeout 5s |
| 33 |
--health-retries 5 |
| 34 |
postgres: |
| 35 |
image: postgres |
| 36 |
env: |
| 37 |
POSTGRES_USER: pytrainer |
| 38 |
POSTGRES_PASSWORD: pytrainer |
| 39 |
ports: |
| 40 |
- 5432:5432 |
| 41 |
options: >- |
| 42 |
--health-cmd pg_isready |
| 43 |
--health-interval 10s |
| 44 |
--health-timeout 5s |
| 45 |
--health-retries 5 |
| 46 |
steps: |
| 47 |
- uses: actions/checkout@v1 |
| 48 |
with: |
| 49 |
fetch-depth: 1 |
| 50 |
- name: install deps |
| 51 |
timeout-minutes: 5 |
| 52 |
run: | |
| 53 |
apt-get update |
| 54 |
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 |
| 55 |
- name: run tests |
| 56 |
timeout-minutes: 5 |
| 57 |
env: |
| 58 |
PYTRAINER_ALCHEMYURL: ${{ matrix.database_url }} |
| 59 |
TZ: Europe/Kaliningrad |
| 60 |
LC_TIME: C |
| 61 |
run: xvfb-run python3 -Wall setup.py test |
| 62 |
|
| 63 |
test_tox: |
| 64 |
runs-on: ubuntu-latest |
| 65 |
strategy: |
| 66 |
matrix: |
| 67 |
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] |
| 68 |
|
| 69 |
steps: |
| 70 |
- uses: actions/checkout@v3 |
| 71 |
- name: Set up Python ${{ matrix.python-version }} |
| 72 |
uses: actions/setup-python@v4 |
| 73 |
with: |
| 74 |
python-version: ${{ matrix.python-version }} |
| 75 |
- name: Install dependencies |
| 76 |
run: | |
| 77 |
python -m pip install --upgrade pip |
| 78 |
python -m pip install tox tox-gh-actions |
| 79 |
- name: Test with tox |
| 80 |
run: tox |