name: Frontend tests

on:
  pull_request:
    paths:
      - 'frontend/**'
      - '.github/workflows/frontend-test.yaml'

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 20

      - name: Install dependencies
        working-directory: frontend
        run: yarn

      - name: Run tests
        working-directory: frontend
        run: yarn test:ci

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v3
        with:
          directory: frontend/coverage/

