1
0

test.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. name: Tests
  2. on:
  3. push:
  4. branches: [ "main", "feature/*" ]
  5. paths:
  6. - '**.py'
  7. - 'requirements*.txt'
  8. - 'pyproject.toml'
  9. - 'tests/**'
  10. - 'frontend/**'
  11. - '.github/workflows/test.yml'
  12. pull_request:
  13. branches: [ "main" ]
  14. paths:
  15. - '**.py'
  16. - 'requirements*.txt'
  17. - 'pyproject.toml'
  18. - 'tests/**'
  19. - 'frontend/**'
  20. - '.github/workflows/test.yml'
  21. # Allow manual trigger
  22. workflow_dispatch:
  23. jobs:
  24. # Backend tests
  25. test:
  26. runs-on: ubuntu-latest
  27. steps:
  28. - name: Checkout repository
  29. uses: actions/checkout@v4
  30. - name: Set up Python 3.11
  31. uses: actions/setup-python@v5
  32. with:
  33. python-version: '3.11'
  34. cache: 'pip'
  35. - name: Install dependencies
  36. run: |
  37. python -m pip install --upgrade pip
  38. pip install -r requirements.txt
  39. pip install -r requirements-dev.txt
  40. - name: Run unit tests with coverage
  41. env:
  42. CI: true
  43. run: |
  44. pytest tests/unit/ -v --cov=modules --cov=main --cov-report=xml --cov-report=term-missing
  45. - name: Upload coverage reports to Codecov
  46. uses: codecov/codecov-action@v4
  47. if: always()
  48. with:
  49. file: ./coverage.xml
  50. fail_ci_if_error: false
  51. verbose: true
  52. env:
  53. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  54. lint:
  55. runs-on: ubuntu-latest
  56. steps:
  57. - name: Checkout repository
  58. uses: actions/checkout@v4
  59. - name: Set up Python 3.11
  60. uses: actions/setup-python@v5
  61. with:
  62. python-version: '3.11'
  63. cache: 'pip'
  64. - name: Install linting dependencies
  65. run: |
  66. python -m pip install --upgrade pip
  67. pip install ruff
  68. - name: Run Ruff linter
  69. run: |
  70. ruff check --output-format=github .
  71. continue-on-error: true
  72. # Frontend unit/integration tests
  73. frontend-test:
  74. runs-on: ubuntu-latest
  75. defaults:
  76. run:
  77. working-directory: frontend
  78. steps:
  79. - name: Checkout repository
  80. uses: actions/checkout@v4
  81. - name: Set up Node.js
  82. uses: actions/setup-node@v4
  83. with:
  84. node-version: '20'
  85. cache: 'npm'
  86. cache-dependency-path: frontend/package-lock.json
  87. - name: Install dependencies
  88. run: npm ci
  89. - name: Run Vitest tests
  90. run: npm test
  91. - name: Run Vitest with coverage
  92. run: npm run test:coverage
  93. continue-on-error: true
  94. # Frontend E2E tests
  95. frontend-e2e:
  96. runs-on: ubuntu-latest
  97. timeout-minutes: 10
  98. defaults:
  99. run:
  100. working-directory: frontend
  101. steps:
  102. - name: Checkout repository
  103. uses: actions/checkout@v4
  104. - name: Set up Node.js
  105. uses: actions/setup-node@v4
  106. with:
  107. node-version: '20'
  108. cache: 'npm'
  109. cache-dependency-path: frontend/package-lock.json
  110. - name: Install dependencies
  111. run: npm ci
  112. - name: Install Playwright browsers
  113. run: npx playwright install --with-deps chromium
  114. - name: Run Playwright tests
  115. run: npm run test:e2e
  116. env:
  117. CI: true
  118. - name: Upload Playwright report
  119. uses: actions/upload-artifact@v4
  120. if: failure()
  121. with:
  122. name: playwright-report
  123. path: frontend/playwright-report/
  124. retention-days: 7