Laravel Github action generator

Triggers
Test
Static analysis
name: my workflow

jobs:
  tests:
    name: Run tests
    runs-on: ubuntu-latest
    services:
      mysql:
        image: mysql:8.0
        ports:
          - 33306:3306
        env:
          MYSQL_ALLOW_EMPTY_PASSWORD: yes
          MYSQL_DATABASE: db_test_laravel
        options: |-
          --health-cmd="mysqladmin ping"
          --health-interval=10s
          --health-timeout=5s
          --health-retries=3

    env:
      DB_CONNECTION: mysql
      DB_DATABASE: db_test_laravel
      DB_PORT: '33306'
      DB_USER: root

    steps:
      - uses: actions/checkout@v4
        name: Set up PHP
        with:
          php-version: 8.3

      - name: Cache PHP dependencies
        uses: actions/cache@v4
        with:
          path: |-
            vendor
            ~/.composer/cache
          key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
          restore-keys: ${{ runner.os }}-php-

      - name: Install Dependencies
        run: composer install --no-interaction --prefer-dist --optimize-autoloader

      - name: Prepare Application Environment
        run: |-
          cp .env.example .env
          php artisan key:generate
          chmod -R 755 storage bootstrap/cache

      - uses: actions/setup-node@v4
        name: Set up Node.js
        with:
          node-version: 20

      - name: Install Node dependencies
        run: npm ci

      - name: Build assets
        run: npm run build

      - name: Migrate Database
        run: php artisan migrate

      - name: Run tests
        run: vendor/bin/phpunit --testdox