name: playwright-example
on: workflow_dispatch
defaults:
  run:
    shell: bash
jobs:
  main:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [windows-latest, macos-latest, ubuntu-latest]
    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: yarn-
      - run: yarn
        working-directory: ./playwright
      - run: node main
        working-directory: ./playwright
        env:
          PLAYWRIGHT_RUNNER: ${{ matrix.os }}
      - if: success() || failure()
        uses: actions/upload-artifact@v2
        with:
          name: screenshots
          path: ./playwright/screenshots