fe-unit-tests.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Workflow that runs frontend unit tests
  2. name: Run Frontend Unit Tests
  3. # * Always run on "main"
  4. # * Run on PRs that have changes in the "frontend" folder or this workflow
  5. on:
  6. push:
  7. branches:
  8. - main
  9. pull_request:
  10. paths:
  11. - 'frontend/**'
  12. - '.github/workflows/fe-unit-tests.yml'
  13. # If triggered by a PR, it will be in the same group. However, each commit on main will be in its own unique group
  14. concurrency:
  15. group: ${{ github.workflow }}-${{ (github.head_ref && github.ref) || github.run_id }}
  16. cancel-in-progress: true
  17. jobs:
  18. # Run frontend unit tests
  19. fe-test:
  20. name: FE Unit Tests
  21. runs-on: ubuntu-latest
  22. strategy:
  23. matrix:
  24. node-version: [20, 22]
  25. fail-fast: true
  26. steps:
  27. - name: Checkout
  28. uses: actions/checkout@v4
  29. - name: Set up Node.js
  30. uses: actions/setup-node@v4
  31. with:
  32. node-version: ${{ matrix.node-version }}
  33. - name: Install dependencies
  34. working-directory: ./frontend
  35. run: npm ci
  36. - name: Run TypeScript compilation
  37. working-directory: ./frontend
  38. run: npm run make-i18n && tsc
  39. - name: Run tests and collect coverage
  40. working-directory: ./frontend
  41. run: npm run test:coverage
  42. - name: Upload coverage to Codecov
  43. uses: codecov/codecov-action@v4
  44. env:
  45. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}