name: Test

on:
  - push
  - pull_request

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Install Node.js (latest)
        uses: actions/setup-node@v2
        with:
          node-version: 15

      - name: Before Install
        run: |
          mkdir -p shogi/boards
          touch shogi/boards/temp.sqlite3

      - run: npm ci

      - name: Typecheck files not covered by tests
        run: npx tsc --noEmit

      - name: Test
        run: npm test

      - name: Set up reviewdog
        if: ${{ github.event_name == 'pull_request' }}
        uses: reviewdog/action-setup@v1
        with:
          reviewdog_version: latest

      - name: Run reviewdog
        continue-on-error: true
        if: ${{ github.event_name == 'pull_request' }}
        env:
          REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          sed "s/\/.\+//g" CODEOWNERS | grep "^[a-z]" | xargs -n 1 -I {} sh -c "npx eslint --ext js,ts -f rdjson {} | reviewdog -f=rdjson -name=ESLint -reporter=github-pr-review"

      - name: codecov
        run: npx codecov

name: Test

on:
  - push
  - pull_request

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Install Node.js (latest)
        uses: actions/setup-node@v2
        with:
          node-version: 15

      - name: Before Install
        run: |
          mkdir -p shogi/boards
          touch shogi/boards/temp.sqlite3

      - run: npm ci

      - name: Typecheck files not covered by tests
        run: npx tsc --noEmit

      - name: Test
        uses: w9jds/firebase-action@master
        with:
          args: emulators:exec --only firestore \"npm test\"

      - name: Set up reviewdog
        if: ${{ github.event_name == 'pull_request' }}
        uses: reviewdog/action-setup@v1
        with:
          reviewdog_version: latest

      - name: Run reviewdog
        continue-on-error: true
        if: ${{ github.event_name == 'pull_request' }}
        env:
          REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          sed "s/\/.\+//g" CODEOWNERS | grep "^[a-z]" | xargs -n 1 -I {} sh -c "npx eslint --ext js,ts -f rdjson {} | reviewdog -f=rdjson -name=ESLint -reporter=github-pr-review"

      - name: codecov
        run: npx codecov

Install and use Firebase emulators on GitHub Actions
Install and use Firebase emulators on GitHub Actions
