name: playwright-example
on: workflow_dispatch
defaults:
  run:
    shell: bash
jobs:
  main:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [windows-latest, macos-latest, ubuntu-20.04]
      fail-fast: false
    steps:
      - uses: actions/checkout@v2
      - id: yarn_cache
        run: echo "::set-output name=dir::$(yarn cache dir)"
      - uses: actions/cache@v1
        with:
          path: ${{ steps.yarn_cache.outputs.dir }}
          key: ${{ matrix.os }}-${{ hashFiles('**/yarn.lock') }}
          restore-keys: ${{ matrix.os }}-
      - run: yarn
        working-directory: ./playwright
      - if: startsWith(matrix.os, 'ubuntu-')
        run: sudo apt-get install libwpewebkit-1.0-dev libgstreamer-plugins-bad1.0-0
      - run: node main
        working-directory: ./playwright
      - if: success() || failure()
        uses: actions/upload-artifact@v2
        with:
          name: ${{ matrix.os }}-screenshots
          path: ./playwright/screenshots