69 lines
2.0 KiB
YAML
69 lines
2.0 KiB
YAML
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
|
|
|
name: build
|
|
|
|
on:
|
|
push:
|
|
branches-ignore:
|
|
- 'gh-pages'
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
tests:
|
|
name: "Python ${{ matrix.python-version }}"
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: [3.6, 3.7, 3.8, 3.9]
|
|
fail-fast: false
|
|
|
|
services:
|
|
mysql:
|
|
image: mysql:5.7
|
|
env:
|
|
MYSQL_USER: username
|
|
MYSQL_PASSWORD: password
|
|
MYSQL_ROOT_PASSWORD: password
|
|
MYSQL_DATABASE: testsuite
|
|
ports:
|
|
- 3306:3306
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
|
|
postgres:
|
|
image: postgres:10.8
|
|
env:
|
|
POSTGRES_USER: username
|
|
POSTGRES_PASSWORD: password
|
|
POSTGRES_DB: testsuite
|
|
ports:
|
|
- 5432:5432
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
- name: Run sqlite
|
|
env:
|
|
DATABASE_URL: "sqlite:///testsuite"
|
|
run: bash scripts/test.sh
|
|
- name: Run postgres
|
|
env:
|
|
DATABASE_URL: "postgresql://username:password@localhost:5432/testsuite"
|
|
run: bash scripts/test.sh
|
|
- name: Run mysql
|
|
env:
|
|
DATABASE_URL: "mysql://username:password@127.0.0.1:3306/testsuite"
|
|
run: bash scripts/test.sh
|
|
- run: mypy --config-file mypy.ini ormar tests
|
|
- name: Upload coverage
|
|
uses: codecov/codecov-action@v1
|