fe-unit-tests.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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]
  25. steps:
  26. - name: Checkout
  27. uses: actions/checkout@v4
  28. - name: Set up Node.js
  29. uses: actions/setup-node@v4
  30. with:
  31. node-version: ${{ matrix.node-version }}
  32. - name: Install dependencies
  33. working-directory: ./frontend
  34. run: npm ci
  35. - name: Run tests and collect coverage
  36. working-directory: ./frontend
  37. run: npm run test:coverage
  38. - name: Upload coverage to Codecov
  39. uses: codecov/codecov-action@v4
  40. env:
  41. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}