name: Tests

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: true
      matrix:
        os: [ubuntu-latest]
        php: [7.3, 7.4, 8.0]

    name: P${{ matrix.php }} - ${{ matrix.os }}

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

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php }}
        extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
        tools: composer:v2
        coverage: none

    - name: Cache composer dependencies
      uses: actions/cache@v1
      with:
        path: vendor
        key: composer-${{matrix.php}}-${{ matrix.os }}-${{ hashFiles('composer.lock') }}

    - name: Copy .env
      run: php -r "file_exists('.env') || copy('.env.ci', '.env');"

    - name: Install Dependencies
      run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

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

    - name: Directory Permissions
      run: chmod -R 777 storage bootstrap/cache

    - name: Execute tests
      run: vendor/bin/phpunit --verbose

name: Tests

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: true
      matrix:
        os: [ubuntu-latest]
        php: [7.3, 7.4, 8.0]

    name: P${{ matrix.php }} - ${{ matrix.os }}

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

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: ${{ matrix.php }}
        extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
        tools: composer:v2
        coverage: none

    - name: Cache composer dependencies
      uses: actions/cache@v1
      with:
        path: vendor
        key: composer-${{matrix.php}}-${{ matrix.os }}-${{ hashFiles('composer.lock') }}

    - name: Copy .env
      run: php -r "file_exists('.env') || copy('.env.ci', '.env');"

    - name: Install Dependencies
      run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

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

    - name: Directory Permissions
      run: chmod -R 777 storage bootstrap/cache

    - name: Install NPM dependencies
      run: yarn install

    - name: Compile assets
      run: yarn production

    - name: Execute tests
      run: vendor/bin/phpunit --verbose

Fix tests workflow installing and building Node dependencies
Fix tests workflow installing and building Node dependencies

