# This is a basic workflow to help you get started with Actions

name: CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js environment
        uses: actions/setup-node@v2.4.1
        with:
          node-version: 16.5.0

      - name: Reuse npm cache folder
        uses: actions/cache@v2
        env:
          cache-name: cache-node-modules
        with:
          path: |
            ~/.npm
            ./node_modules
          # invalidate cache when any package-lock.json changes
          key: ${{ runner.os }}-npm-test-x1-${{ hashFiles('**/package.json') }}
          restore-keys: |
            ${{ runner.os }}-npm-test-x1-

      - name: install npm dependencies
        # TODO remove legace peer deps once everything is up to date
        run: npm install --legacy-peer-deps
        
      - name: build
        run: npm run build

      - name: test:node
        run: npm run test:node

      - name: test:browser
        uses: GabrielBB/xvfb-action@v1
        with:
          run: npm run test:browser

      - name: lint
        run: npm run lint

# This is a basic workflow to help you get started with Actions

name: CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js environment
        uses: actions/setup-node@v2.5.0
        with:
          node-version: 16.5.0

      - name: Reuse npm cache folder
        uses: actions/cache@v2
        env:
          cache-name: cache-node-modules
        with:
          path: |
            ~/.npm
            ./node_modules
          # invalidate cache when any package-lock.json changes
          key: ${{ runner.os }}-npm-test-x1-${{ hashFiles('**/package.json') }}
          restore-keys: |
            ${{ runner.os }}-npm-test-x1-

      - name: install npm dependencies
        # TODO remove legace peer deps once everything is up to date
        run: npm install --legacy-peer-deps
        
      - name: build
        run: npm run build

      - name: test:node
        run: npm run test:node

      - name: test:browser
        uses: GabrielBB/xvfb-action@v1
        with:
          run: npm run test:browser

      - name: lint
        run: npm run lint

Update actions/setup-node action to v2.5.0
Update actions/setup-node action to v2.5.0
