name: 'BrowserStack Test'
on: [push, pull_request]
jobs:
  ubuntu-job:
    name: 'BrowserStack Test on Ubuntu'
    runs-on: ubuntu-latest
    steps:
      - name: 'BrowserStack Env Setup'
        uses: browserstack/github-actions/setup-env@master
        with:
          username:  ${{ secrets.BROWSERSTACK_USERNAME }}
          access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}

      - name: 'BrowserStack Local Tunnel Setup'
        uses: browserstack/github-actions/setup-local@master
        with:
          local-testing: start
          local-identifier: random

      - name: 'Checkout the repository'
        uses: actions/checkout@v2

      - name: 'Building web application to be tested'
        run: npm install

      - name: 'Running test on BrowserStack'
        run: npm run test-remote

      - name: 'BrowserStackLocal Stop'
        uses: browserstack/github-actions/setup-local@master
        with:
          local-testing: stop

name: 'Build & Test'

on: [push, pull_request]

jobs:
  build:
    name: ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [macos-latest, ubuntu-latest, windows-latest]
    steps:
      - name: 'Checkout repository'
        uses: actions/checkout@v2

      - name: 'Lint'
        run: npx eslint .

      - name: 'Install dependencies and build'
        run: npm install

      - name: 'Setup BrowserStack environment'
        uses: browserstack/github-actions/setup-env@master
        with:
          username:  ${{ secrets.BROWSERSTACK_USERNAME }}
          access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}

      - name: 'Start BrowserStack local tunnel'
        uses: browserstack/github-actions/setup-local@master
        with:
          local-testing: start
          local-identifier: random

      - name: 'Run tests on BrowserStack'
        run: npm run test-remote

      - name: 'Stop BrowserStack local tunnel'
        uses: browserstack/github-actions/setup-local@master
        with:
          local-testing: stop

Add matrix and lint check
Add matrix and lint check
