Spaces:
Sleeping
Sleeping
| name: Unit Tests | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install coverage | |
| pip install -r app/requirements.txt | |
| pip install flake8 pytest | |
| - name: Run linter | |
| run: | | |
| flake8 app/ --max-line-length=160 --extend-ignore=E203 | |
| - name: Run unit tests with coverage | |
| run: | | |
| coverage run -m pytest app/tests/unit/test.py | |
| coverage xml | |
| coverage html | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: unit-coverage-report | |
| path: | | |
| coverage.xml | |
| htmlcov/ | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml |