name: Node.js CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js
      uses: actions/setup-node@v1
      with:
        node-version: '15'
    - run: npm install
    - run: npm test
    - shell: bash
      env:
        SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
        SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
      run: '[ -z "$SAUCE_USERNAME" ] || [ -z "$SAUCE_ACCESS_KEY" ] || npm run test-saucelabs'
