diff --git a/.env.ci b/.env.ci index 267e7e9..6dbec6e 100644 --- a/.env.ci +++ b/.env.ci @@ -6,17 +6,17 @@ APP_URL=http://forge.test LOG_CHANNEL=stack LOG_DEPRECATIONS_CHANNEL=null -LOG_LEVEL=debug +LOG_LEVEL=emergency DB_CONNECTION=mysql -DB_HOST=127.0.0.1 -DB_PORT=33306 +DB_HOST=mysql +DB_PORT=3306 DB_DATABASE=testing DB_USERNAME=root -DB_PASSWORD= +DB_PASSWORD=password FILESYSTEM_DISK=local QUEUE_CONNECTION=sync -CACHE_DRIVER=array +CACHE_STORE=array EMAIL_DRIVER=array SESSION_DRIVER=array diff --git a/.env.example b/.env.example index aa5a23f..b5d25e4 100644 --- a/.env.example +++ b/.env.example @@ -45,6 +45,7 @@ SESSION_PATH=/ SESSION_DOMAIN=null FILESYSTEM_DISK=local +ASSET_URL=http://localhost/storage CACHE_STORE=redis QUEUE_CONNECTION=redis @@ -52,9 +53,8 @@ QUEUE_CONNECTION=redis REDIS_HOST=redis REDIS_PASSWORD=null REDIS_PORT=6379 +REDIS_QUEUE=default REDIS_CACHE_CONNECTION=cache -REDIS_QUEUE_CONNECTION=queue -REDIS_QUEUE=short SCOUT_QUEUE=true SCOUT_DRIVER=meilisearch diff --git a/.github/workflows/general.yaml b/.github/workflows/general.yaml new file mode 100644 index 0000000..cfc95d6 --- /dev/null +++ b/.github/workflows/general.yaml @@ -0,0 +1,178 @@ +name: Combined GitHub Workflow + +on: + push: + branches: + - main + - develop + branches-ignore: + - dependabot/** + pull_request: + branches: + - main + - develop + +jobs: + security-checker: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: The PHP Security Checker + uses: symfonycorp/security-checker-action@v5 + + larastan: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: mbstring, dom, fileinfo + coverage: none + - name: Configure Laravel Nova Authentication + shell: bash + env: + NOVA_USERNAME: ${{ secrets.NOVA_USERNAME }} + NOVA_LICENSE_KEY: ${{ secrets.NOVA_LICENSE_KEY }} + run: composer config http-basic.nova.laravel.com "$NOVA_USERNAME" "$NOVA_LICENSE_KEY" + - name: Get Composer Cache Directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Cache composer dependencies + uses: actions/cache@v4 + 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-progress --prefer-dist --optimize-autoloader + - name: Prepare Laravel Environment + run: | + php -r "file_exists('.env') || copy('.env.ci', '.env');" + php artisan key:generate + php artisan config:cache + php artisan route:cache + - name: Clear Laravel Config + run: php artisan config:clear + - name: Execute Code Static Analysis with Larastan + run: ./vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress --error-format=github + + pint-fixer: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: mbstring, dom, fileinfo + tools: pint + coverage: none + - name: Configure Laravel Nova Authentication + shell: bash + env: + NOVA_USERNAME: ${{ secrets.NOVA_USERNAME }} + NOVA_LICENSE_KEY: ${{ secrets.NOVA_LICENSE_KEY }} + run: composer config http-basic.nova.laravel.com "$NOVA_USERNAME" "$NOVA_LICENSE_KEY" + - name: Get Composer Cache Directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Cache composer dependencies + uses: actions/cache@v4 + 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-progress --prefer-dist --optimize-autoloader + - name: Prepare Laravel Environment + run: | + php -r "file_exists('.env') || copy('.env.ci', '.env');" + php artisan key:generate + php artisan config:cache + php artisan route:cache + - name: Clear Laravel Config + run: php artisan config:clear + - name: Run Pint Code Style Fixer + run: pint + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Pint PHP Style Fixes + commit_user_name: Pint Bot + skip_fetch: true + file_pattern: '*.php' + + laravel-tests: + runs-on: ubuntu-24.04 + env: + DB_DATABASE: testing + DB_USERNAME: root + DB_PASSWORD: password + services: + mysql: + image: mysql:8.3 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: false + MYSQL_ROOT_PASSWORD: password + MYSQL_DATABASE: testing + ports: + - 3306/tcp + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: mbstring, dom, fileinfo + tools: pint + coverage: none + - name: Configure Laravel Nova Authentication + shell: bash + env: + NOVA_USERNAME: ${{ secrets.NOVA_USERNAME }} + NOVA_LICENSE_KEY: ${{ secrets.NOVA_LICENSE_KEY }} + run: composer config http-basic.nova.laravel.com "$NOVA_USERNAME" "$NOVA_LICENSE_KEY" + - name: Get Composer Cache Directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Cache composer dependencies + uses: actions/cache@v4 + 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-progress --prefer-dist --optimize-autoloader + - name: Get NPM Cache Directory + id: npm-cache + run: echo "::set-output name=dir::$(npm config get cache)" + - name: Cache NPM Dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node- + - name: Install npm dependencies + run: npm ci + - name: Prepare Laravel Environment + run: | + php -r "file_exists('.env') || copy('.env.ci', '.env');" + php artisan key:generate + php artisan config:cache + php artisan route:cache + - name: Run Migrations + run: php artisan migrate -v + env: + DB_PORT: ${{ job.services.mysql.ports['3306'] }} + - name: Link Storage + run: php artisan storage:link + - name: Serve Application + run: php artisan serve & sleep 5 + - name: Run Tests + run: php artisan test diff --git a/.github/workflows/larastan.yml b/.github/workflows/larastan.yml deleted file mode 100644 index 4ed37f6..0000000 --- a/.github/workflows/larastan.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Larastan Static Analysis - -on: - pull_request: - push: - branches-ignore: - - 'dependabot/**' - -jobs: - larastan: - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv - coverage: none - - - name: Configure Laravel Nova Authentication - shell: bash - env: - NOVA_USERNAME: ${{ secrets.NOVA_USERNAME }} - NOVA_LICENSE_KEY: ${{ secrets.NOVA_LICENSE_KEY }} - run: | - composer config http-basic.nova.laravel.com "$NOVA_USERNAME" "$NOVA_LICENSE_KEY" - - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v4 - id: actions-cache - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - - name: Cache PHP dependencies - uses: actions/cache@v4 - id: vendor-cache - with: - path: vendor - key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }} - - - name: Copy .env - run: php -r "file_exists('.env') || copy('.env.ci', '.env');" - - - name: Install Dependencies - if: steps.vendor-cache.outputs.cache-hit != 'true' - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - - name: Update Dependencies with latest stable - run: composer update --prefer-stable - - - name: Execute Code Static Analysis with Larastan - run: | - composer require --dev larastan/larastan - ./vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress diff --git a/.github/workflows/pint.yml b/.github/workflows/pint.yml deleted file mode 100644 index e6bb2f8..0000000 --- a/.github/workflows/pint.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Pint Code Style Fixer - -on: - pull_request: - push: - branches-ignore: - - 'dependabot/**' - -jobs: - pint-fixer: - runs-on: ubuntu-latest - - permissions: - contents: write - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv - coverage: none - - - name: Configure Laravel Nova Authentication - shell: bash - env: - NOVA_USERNAME: ${{ secrets.NOVA_USERNAME }} - NOVA_LICENSE_KEY: ${{ secrets.NOVA_LICENSE_KEY }} - run: | - composer config http-basic.nova.laravel.com "$NOVA_USERNAME" "$NOVA_LICENSE_KEY" - - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v4 - id: actions-cache - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - - name: Cache PHP dependencies - uses: actions/cache@v4 - id: vendor-cache - with: - path: vendor - key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }} - - - name: Install Dependencies - if: steps.vendor-cache.outputs.cache-hit != 'true' - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - - name: Update Dependencies with latest stable - run: composer update --prefer-stable - - - name: Run Pint Code Style Fixer - run: | - composer require laravel/pint --dev - ./vendor/bin/pint - - - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: Pint PHP Style Fixes - commit_user_name: Pint Bot - skip_fetch: true - file_pattern: '*.php' diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml deleted file mode 100644 index fa1dda4..0000000 --- a/.github/workflows/security.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Security Check - -on: - pull_request: - push: - -jobs: - security-check: - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - - - name: Security Checker - uses: symfonycorp/security-checker-action@v5 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index e111964..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: Laravel Pest Tests - -on: - pull_request: - push: - branches: - - main - - develop - -jobs: - laravel-tests: - runs-on: ubuntu-latest - - services: - mysql: - image: mysql:8.3 - env: - MYSQL_ALLOW_EMPTY_PASSWORD: yes - MYSQL_DATABASE: testing - ports: - - 33306:3306 - options: >- - --health-cmd="mysqladmin ping" - --health-interval=10s - --health-timeout=5s - --health-retries=3 - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Cache node_modules Directory - uses: actions/cache@v4 - id: node_modules-cache - with: - path: node_modules - key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }} - - - name: Install NPM Packages - if: steps.node_modules-cache.outputs.cache-hit != 'true' - run: npm ci - - - name: Build Frontend - run: npm run build - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv - coverage: none - - - name: Configure Laravel Nova Authentication - shell: bash - env: - NOVA_USERNAME: ${{ secrets.NOVA_USERNAME }} - NOVA_LICENSE_KEY: ${{ secrets.NOVA_LICENSE_KEY }} - run: | - composer config http-basic.nova.laravel.com "$NOVA_USERNAME" "$NOVA_LICENSE_KEY" - - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v4 - id: actions-cache - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - - name: Cache PHP dependencies - uses: actions/cache@v4 - id: vendor-cache - with: - path: vendor - key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }} - - - name: Copy .env - run: php -r "file_exists('.env') || copy('.env.ci', '.env');" - - - name: Install Dependencies - if: steps.vendor-cache.outputs.cache-hit != 'true' - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - - - name: Update Dependencies with latest stable - run: composer update --prefer-stable - - - name: Generate key - run: php artisan key:generate - - - name: Directory Permissions - run: chmod -R 777 storage bootstrap/cache - - - name: Run Migrations - env: - DB_CONNECTION: mysql - DB_DATABASE: testing - DB_PORT: 33306 - DB_USER: root - run: php artisan migrate - - - name: Execute Unit & Feature Tests - env: - DB_CONNECTION: mysql - DB_DATABASE: testing - DB_PORT: 33306 - DB_USER: root - run: | - composer require pestphp/pest --dev --with-all-dependencies - ./vendor/bin/pest