|
|
@@ -0,0 +1,80 @@
|
|
|
+name: Tests
|
|
|
+
|
|
|
+on:
|
|
|
+ push:
|
|
|
+ branches: [ "main", "feature/*" ]
|
|
|
+ paths:
|
|
|
+ - '**.py'
|
|
|
+ - 'requirements*.txt'
|
|
|
+ - 'pyproject.toml'
|
|
|
+ - 'tests/**'
|
|
|
+ - '.github/workflows/test.yml'
|
|
|
+ pull_request:
|
|
|
+ branches: [ "main" ]
|
|
|
+ paths:
|
|
|
+ - '**.py'
|
|
|
+ - 'requirements*.txt'
|
|
|
+ - 'pyproject.toml'
|
|
|
+ - 'tests/**'
|
|
|
+ - '.github/workflows/test.yml'
|
|
|
+ # Allow manual trigger
|
|
|
+ workflow_dispatch:
|
|
|
+
|
|
|
+jobs:
|
|
|
+ test:
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+
|
|
|
+ steps:
|
|
|
+ - name: Checkout repository
|
|
|
+ uses: actions/checkout@v4
|
|
|
+
|
|
|
+ - name: Set up Python 3.11
|
|
|
+ uses: actions/setup-python@v5
|
|
|
+ with:
|
|
|
+ python-version: '3.11'
|
|
|
+ cache: 'pip'
|
|
|
+
|
|
|
+ - name: Install dependencies
|
|
|
+ run: |
|
|
|
+ python -m pip install --upgrade pip
|
|
|
+ pip install -r requirements.txt
|
|
|
+ pip install -r requirements-dev.txt
|
|
|
+
|
|
|
+ - name: Run unit tests with coverage
|
|
|
+ env:
|
|
|
+ CI: true
|
|
|
+ run: |
|
|
|
+ pytest tests/unit/ -v --cov=modules --cov=main --cov-report=xml --cov-report=term-missing
|
|
|
+
|
|
|
+ - name: Upload coverage reports to Codecov
|
|
|
+ uses: codecov/codecov-action@v4
|
|
|
+ if: always()
|
|
|
+ with:
|
|
|
+ file: ./coverage.xml
|
|
|
+ fail_ci_if_error: false
|
|
|
+ verbose: true
|
|
|
+ env:
|
|
|
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
|
+
|
|
|
+ lint:
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+
|
|
|
+ steps:
|
|
|
+ - name: Checkout repository
|
|
|
+ uses: actions/checkout@v4
|
|
|
+
|
|
|
+ - name: Set up Python 3.11
|
|
|
+ uses: actions/setup-python@v5
|
|
|
+ with:
|
|
|
+ python-version: '3.11'
|
|
|
+ cache: 'pip'
|
|
|
+
|
|
|
+ - name: Install linting dependencies
|
|
|
+ run: |
|
|
|
+ python -m pip install --upgrade pip
|
|
|
+ pip install ruff
|
|
|
+
|
|
|
+ - name: Run Ruff linter
|
|
|
+ run: |
|
|
|
+ ruff check --output-format=github .
|
|
|
+ continue-on-error: true
|