name: Tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
workflow_dispatch: # Allow manual trigger
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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.11", "3.12", "3.13"]
include:
- os: macos-latest
python-version: "3.12"
- os: windows-latest
python-version: "3.12"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install dependencies
run: |
uv pip install -e ".[test]" --system
- name: Run tests with coverage
run: |
uv run pytest tests/ -v --cov=src/delia --cov-report=xml --cov-report=term-missing -x
env:
PYTHONPATH: ${{ github.workspace }}
- name: Upload coverage to Codecov
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: false
verbose: true
fuzz:
name: Property-based tests (Fuzzing)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install dependencies
run: |
uv pip install -e ".[test]" --system
- name: Run fuzz tests with extended examples
run: |
uv run pytest tests/ -v -m fuzz --hypothesis-seed=0
env:
PYTHONPATH: ${{ github.workspace }}
HYPOTHESIS_MAX_EXAMPLES: 500
lint:
name: Lint and type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install dependencies
run: |
uv pip install ruff pyright --system
uv pip install -e ".[test]" --system
- name: Run ruff check
run: ruff check . --output-format=github
continue-on-error: true
- name: Run ruff format check
run: ruff format --check .
continue-on-error: true
security:
name: Security scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install bandit
run: pip install bandit[toml]
- name: Run security scan
run: |
bandit -r . -x ./tests,./venv,./.venv,./dashboard/node_modules -f json -o bandit-report.json || true
bandit -r . -x ./tests,./venv,./.venv,./dashboard/node_modules -f txt
- name: Upload security report
uses: actions/upload-artifact@v4
with:
name: bandit-report
path: bandit-report.json
retention-days: 30