component-tests.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. name: Component Tests
  2. on:
  3. push:
  4. branches: [ main, develop ]
  5. paths:
  6. - 'web/src/client/**'
  7. - 'web/tests/unit/**'
  8. - 'web/vitest.config.components.ts'
  9. - '.github/workflows/component-tests.yml'
  10. pull_request:
  11. branches: [ main ]
  12. paths:
  13. - 'web/src/client/**'
  14. - 'web/tests/unit/**'
  15. - 'web/vitest.config.components.ts'
  16. - '.github/workflows/component-tests.yml'
  17. workflow_dispatch:
  18. jobs:
  19. component-tests:
  20. runs-on: ubuntu-latest
  21. timeout-minutes: 10
  22. steps:
  23. - name: Checkout code
  24. uses: actions/checkout@v4
  25. - name: Setup Node.js
  26. uses: actions/setup-node@v4
  27. with:
  28. node-version: '20'
  29. cache: 'pnpm'
  30. - name: Install pnpm
  31. uses: pnpm/action-setup@v2
  32. with:
  33. version: 8
  34. - name: Install dependencies
  35. run: pnpm install --frozen-lockfile
  36. - name: Run component tests
  37. run: |
  38. cd web
  39. pnpm test:components
  40. - name: Upload test results
  41. if: always()
  42. uses: actions/upload-artifact@v4
  43. with:
  44. name: component-test-results
  45. path: |
  46. test-results/
  47. coverage/
  48. retention-days: 7
  49. - name: Generate coverage report
  50. if: success()
  51. run: |
  52. cd web
  53. pnpm test:components:coverage
  54. - name: Upload coverage to Codecov
  55. if: success()
  56. uses: codecov/codecov-action@v3
  57. with:
  58. file: ./coverage/coverage-final.json
  59. flags: component-tests
  60. - name: Generate test summary
  61. if: always()
  62. uses: test-summary/action@v2
  63. with:
  64. paths: test-results/junit.xml
  65. - name: Notify on failure
  66. if: failure()
  67. uses: 8398a7/action-slack@v3
  68. with:
  69. status: ${{ job.status }}
  70. channel: '#ci-notifications'
  71. webhook_url: ${{ secrets.SLACK_WEBHOOK }}
  72. env:
  73. SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
  74. - name: Send test results to GitHub
  75. if: always()
  76. uses: dorny/test-reporter@v1
  77. with:
  78. name: Component Tests
  79. path: test-results/junit.xml
  80. reporter: jest-junit
  81. fail-on-error: false