name: Test

on:
  push:
    branches:
      - master

permissions:
  contents: read

jobs:
  test:
    name: OverlayScrollbars Tests
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v3
      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: '16'
      - name: Install dependencies
        run: npm ci
      - name: Build
        run: npm run build
      - name: Run Unit Tests
        run: npm run ci:test
      - name: Run e2e Tests
        run: xvfb-run npm run ci:e2e
      - name: Upload Unit Tests Coverage
        uses: codecov/codecov-action@v3
        with:
          flags: unit
          files: "packages/**/.coverage/unit/coverage*.json"
      - name: Upload e2e Tests Coverage
        uses: codecov/codecov-action@v3
        with:
          flags: e2e
          files: "packages/**/.coverage/e2e/coverage*.json"

