Refactor: melhorar identificação de rotas dinâmicas e estáticas com v… #17
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 ] | ||
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 | ||
- name: Cache Composer packages | ||
uses: actions/cache@v3 | ||
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 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 | ||
- name: Run project validation | ||
run: php scripts/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@v3 | ||
with: | ||
file: ./coverage.xml | ||
flags: pre-release | ||
name: pre-release-coverage | ||
compatibility-test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3'] | ||
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\ApiExpress; | ||
\$app = new ApiExpress(); | ||
echo 'Express PHP 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: Generate Release Readiness Report | ||
run: | | ||
echo "# 🚀 Release Readiness Report" >> 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 "- **Code Style**: PSR-12 compliant" >> release_report.md | ||
echo "- **PHP Compatibility**: 7.4 - 8.3" >> release_report.md | ||
echo "- **Dependencies**: All valid" >> 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 "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 | ||
}); |