-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (136 loc) · 5.23 KB
/
Copy pathpre-release.yml
File metadata and controls
164 lines (136 loc) · 5.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
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
});