name: Dusk tests

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  dusk:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

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

      - name: Configure Composer cache
        id: composer-cache
        run: |
          echo "::set-output name=dir::$(composer config cache-files-dir)"
      - uses: actions/cache@v1
        with:
          path: ${{ steps.composer-cache.outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
          restore-keys: ${{ runner.os }}-composer-

      - name: Install Composer dependencies
        run: composer install --no-interaction --no-suggest --no-progress --prefer-dist --optimize-autoloader

      - name: Generate application key
        run: php artisan key:generate

      - name: Upgrade Chrome driver
        run: php artisan dusk:chrome-driver

      - name: Start Chrome driver
        run: ./vendor/laravel/dusk/bin/chromedriver-linux &

      - name: Run Laravel server
        run: php artisan serve &

      - name: Run Dusk tests
        run: php artisan dusk

name: Dusk tests

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  dusk:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

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

      - name: Configure Composer cache
        id: composer-cache
        run: |
          echo "::set-output name=dir::$(composer config cache-files-dir)"
      - uses: actions/cache@v1
        with:
          path: ${{ steps.composer-cache.outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
          restore-keys: ${{ runner.os }}-composer-

      - name: Install Composer dependencies
        run: composer install --no-interaction --no-suggest --no-progress --prefer-dist --optimize-autoloader

      - name: Configure Laravel environment
        run: |
          php artisan key:generate
          touch database/database.sqlite
          php artisan migrate

      - name: Upgrade Chrome driver
        run: php artisan dusk:chrome-driver

      - name: Start Chrome driver
        run: ./vendor/laravel/dusk/bin/chromedriver-linux &

      - name: Run Laravel server
        run: php artisan serve &

      - name: Run Dusk tests
        run: php artisan dusk

Configure SQLite for Dusk tests
Configure SQLite for Dusk tests
