name: CI

on:
  push:
    branches: master

jobs:
  build-js:
    name: Building css & javascript
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Yarn Build
        run: |
          yarn install
          yarn prod
          cat public/mix-manifest.json # See asset versions in log
  test-php:
    name: Test PHP
    runs-on: ubuntu-latest
    needs: build-js
    steps:
      - uses: actions/checkout@v1
      - name: Setup PHP
        uses: shivammathur/setup-php@master
        with:
          php-version: 7.4
          extension-csv: mbstring, bcmath
      - name: Composer install
        run: composer install
      - name: Generating secret key
        run: |
          php -r "file_exists('.env') || copy('.env.example', '.env');"
          php artisan key:generate
#      - name: Run Feature & Unit Test
#        run: ./vendor/bin/phpunit
