Skip to content

Commit 5232502

Browse files
committed
ci: replace legacy workflow with 3 modern workflows (devkit pattern)
Removed: kariri-ci-cd.yml — outdated (PHP 8.3, security-checker deprecated, no Psalm, no kcode integration) Added: ci.yml — unified fast-feedback pipeline using kcode quality (PHP 8.4, pcov, actions@v4, openssl ext) code-quality.yml — 6 parallel jobs with quality-summary gate: • Dependency Validation (composer validate + check-platform-reqs) • Security Audit (composer audit) • PHPStan via kcode analyse --tool=phpstan • Psalm via kcode analyse --tool=psalm • CS Fixer via kcode cs:fix --check • PHPUnit via kcode test --coverage (pcov) Triggers: main, develop, feature/**, PRs, manual dispatch release.yml — runs full kcode quality pipeline before creating GitHub Release on tag push (v*); includes dotenv quick-start usage in release notes All workflows: - PHP 8.4 (was 8.3) - actions/checkout@v4 + shivammathur/setup-php@v2 (was @V3) - openssl extension (required for AES-256-GCM encryption tests) - kcode via vendor/bin/kcode (kariricode-devkit)
1 parent 577eabc commit 5232502

4 files changed

Lines changed: 317 additions & 72 deletions

File tree

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
quality:
11+
name: Quality Pipeline
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: '8.4'
20+
extensions: mbstring, xml, openssl
21+
coverage: pcov
22+
23+
- name: Install dependencies
24+
run: composer install --no-interaction --prefer-dist --optimize-autoloader
25+
26+
- name: Initialize kcode devkit
27+
run: vendor/bin/kcode init
28+
29+
- name: Code style check
30+
run: vendor/bin/kcode cs:fix --check
31+
32+
- name: Static analysis (PHPStan + Psalm)
33+
run: vendor/bin/kcode analyse
34+
35+
- name: Tests with coverage
36+
run: vendor/bin/kcode test --coverage

.github/workflows/code-quality.yml

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
name: Code Quality
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
- 'feature/**'
9+
pull_request:
10+
branches:
11+
- main
12+
- develop
13+
workflow_dispatch:
14+
15+
jobs:
16+
# ============================================================================
17+
# DEPENDENCY VALIDATION
18+
# ============================================================================
19+
dependencies:
20+
name: Dependency Validation
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: '8.4'
29+
tools: composer:v2
30+
coverage: none
31+
32+
- name: Validate composer.json
33+
run: composer validate --strict --no-check-lock
34+
35+
- name: Install dependencies
36+
run: composer install --prefer-dist --no-progress --no-scripts
37+
38+
- name: Check platform requirements
39+
run: composer check-platform-reqs
40+
41+
# ============================================================================
42+
# SECURITY AUDIT
43+
# ============================================================================
44+
security:
45+
name: Security Audit
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: '8.4'
54+
tools: composer:v2
55+
coverage: none
56+
57+
- name: Install dependencies
58+
run: composer install --prefer-dist --no-progress --no-scripts
59+
60+
- name: Run composer audit
61+
run: composer audit --format=plain
62+
63+
# ============================================================================
64+
# STATIC ANALYSIS — PHPStan (via kcode)
65+
# ============================================================================
66+
phpstan:
67+
name: PHPStan Static Analysis
68+
runs-on: ubuntu-latest
69+
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- uses: shivammathur/setup-php@v2
74+
with:
75+
php-version: '8.4'
76+
extensions: mbstring, xml, openssl
77+
coverage: none
78+
tools: composer:v2
79+
80+
- name: Install dependencies
81+
run: composer install --prefer-dist --no-progress --no-scripts
82+
83+
- name: Initialize kcode devkit
84+
run: vendor/bin/kcode init
85+
86+
- name: Run PHPStan via kcode
87+
run: vendor/bin/kcode analyse --tool=phpstan
88+
89+
# ============================================================================
90+
# STATIC ANALYSIS — Psalm (via kcode)
91+
# ============================================================================
92+
psalm:
93+
name: Psalm Static Analysis
94+
runs-on: ubuntu-latest
95+
96+
steps:
97+
- uses: actions/checkout@v4
98+
99+
- uses: shivammathur/setup-php@v2
100+
with:
101+
php-version: '8.4'
102+
extensions: mbstring, xml, openssl
103+
coverage: none
104+
tools: composer:v2
105+
106+
- name: Install dependencies
107+
run: composer install --prefer-dist --no-progress --no-scripts
108+
109+
- name: Initialize kcode devkit
110+
run: vendor/bin/kcode init
111+
112+
- name: Run Psalm via kcode
113+
run: vendor/bin/kcode analyse --tool=psalm
114+
115+
# ============================================================================
116+
# CODE STYLE (PHP CS Fixer via kcode)
117+
# ============================================================================
118+
cs-fixer:
119+
name: Code Style Check
120+
runs-on: ubuntu-latest
121+
122+
steps:
123+
- uses: actions/checkout@v4
124+
125+
- uses: shivammathur/setup-php@v2
126+
with:
127+
php-version: '8.4'
128+
extensions: mbstring, xml
129+
coverage: none
130+
tools: composer:v2
131+
132+
- name: Install dependencies
133+
run: composer install --prefer-dist --no-progress --no-scripts
134+
135+
- name: Initialize kcode devkit
136+
run: vendor/bin/kcode init
137+
138+
- name: Check code style via kcode
139+
run: vendor/bin/kcode cs:fix --check
140+
141+
# ============================================================================
142+
# TESTS WITH COVERAGE
143+
# ============================================================================
144+
tests:
145+
name: PHPUnit Tests
146+
runs-on: ubuntu-latest
147+
148+
steps:
149+
- uses: actions/checkout@v4
150+
151+
- uses: shivammathur/setup-php@v2
152+
with:
153+
php-version: '8.4'
154+
extensions: mbstring, xml, openssl
155+
coverage: pcov
156+
tools: composer:v2
157+
158+
- name: Install dependencies
159+
run: composer install --prefer-dist --no-progress --no-scripts
160+
161+
- name: Initialize kcode devkit
162+
run: vendor/bin/kcode init
163+
164+
- name: Run tests with coverage
165+
run: vendor/bin/kcode test --coverage
166+
167+
# ============================================================================
168+
# QUALITY SUMMARY
169+
# ============================================================================
170+
quality-summary:
171+
name: Quality Summary
172+
runs-on: ubuntu-latest
173+
needs: [dependencies, security, phpstan, psalm, cs-fixer, tests]
174+
if: always()
175+
176+
steps:
177+
- name: Check overall quality status
178+
run: |
179+
echo "## Quality Checks Summary" >> "$GITHUB_STEP_SUMMARY"
180+
echo "" >> "$GITHUB_STEP_SUMMARY"
181+
echo "| Check | Status |" >> "$GITHUB_STEP_SUMMARY"
182+
echo "|-------|--------|" >> "$GITHUB_STEP_SUMMARY"
183+
echo "| Dependencies | ${{ needs.dependencies.result }} |" >> "$GITHUB_STEP_SUMMARY"
184+
echo "| Security | ${{ needs.security.result }} |" >> "$GITHUB_STEP_SUMMARY"
185+
echo "| PHPStan | ${{ needs.phpstan.result }} |" >> "$GITHUB_STEP_SUMMARY"
186+
echo "| Psalm | ${{ needs.psalm.result }} |" >> "$GITHUB_STEP_SUMMARY"
187+
echo "| CS Fixer | ${{ needs.cs-fixer.result }} |" >> "$GITHUB_STEP_SUMMARY"
188+
echo "| Tests | ${{ needs.tests.result }} |" >> "$GITHUB_STEP_SUMMARY"
189+
190+
if [ "${{ needs.security.result }}" != "success" ] || \
191+
[ "${{ needs.phpstan.result }}" != "success" ] || \
192+
[ "${{ needs.psalm.result }}" != "success" ] || \
193+
[ "${{ needs.cs-fixer.result }}" != "success" ] || \
194+
[ "${{ needs.tests.result }}" != "success" ]; then
195+
echo "" >> "$GITHUB_STEP_SUMMARY"
196+
echo "❌ Quality checks failed." >> "$GITHUB_STEP_SUMMARY"
197+
exit 1
198+
fi
199+
200+
echo "" >> "$GITHUB_STEP_SUMMARY"
201+
echo "✅ All quality checks passed!" >> "$GITHUB_STEP_SUMMARY"

.github/workflows/kariri-ci-cd.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
name: Create GitHub Release
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: '8.4'
22+
extensions: mbstring, xml, openssl
23+
coverage: pcov
24+
tools: composer:v2
25+
26+
- name: Install dependencies
27+
run: composer install --no-interaction --prefer-dist --optimize-autoloader
28+
29+
- name: Initialize kcode devkit
30+
run: vendor/bin/kcode init
31+
32+
- name: Run full quality pipeline
33+
run: vendor/bin/kcode quality
34+
35+
- name: Extract version from tag
36+
id: version
37+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
38+
39+
- name: Create GitHub Release
40+
uses: softprops/action-gh-release@v2
41+
with:
42+
tag_name: ${{ steps.version.outputs.tag }}
43+
name: KaririCode Dotenv ${{ steps.version.outputs.tag }}
44+
draft: false
45+
prerelease: false
46+
body: |
47+
## KaririCode\\Dotenv ${{ steps.version.outputs.tag }}
48+
49+
The only PHP dotenv with auto type casting, AES-256-GCM encryption,
50+
OPcache caching, fluent validation DSL, environment-aware loading,
51+
and CLI tooling — zero dependencies, PHP 8.4+, ARFA 1.3.
52+
53+
## Installation
54+
55+
```bash
56+
composer require kariricode/dotenv
57+
```
58+
59+
## Quick Start
60+
61+
```php
62+
use KaririCode\Dotenv\Dotenv;
63+
use function KaririCode\Dotenv\env;
64+
65+
$dotenv = new Dotenv(__DIR__);
66+
$dotenv->load();
67+
68+
// Auto type-cast: string, int, float, bool, null, array
69+
$debug = env('APP_DEBUG'); // bool
70+
$port = env('DB_PORT'); // int
71+
72+
// Fluent validation DSL
73+
$dotenv->validate()
74+
->required('APP_KEY', 'DB_HOST')
75+
->isInteger('DB_PORT')->between(1, 65535)
76+
->allowedValues('APP_ENV', ['local', 'staging', 'production'])
77+
->assert();
78+
```
79+
80+
See [CHANGELOG.md](CHANGELOG.md) for details.

0 commit comments

Comments
 (0)