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
66 changes: 17 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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
# Optimized CI/CD using consolidated scripts with automatic version detection
# Multi-PHP testing available locally via: ./scripts/testing/test-all-php-versions.sh

on:
push:
Expand All @@ -10,9 +10,9 @@ on:
branches: [ main ]

jobs:
test:
quality-check:
runs-on: ubuntu-latest
name: Critical CI Tests (PHP 8.1)
name: Quality Validation (PHP 8.1)

steps:
- name: Checkout code
Expand Down Expand Up @@ -43,53 +43,20 @@ jobs:
- name: Check PHP syntax
run: find src -name "*.php" -exec php -l {} \; || { echo 'PHP syntax check failed'; exit 1; }

- name: Run optimized CI validation
- name: Run consolidated quality check
run: |
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 CI test suite
run: |
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 "CI tests failed (exit code $code)"
exit $code
fi
echo "🔍 Running consolidated quality validation..."
echo "📋 Using automatic version detection from VERSION file"
echo "💡 Multi-PHP testing done locally via: ./scripts/testing/test-all-php-versions.sh"
scripts/quality/quality-check.sh || { echo 'Quality check failed'; exit 1; }

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
file: ./reports/coverage.xml
flags: unittests
name: codecov-umbrella

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

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, xml, ctype, iconv, intl, pdo, dom, filter, gd, json, session

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run Quality Gate
run: |
echo "🏆 Running Quality Gate assessment..."
./scripts/quality-gate.sh || { echo 'Quality Gate failed'; exit 1; }
continue-on-error: true

- name: CI/CD Summary
if: always()
Expand All @@ -99,11 +66,12 @@ jobs:
echo " OPTIMIZED CI/CD SUMMARY"
echo "========================================="
echo ""
echo "✅ Critical validations completed (PHP 8.1)"
echo "✅ Quality validation completed (PHP 8.1)"
echo "🔍 Used consolidated scripts with auto-version detection"
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 "📋 For comprehensive testing:"
echo " • Multi-PHP: ./scripts/testing/test-all-php-versions.sh (PHP 8.1-8.4)"
echo " • Full validation: ./scripts/validation/validate_all.sh"
echo " • Version management: ./scripts/release/version-bump.sh"
echo ""
echo "🚀 CI/CD optimized for speed - extensive testing done locally"
58 changes: 36 additions & 22 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
push:
branches: [ main ]

permissions:
contents: read
issues: write
pull-requests: write

jobs:
pre-release-validation:
runs-on: ubuntu-latest
Expand All @@ -20,6 +25,7 @@ jobs:
with:
php-version: '8.1'
extensions: mbstring, xml, ctype, iconv, intl, pdo, dom, filter, gd, json, session
coverage: xdebug

- name: Cache Composer packages
uses: actions/cache@v4
Expand All @@ -38,22 +44,16 @@ jobs:
- name: Check PHP syntax
run: find src -name "*.php" -exec php -l {} \;

- name: Run PHPStan (Level 8)
run: ./vendor/bin/phpstan analyse --no-progress

- name: Run tests with coverage
run: ./vendor/bin/phpunit --coverage-text --coverage-clover coverage.xml

- name: Check code style (PSR-12)
run: ./vendor/bin/phpcs --standard=PSR12 src/ --report=summary

- name: Run release preparation script
run: |
chmod +x scripts/prepare_release.sh
echo "n\nn\nn" | ./scripts/prepare_release.sh
echo "🚀 Running automated release preparation..."
chmod +x scripts/release/prepare_release.sh
echo "n\nn\nn" | scripts/release/prepare_release.sh

- name: Run project validation
run: php scripts/validate_project.php
run: |
echo "📋 Running comprehensive project validation..."
php scripts/validation/validate_project.php

- name: Check for security vulnerabilities
run: composer audit --no-dev
Expand All @@ -62,9 +62,10 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
file: ./reports/coverage.xml
flags: pre-release
name: pre-release-coverage
continue-on-error: true

compatibility-test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -94,12 +95,13 @@ jobs:
run: php -r "require 'vendor/autoload.php'; echo 'Autoload OK\n';"

- name: Basic functionality test
run: php -r "
run: |
php -r "
require 'vendor/autoload.php';
use PivotPHP\Core\Core\Application;
\$app = new Application();
echo 'PivotPHP Core instantiated successfully on PHP ' . PHP_VERSION . '\n';
"
"

release-readiness:
needs: [pre-release-validation, compatibility-test]
Expand All @@ -110,25 +112,37 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Get current version
id: version
run: |
if [ -f "VERSION" ]; then
VERSION=$(cat VERSION | tr -d '\n')
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
else
echo "VERSION=unknown" >> $GITHUB_OUTPUT
fi

- name: Generate Release Readiness Report
run: |
echo "# 🚀 Release Readiness Report" >> release_report.md
echo "# 🚀 Release Readiness Report - PivotPHP Core v${{ steps.version.outputs.VERSION }}" >> release_report.md
echo "" >> release_report.md
echo "## ✅ All Checks Passed!" >> release_report.md
echo "" >> release_report.md
echo "- **PHPStan**: Level 8, 0 errors" >> release_report.md
echo "- **Tests**: 186 tests passing" >> release_report.md
echo "- **Version**: ${{ steps.version.outputs.VERSION }}" >> release_report.md
echo "- **PHPStan**: Level 9, 0 errors" >> release_report.md
echo "- **Tests**: All tests passing" >> release_report.md
echo "- **Code Style**: PSR-12 compliant" >> release_report.md
echo "- **PHP Compatibility**: 7.4 - 8.3" >> release_report.md
echo "- **PHP Compatibility**: 8.1 - 8.4" >> release_report.md
echo "- **Dependencies**: All valid" >> release_report.md
echo "- **Scripts**: Consolidated and optimized" >> release_report.md
echo "" >> release_report.md
echo "## 📦 Ready for Publication" >> release_report.md
echo "" >> release_report.md
echo "The project is ready to be tagged and released!" >> release_report.md
echo "" >> release_report.md
echo "### Next Steps:" >> release_report.md
echo "1. Create a new tag: \`git tag -a v1.0.0 -m 'Release v1.0.0'\`" >> release_report.md
echo "2. Push the tag: \`git push origin v1.0.0\`" >> release_report.md
echo "1. Create a new tag: \`git tag -a v${{ steps.version.outputs.VERSION }} -m 'Release v${{ steps.version.outputs.VERSION }}'\`" >> release_report.md
echo "2. Push the tag: \`git push origin v${{ steps.version.outputs.VERSION }}\`" >> release_report.md
echo "3. The release workflow will automatically create a GitHub release" >> release_report.md
echo "4. Packagist will be automatically updated" >> release_report.md

Expand All @@ -147,4 +161,4 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
body: report
});
});
50 changes: 0 additions & 50 deletions .github/workflows/quality-gate.yml

This file was deleted.

Loading
Loading