Skip to content

Filament Update

Filament Update #285

Workflow file for this run

name: Laravel
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
laravel-tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: idp-test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
hydra:
image: oryd/hydra:v2.3
env:
DSN: "memory"
SECRETS_SYSTEM: "testing-secret-that-is-at-least-32-chars-long"
URLS_SELF_ISSUER: "http://localhost:4444/"
URLS_CONSENT: "http://localhost/auth/consent"
URLS_LOGIN: "http://localhost/auth/login"
URLS_LOGOUT: "http://localhost/auth/logout"
URLS_ERROR: "http://localhost/auth/error"
URLS_POST_LOGOUT_REDIRECT: "http://localhost/auth/choose"
LOG_LEAK_SENSITIVE_VALUES: "true"
DEV: "true"
ports:
- 4444:4444
- 4445:4445
options: >-
--health-cmd "wget --no-verbose --tries=1 --spider http://localhost:4445/health/alive || exit 1"
--health-interval=10s
--health-timeout=5s
--health-retries=5
--health-start-period=10s
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, bcmath, soap, intl, gd, exif, iconv, imagick, mysql, pdo_mysql
coverage: none
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- 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 Composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --optimize-autoloader
- name: Install NPM Dependencies
run: npm ci
- name: Build Assets
run: npm run build
- name: Create .env file
run: |
cp .env.example .env
echo "APP_ENV=testing" >> .env
echo "DB_CONNECTION=mysql" >> .env
echo "DB_HOST=127.0.0.1" >> .env
echo "DB_PORT=3306" >> .env
echo "DB_DATABASE=idp-test" >> .env
echo "DB_USERNAME=root" >> .env
echo "DB_PASSWORD=password" >> .env
echo "CACHE_DRIVER=array" >> .env
echo "QUEUE_CONNECTION=sync" >> .env
echo "SESSION_DRIVER=array" >> .env
echo "MAIL_MAILER=array" >> .env
echo "FILESYSTEM_DRIVER=local" >> .env
echo "AWS_ACCESS_KEY_ID=test" >> .env
echo "AWS_SECRET_ACCESS_KEY=test" >> .env
echo "AWS_DEFAULT_REGION=us-east-1" >> .env
echo "AWS_BUCKET_AVATARS=test-bucket" >> .env
echo "AWS_ENDPOINT=http://localhost:9000" >> .env
echo "HYDRA_ADMIN_URL=http://127.0.0.1:4445/" >> .env
echo "HYDRA_PUBLIC_URL=http://127.0.0.1:4444" >> .env
# Override .env.testing for CI (Docker services use 127.0.0.1)
sed -i 's/DB_HOST=mysql/DB_HOST=127.0.0.1/' .env.testing
sed -i 's/DB_USERNAME=idp/DB_USERNAME=root/' .env.testing
sed -i 's/DB_PASSWORD=idp/DB_PASSWORD=password/' .env.testing
sed -i 's|HYDRA_ADMIN_URL=.*|HYDRA_ADMIN_URL=http://127.0.0.1:4445/|' .env.testing
sed -i 's|HYDRA_PUBLIC_URL=.*|HYDRA_PUBLIC_URL=http://127.0.0.1:4444|' .env.testing
- name: Generate Application Key
run: php artisan key:generate
- name: Set Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Clear Config Cache
run: php artisan config:clear
- name: Execute Tests
run: |
vendor/bin/pest --log-junit reports/junit.xml
echo "### Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
php -r '
$xml = simplexml_load_file("reports/junit.xml");
$suite = $xml->testsuite;
$tests = (int)$suite["tests"];
$failures = (int)$suite["failures"];
$errors = (int)$suite["errors"];
$skipped = (int)$suite["skipped"];
$passed = $tests - $failures - $errors - $skipped;
$time = round((float)$suite["time"], 2);
$icon = ($failures + $errors > 0) ? "❌" : "✅";
echo "| Status | Passed | Failed | Errors | Skipped | Time |\n";
echo "|--------|--------|--------|--------|---------|------|\n";
echo "| $icon | $passed | $failures | $errors | $skipped | {$time}s |\n\n";
echo "#### Test Suites\n\n";
echo "| Suite | Tests | Passed | Failed | Time |\n";
echo "|-------|-------|--------|--------|------|\n";
foreach ($suite->testsuite as $child) {
$name = (string)$child["name"];
$t = (int)$child["tests"];
$f = (int)$child["failures"] + (int)$child["errors"];
$p = $t - $f - (int)$child["skipped"];
$dur = round((float)$child["time"], 2);
$si = $f > 0 ? "❌" : "✅";
echo "| $si $name | $t | $p | $f | {$dur}s |\n";
}
' >> $GITHUB_STEP_SUMMARY
laravel-pint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
coverage: none
- name: Install Composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: "Laravel Pint"
run: vendor/bin/pint --test