Spaces:
Sleeping
Sleeping
| name: CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "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: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov ruff black mypy | |
| - name: Lint with ruff | |
| run: | | |
| ruff check src/ ui/ tests/ || true | |
| - name: Format check with black | |
| run: | | |
| black --check src/ ui/ tests/ app.py || true | |
| - name: Run tests | |
| run: | | |
| pytest tests/ -v --cov=src --cov=ui --cov-report=xml --cov-report=html --cov-report=term-missing --cov-fail-under=85 --junitxml=pytest-report.xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.python-version }} | |
| path: | | |
| pytest-report.xml | |
| htmlcov/ | |
| - name: Publish test report | |
| if: always() | |
| uses: mikepenz/action-junit-report@v4 | |
| with: | |
| report_paths: pytest-report.xml | |
| check_name: Test Report (Python ${{ matrix.python-version }}) | |
| type-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install mypy | |
| - name: Type check | |
| run: | | |
| mypy src/ --ignore-missing-imports || true | |