Andrchest's picture
Single commit for HF2
365de9c
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 bandit
- name: Run linter
run: |
flake8 app/ --max-line-length=160 --extend-ignore=E203
- name: Run bandit
run: |
bandit -r app -x tests
- name: Run unit tests with coverage
env:
HF1_URL: ${{ secrets.HF1_URL }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
SECRET_PEPPER: ${{ secrets.SECRET_PEPPER }}
JWT_ALGORITHM: ${{ secrets.JWT_ALGORITHM }}
PYTHONPATH: ${{ github.workspace }}
working-directory: ./
run: |
coverage run --source=app -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