11name : CI/CD Pipeline
22
3+ # Optimized CI/CD - tests critical breaking changes only
4+ # Full multi-PHP version testing done locally via: ./scripts/test-all-php-versions.sh
5+
36on :
47 push :
58 branches : [ main, develop ]
912jobs :
1013 test :
1114 runs-on : ubuntu-latest
12-
13- strategy :
14- matrix :
15- php-version : ['8.1', '8.2', '8.3', '8.4']
16-
17- name : PHP ${{ matrix.php-version }} Tests
15+ name : Critical CI Tests (PHP 8.1)
1816
1917 steps :
2018 - name : Checkout code
2321 - name : Setup PHP
2422 uses : shivammathur/setup-php@v2
2523 with :
26- php-version : ${{ matrix.php-version }}
24+ php-version : ' 8.1 '
2725 extensions : mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, filter, gd, json, session
2826 coverage : xdebug
2927
@@ -45,53 +43,35 @@ jobs:
4543 - name : Check PHP syntax
4644 run : find src -name "*.php" -exec php -l {} \; || { echo 'PHP syntax check failed'; exit 1; }
4745
48- - name : Run PHPStan
49- run : |
50- if [ -f "vendor/bin/phpstan" ]; then
51- ./vendor/bin/phpstan analyse --no-progress || { echo 'PHPStan analysis failed'; exit 1; }
52- else
53- echo "PHPStan not installed, skipping static analysis"
54- fi
55-
56- - name : Run PHP CS
46+ - name : Run optimized CI validation
5747 run : |
58- if [ -f "vendor/bin/phpcs" ]; then
59- ./vendor/bin/phpcs --standard=phpcs.xml || { echo 'PHPCS check failed'; exit 1; }
60- else
61- echo "PHPCS not installed, skipping code style check"
62- fi
48+ echo "⚡ Running optimized CI/CD validation for PHP 8.1..."
49+ echo "💡 Multi-PHP testing done locally via: ./scripts/test-all-php-versions.sh"
50+ ./scripts/ci-validation.sh || { echo 'CI validation failed'; exit 1; }
6351
64- - name : Run PHPUnit tests
52+ - name : Run CI test suite
6553 run : |
66- if [ -f "vendor/bin/phpunit" ]; then
67- echo "Running PHPUnit tests on PHP ${{ matrix.php-version }}..."
68- ./vendor/bin/phpunit --testdox --exclude-group performance || code=$?
69- if [ "${code:-$?}" -eq 0 ] || [ "${code:-$?}" -eq 1 ]; then
70- echo "PHPUnit OK (exit code $code: success or only skipped/incomplete tests)"
71- exit 0
72- else
73- echo "PHPUnit failed (exit code $code)"
74- exit $code
75- fi
54+ echo "🧪 Running CI test suite..."
55+ composer test:ci || code=$?
56+ if [ "${code:-$?}" -eq 0 ] || [ "${code:-$?}" -eq 1 ]; then
57+ echo "CI tests OK (exit code $code: success or only skipped/incomplete tests)"
58+ exit 0
7659 else
77- echo "PHPUnit not installed, running basic tests "
78- php test/auth_test.php
60+ echo "CI tests failed (exit code $code) "
61+ exit $code
7962 fi
8063
81- - name : Run custom validation
82- run : php scripts/validate_project.php || { echo 'Custom validation failed'; exit 1; }
83-
8464 - name : Upload coverage to Codecov
8565 uses : codecov/codecov-action@v4
86- if : matrix.php-version == '8.1'
8766 with :
8867 file : ./coverage.xml
8968 flags : unittests
9069 name : codecov-umbrella
9170
9271 quality :
9372 runs-on : ubuntu-latest
94- name : Code Quality
73+ name : Quality Gate
74+ needs : test
9575
9676 steps :
9777 - name : Checkout code
@@ -106,13 +86,24 @@ jobs:
10686 - name : Install dependencies
10787 run : composer install --prefer-dist --no-progress
10888
109- - name : Security Check
89+ - name : Run Quality Gate
11090 run : |
111- if [ -f "vendor/bin/security-checker" ]; then
112- ./vendor/bin/security-checker security:check composer.lock
113- else
114- echo "Security checker not installed"
115- fi
91+ echo "🏆 Running Quality Gate assessment..."
92+ ./scripts/quality-gate.sh || { echo 'Quality Gate failed'; exit 1; }
11693
117- - name : Dependency Check
118- run : composer outdated --direct
94+ - name : CI/CD Summary
95+ if : always()
96+ run : |
97+ echo ""
98+ echo "========================================="
99+ echo " OPTIMIZED CI/CD SUMMARY"
100+ echo "========================================="
101+ echo ""
102+ echo "✅ Critical validations completed (PHP 8.1)"
103+ echo ""
104+ echo "📋 Comprehensive testing:"
105+ echo " • Multi-PHP: ./scripts/test-all-php-versions.sh (PHP 8.1-8.4)"
106+ echo " • Full validation: ./scripts/validate_all.sh"
107+ echo " • Performance: ./scripts/quality-metrics.sh"
108+ echo ""
109+ echo "🚀 CI/CD optimized for speed - extensive testing done locally"
0 commit comments