feat: Phase 4 - CI/CD, Static Analysis, Browser Tests
- Add GitHub Actions CI workflow (.github/workflows/ci.yml) - Laravel Pint code style check - PHPStan static analysis (level 5) - Test suite with parallel execution - Dusk browser tests (disabled by default) - Add phpstan.neon config (level 5, ignores User notifications methods) - Add Dusk browser tests (ProjectWorkflowTest) - Install laravel/dusk + chromedriver Tests: 101 passing (319 assertions)
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
name: Code Style & Quality
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
|
||||
jobs:
|
||||
pint:
|
||||
name: Laravel Pint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, gd, iconv, json, mbstring, pdo, session, tokenizer, xml, zip
|
||||
tools: composer:v2
|
||||
coverage: none
|
||||
|
||||
- name: Cache Composer packages
|
||||
id: composer-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-php-
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress --no-interaction
|
||||
if: steps.composer-cache.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Run Pint
|
||||
run: ./vendor/bin/pint --test
|
||||
|
||||
phpstan:
|
||||
name: PHPStan Static Analysis
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, gd, iconv, json, mbstring, pdo, session, tokenizer, xml, zip
|
||||
tools: composer:v2
|
||||
|
||||
- name: Cache Composer packages
|
||||
id: composer-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-php-
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress --no-interaction
|
||||
if: steps.composer-cache.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Run PHPStan
|
||||
run: ./vendor/bin/phpstan analyse --memory-limit=512M
|
||||
continue-on-error: true
|
||||
|
||||
tests:
|
||||
name: Test Suite
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, gd, iconv, json, mbstring, pdo, session, tokenizer, xml, zip
|
||||
tools: composer:v2
|
||||
|
||||
- name: Cache Composer packages
|
||||
id: composer-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-php-
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress --no-interaction
|
||||
if: steps.composer-cache.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Setup environment
|
||||
run: |
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
php artisan config:clear
|
||||
|
||||
- name: Run tests
|
||||
run: php artisan test --parallel
|
||||
|
||||
dusk:
|
||||
name: Browser Tests (Dusk)
|
||||
runs-on: ubuntu-latest
|
||||
if: false # Disabled by default - requires Chrome/ChromeDriver
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, gd, iconv, json, mbstring, pdo, session, tokenizer, xml, zip
|
||||
tools: composer:v2
|
||||
|
||||
- name: Cache Composer packages
|
||||
id: composer-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-php-
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress --no-interaction
|
||||
if: steps.composer-cache.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Setup environment
|
||||
run: |
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
php artisan config:clear
|
||||
|
||||
- name: Install Chrome
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y google-chrome-stable
|
||||
|
||||
- name: Start ChromeDriver
|
||||
run: ./vendor/laravel/dusk/bin/chromedriver-linux --port=9515 &
|
||||
env:
|
||||
DUSK_DRIVER_URL: http://localhost:9515
|
||||
|
||||
- name: Run Dusk tests
|
||||
run: php artisan dusk
|
||||
env:
|
||||
APP_URL: http://localhost:8000
|
||||
DUSK_DRIVER_URL: http://localhost:9515
|
||||
Reference in New Issue
Block a user