Feature/less is more #110
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pre-Release Check | |
on: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
permissions: | |
contents: read | |
issues: write | |
pull-requests: write | |
jobs: | |
pre-release-validation: | |
runs-on: ubuntu-latest | |
name: Pre-Release Validation | |
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 | |
coverage: xdebug | |
- name: Cache Composer packages | |
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 | |
- name: Validate composer.json | |
run: composer validate --strict | |
- name: Check PHP syntax | |
run: find src -name "*.php" -exec php -l {} \; | |
- name: Run release preparation script | |
run: | | |
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: | | |
echo "📋 Running comprehensive project validation..." | |
php scripts/validation/validate_project.php | |
- name: Check for security vulnerabilities | |
run: composer audit --no-dev | |
continue-on-error: true | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./reports/coverage.xml | |
flags: pre-release | |
name: pre-release-coverage | |
continue-on-error: true | |
compatibility-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-version: ['8.1', '8.2', '8.3', '8.4'] | |
name: PHP ${{ matrix.php-version }} Compatibility | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: mbstring, xml, ctype, iconv, intl, pdo, dom, filter, gd, json, session | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress --no-dev | |
- name: Check PHP syntax | |
run: find src -name "*.php" -exec php -l {} \; | |
- name: Test autoload | |
run: php -r "require 'vendor/autoload.php'; echo 'Autoload OK\n';" | |
- name: Basic functionality test | |
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] | |
runs-on: ubuntu-latest | |
name: Release Readiness Report | |
steps: | |
- 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 - 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 "- **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**: 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 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 | |
cat release_report.md | |
- name: Comment on PR (if applicable) | |
if: github.event_name == 'pull_request' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const fs = require('fs'); | |
const report = fs.readFileSync('release_report.md', 'utf8'); | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: report | |
}); |