test.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. name: Tests
  2. on:
  3. push:
  4. branches: [ "main", "feature/*" ]
  5. paths:
  6. - '**.py'
  7. - 'requirements*.txt'
  8. - 'pyproject.toml'
  9. - 'tests/**'
  10. - '.github/workflows/test.yml'
  11. pull_request:
  12. branches: [ "main" ]
  13. paths:
  14. - '**.py'
  15. - 'requirements*.txt'
  16. - 'pyproject.toml'
  17. - 'tests/**'
  18. - '.github/workflows/test.yml'
  19. # Allow manual trigger
  20. workflow_dispatch:
  21. jobs:
  22. test:
  23. runs-on: ubuntu-latest
  24. steps:
  25. - name: Checkout repository
  26. uses: actions/checkout@v4
  27. - name: Set up Python 3.11
  28. uses: actions/setup-python@v5
  29. with:
  30. python-version: '3.11'
  31. cache: 'pip'
  32. - name: Install dependencies
  33. run: |
  34. python -m pip install --upgrade pip
  35. pip install -r requirements.txt
  36. pip install -r requirements-dev.txt
  37. - name: Run unit tests with coverage
  38. env:
  39. CI: true
  40. run: |
  41. pytest tests/unit/ -v --cov=modules --cov=main --cov-report=xml --cov-report=term-missing
  42. - name: Upload coverage reports to Codecov
  43. uses: codecov/codecov-action@v4
  44. if: always()
  45. with:
  46. file: ./coverage.xml
  47. fail_ci_if_error: false
  48. verbose: true
  49. env:
  50. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  51. lint:
  52. runs-on: ubuntu-latest
  53. steps:
  54. - name: Checkout repository
  55. uses: actions/checkout@v4
  56. - name: Set up Python 3.11
  57. uses: actions/setup-python@v5
  58. with:
  59. python-version: '3.11'
  60. cache: 'pip'
  61. - name: Install linting dependencies
  62. run: |
  63. python -m pip install --upgrade pip
  64. pip install ruff
  65. - name: Run Ruff linter
  66. run: |
  67. ruff check --output-format=github .
  68. continue-on-error: true