name: Run Tests

on:
  pull_request:

jobs:
  phpunit:
    runs-on: ubuntu-20.04

    name: PHPUnit test suite

    services:
      postgres:
        image: postgres:13.2
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: jbukdev_testing
        ports:
          - 5432:5432

    steps:
      - uses: actions/checkout@v2
      - name: Cache node modules
        uses: actions/cache@v2
        with:
          path: ~/.npm
          key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
      - name: Install npm dependencies
        run: npm install
      - name: Setup PHP with pecl extension
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.0'
          tools: phpcs
      - name: Copy .env
        run: php -r "file_exists('.env') || copy('.env.github', '.env');"
      - name: Install dependencies
        run: composer install -q --no-ansi --no-interaction --no-progress
      - name: Generate key
        run: php artisan key:generate
      - name: Setup directory permissions
        run: chmod -R 777 storage bootstrap/cache
      - name: Setup test database
        run: |
          php artisan migrate
          php artisan db:seed
      - name: Execute tests (Unit and Feature tests) via PHPUnit
        run: vendor/bin/phpunit
      - name: Run phpcs
        run: phpcs

name: Run Tests

on:
  pull_request:

jobs:
  phpunit:
    runs-on: ubuntu-20.04

    name: PHPUnit test suite

    services:
      postgres:
        image: postgres:13.4
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: jbukdev_testing
        ports:
          - 5432:5432

    steps:
      - uses: actions/checkout@v2
      - name: Cache node modules
        uses: actions/cache@v2
        with:
          path: ~/.npm
          key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
      - name: Install npm dependencies
        run: npm install
      - name: Setup PHP with pecl extension
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.0'
          tools: phpcs
      - name: Copy .env
        run: php -r "file_exists('.env') || copy('.env.github', '.env');"
      - name: Install dependencies
        run: composer install --quiet --no-ansi --no-interaction --no-progress
      - name: Generate key
        run: php artisan key:generate
      - name: Setup directory permissions
        run: chmod -R 777 storage bootstrap/cache
      - name: Setup test database
        run: php artisan migrate
      - name: Execute tests (Unit and Feature tests) via PHPUnit
        run: vendor/bin/phpunit
      - name: Run phpcs
        run: phpcs

Tweak Action to run improved tests
Tweak Action to run improved tests
