Skip to content

Tests

Tests #717

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * 0"
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
env:
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"
- name: Install dependencies
run: poetry install
- name: Workaround mpyp not type-checking wsgidav
run: poetry run python -m manabi.mypy_fix
- name: Run flake8
run: poetry run flake8 manabi
- name: Run mypy
run: poetry run mypy manabi
- name: Run isort
run: poetry run isort --check-only manabi
- name: Run black
run: poetry run black --check manabi
compatibility-tests:
name: Compatibility tests
needs: [lint]
runs-on: ubuntu-latest
strategy:
matrix:
version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
services:
postgres:
image: postgres:alpine
env:
POSTGRES_DB: manabi
POSTGRES_USER: manabi
POSTGRES_PASSWORD: manabi
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Set hypothesis to ci-profile
run: echo "HYPOTHESIS_PROFILE=ci" >> $GITHUB_ENV
- name: Setup environment
run: sudo apt-get install -y libsodium23
- name: Install poetry
run: pipx install poetry
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}
cache: "poetry"
- name: Install dependendies
run: poetry install
- name: Run migrations
run: poetry run python manabi_django/manage.py migrate manabi_migrations
- name: Run tests
run: poetry run pytest -v manabi