Skip to content

Tests

Tests #176

Workflow file for this run

name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 0 * * *' # Daily at midnight UTC
defaults:
run:
shell: bash
jobs:
test:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: |
.venv
~/.cache/pypoetry
key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ runner.os }}-${{ matrix.python-version }}-
- name: Install dependencies
run: |
poetry install --with dev,test --no-interaction
- name: Run tests with coverage
run: |
poetry run pytest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false
- name: Run type checking
run: |
poetry run mypy src/dialogchain --ignore-missing-imports
- name: Lint with flake8
run: |
poetry run flake8 src/dialogchain tests
- name: Check formatting with black
run: |
poetry run black --check src tests
- name: Check import sorting with isort
run: |
poetry run isort --check-only src tests
- name: Test CLI functionality
run: |
poetry run dialogchain --help
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: |
poetry install --no-interaction
- name: Run integration tests
run: |
poetry run pytest tests/integration/ -v
build:
name: Build Package
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
- name: Build package
run: |
poetry build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/