name: Tests
on:
  push:
  pull_request:
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  cancel-in-progress: true
jobs:
  tests:
    name: Tests
    runs-on: ubuntu-latest
    env:
      TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
      TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
      NEXT_PUBLIC_LOCAL_DEV: true
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Install node.js v16
        uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: 'yarn'

      - name: Install dependencies
        run: yarn install --immutable

      - name: Build dependencies
        run: yarn build

      - name: ESLint
        run: yarn lint

      - name: Tests
        run: yarn test

      - name: Upload Coverage
        if: github.repository_owner == 'discordjs'
        uses: ./packages/actions/src/uploadCoverage
