name: Tests

on: [push, pull_request]

jobs:
  tests:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Get Composer Cache Directory
        id: composer-cache
        run: |
          echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: Cache dependencies
        uses: actions/cache@v2
        with:
          path: ${{ steps.composer-cache.outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: |
            ${{ runner.os }}-composer-

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 7.4
          extension: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
          ini-values: pcov.directory=app
          coverage: pcov

      - name: Install dependencies
        run: composer install --prefer-dist --no-interaction --no-suggest

      - name: Install Puppeteer
        run: npm i puppeteer

      - name: Copy Environment file
        run: cp .env.example .env

      - name: Generate Application Key
        run: php artisan key:generate

      - name: Execute tests
        run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml

      - uses: codecov/codecov-action@v1.0.12
        with:
          token: ${{ secrets.CODECOV_TOKEN }}

Add GitHub Workflow to run tests
Add GitHub Workflow to run tests
