Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 38 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI/CD Pipeline

# Optimized CI/CD - tests critical breaking changes only
# Full multi-PHP version testing done locally via: ./scripts/test-all-php-versions.sh

on:
push:
branches: [ main, develop ]
Expand All @@ -9,12 +12,7 @@ on:
jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
php-version: ['8.1', '8.2', '8.3', '8.4']

name: PHP ${{ matrix.php-version }} Tests
name: Critical CI Tests (PHP 8.1)

steps:
- name: Checkout code
Expand All @@ -23,7 +21,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
php-version: '8.1'
extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, json, session
coverage: xdebug

Expand All @@ -45,53 +43,35 @@ jobs:
- name: Check PHP syntax
run: find src -name "*.php" -exec php -l {} \; || { echo 'PHP syntax check failed'; exit 1; }

- name: Run PHPStan
run: |
if [ -f "vendor/bin/phpstan" ]; then
./vendor/bin/phpstan analyse --no-progress || { echo 'PHPStan analysis failed'; exit 1; }
else
echo "PHPStan not installed, skipping static analysis"
fi

- name: Run PHP CS
- name: Run optimized CI validation
run: |
if [ -f "vendor/bin/phpcs" ]; then
./vendor/bin/phpcs --standard=phpcs.xml || { echo 'PHPCS check failed'; exit 1; }
else
echo "PHPCS not installed, skipping code style check"
fi
echo "⚡ Running optimized CI/CD validation for PHP 8.1..."
echo "💡 Multi-PHP testing done locally via: ./scripts/test-all-php-versions.sh"
./scripts/ci-validation.sh || { echo 'CI validation failed'; exit 1; }

- name: Run PHPUnit tests
- name: Run CI test suite
run: |
if [ -f "vendor/bin/phpunit" ]; then
echo "Running PHPUnit tests on PHP ${{ matrix.php-version }}..."
./vendor/bin/phpunit --testdox --exclude-group performance || code=$?
if [ "${code:-$?}" -eq 0 ] || [ "${code:-$?}" -eq 1 ]; then
echo "PHPUnit OK (exit code $code: success or only skipped/incomplete tests)"
exit 0
else
echo "PHPUnit failed (exit code $code)"
exit $code
fi
echo "🧪 Running CI test suite..."
composer test:ci || code=$?
if [ "${code:-$?}" -eq 0 ] || [ "${code:-$?}" -eq 1 ]; then
echo "CI tests OK (exit code $code: success or only skipped/incomplete tests)"
exit 0
else
echo "PHPUnit not installed, running basic tests"
php test/auth_test.php
echo "CI tests failed (exit code $code)"
exit $code
fi

- name: Run custom validation
run: php scripts/validate_project.php || { echo 'Custom validation failed'; exit 1; }

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.php-version == '8.1'
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella

quality:
runs-on: ubuntu-latest
name: Code Quality
name: Quality Gate
needs: test

steps:
- name: Checkout code
Expand All @@ -106,13 +86,24 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Security Check
- name: Run Quality Gate
run: |
if [ -f "vendor/bin/security-checker" ]; then
./vendor/bin/security-checker security:check composer.lock
else
echo "Security checker not installed"
fi
echo "🏆 Running Quality Gate assessment..."
./scripts/quality-gate.sh || { echo 'Quality Gate failed'; exit 1; }

- name: Dependency Check
run: composer outdated --direct
- name: CI/CD Summary
if: always()
run: |
echo ""
echo "========================================="
echo " OPTIMIZED CI/CD SUMMARY"
echo "========================================="
echo ""
echo "✅ Critical validations completed (PHP 8.1)"
echo ""
echo "📋 Comprehensive testing:"
echo " • Multi-PHP: ./scripts/test-all-php-versions.sh (PHP 8.1-8.4)"
echo " • Full validation: ./scripts/validate_all.sh"
echo " • Performance: ./scripts/quality-metrics.sh"
echo ""
echo "🚀 CI/CD optimized for speed - extensive testing done locally"
8 changes: 4 additions & 4 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
php-version: ['8.1', '8.2', '8.3', '8.4']

name: PHP ${{ matrix.php-version }} Compatibility

Expand All @@ -96,9 +96,9 @@ jobs:
- name: Basic functionality test
run: php -r "
require 'vendor/autoload.php';
use PivotPHP\Core\ApiExpress;
\$app = new ApiExpress();
echo 'Express PHP instantiated successfully on PHP ' . PHP_VERSION . '\n';
use PivotPHP\Core\Core\Application;
\$app = new Application();
echo 'PivotPHP Core instantiated successfully on PHP ' . PHP_VERSION . '\n';
"
release-readiness:
Expand Down
Loading
Loading