.github/workflows/test.yml
name: Tests
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
unit_test:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8, 3.9, '3.10']
steps:
- name: Cancel Outdated Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip3-${{ hashFiles('*requirements.txt') }}
- name: Install dependencies
run: pip install -e .[dev]
- name: Check package version conflicts
run: pip check
- name: Run unit tests
run: pytest -vv tests/unit_tests -n auto
integration_test:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip3-${{ hashFiles('*requirements.txt') }}
- name: Install dependencies
run: pip install -e .[dev]
- name: Launch test server
working-directory: tests/integration_tests
run: docker compose up -d && sleep 30
- name: Print docker services info
run: docker compose ps -a
- name: Run integration tests
working-directory: tests/integration_tests
run: pytest . -vv -n auto