name: Test before pr merge
run-name: Test before pr merge
on:
  pull_request:
    types:
      - opened
      - edited
      - reopened
      - synchronize
      - ready_for_review

jobs:
  test-before-merge:
    runs-on: [ runner ]
    container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
    steps:
      - name: Clone Repository
        uses: https://github.com/actions/checkout@v3
        with:
          token: ${{ secrets.CI_ACCESS_TOKEN }}

      - name: Setup node
        uses: https://github.com/actions/setup-node@v3

      - name: Installing dependencies
        run: npm ci

      - name: Checking eslint
        run: npm run lint

      - name: Setup chrome
        run: |
          wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
          echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
          apt-get update
          apt-get install -y google-chrome-stable xvfb

      - name: Testing
        run: npm run test:ci
