Skip to content

Commit 9b85487

Browse files
authored
Merge pull request #9 from KaririCode-Framework/develop
Develop
2 parents eeb3767 + 7aac771 commit 9b85487

167 files changed

Lines changed: 5170 additions & 11666 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.docker/php/Dockerfile

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

.docker/php/kariricode-php.ini

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

.env.example

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

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@
1414
/phpstan.neon export-ignore
1515
/phpunit.xml export-ignore
1616
/psalm.xml export-ignore
17-
/Makefile export-ignore
18-
/composer.lock
17+
/Makefile export-ignore

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
# ARFA 1.3 / KaririCode Spec V4.0 — Unified CI Pipeline
4+
# Runs on every push and PR targeting main or develop.
5+
# Full pipeline: cs-fixer → phpstan (L9) → psalm → phpunit (pcov)
6+
# Zero tolerance: any tool failure blocks the merge.
7+
8+
on:
9+
push:
10+
branches: [main, develop]
11+
pull_request:
12+
branches: [main, develop]
13+
workflow_dispatch:
14+
15+
jobs:
16+
quality:
17+
name: Quality Pipeline (ARFA 1.3)
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
# PHP 8.4 + pcov (mandatory driver per ARFA 1.3 §Testing)
24+
- uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: '8.4'
27+
extensions: mbstring, xml
28+
coverage: pcov
29+
30+
# Pure dependency install — no scripts to avoid environment pollution
31+
- name: Install dependencies
32+
run: composer install --no-interaction --prefer-dist --no-progress --no-scripts
33+
34+
# Bootstrap kcode.phar from the official KaririCode release
35+
- name: Install kcode (KaririCode Devkit)
36+
run: |
37+
wget -q https://github.com/KaririCode-Framework/kariricode-devkit/releases/latest/download/kcode.phar
38+
chmod +x kcode.phar
39+
sudo mv kcode.phar /usr/local/bin/kcode
40+
41+
# Generate .kcode/ configs: phpunit.xml.dist, phpstan.neon, psalm.xml, etc.
42+
- name: Initialize devkit (.kcode/ generation)
43+
run: kcode init
44+
45+
# cs-fixer → phpstan (L9) → psalm → phpunit
46+
# Exit code ≠ 0 fails the job (zero-tolerance policy)
47+
- name: Run full quality pipeline
48+
run: kcode quality

.github/workflows/code-quality.yml

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
name: Code Quality
2+
3+
# ARFA 1.3 / KaririCode Spec V4.0 — Parallel Quality Gates
4+
# Runs 5 parallel jobs with a quality-summary gate job.
5+
# Triggers: main, develop, feature branches, PRs, and manual dispatch.
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
- develop
12+
- 'feature/**'
13+
pull_request:
14+
branches:
15+
- main
16+
- develop
17+
workflow_dispatch:
18+
19+
jobs:
20+
# ============================================================================
21+
# DEPENDENCY VALIDATION (Spec V4.0 — zero-dep contract)
22+
# Validates that composer.json is valid and platform requirements are met.
23+
# Sanitizer mandates: zero external runtime dependencies.
24+
# ============================================================================
25+
dependencies:
26+
name: Dependency Validation
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: '8.4'
35+
tools: composer:v2
36+
coverage: none
37+
38+
- name: Validate composer.json
39+
run: composer validate --strict --no-check-lock
40+
41+
- name: Install dependencies
42+
run: composer install --prefer-dist --no-progress --no-scripts
43+
44+
- name: Check platform requirements
45+
run: composer check-platform-reqs
46+
47+
# ============================================================================
48+
# SECURITY AUDIT (ARFA 1.3 — resilience pillar)
49+
# Uses native composer audit — no deprecated security-checker.
50+
# ============================================================================
51+
security:
52+
name: Security Audit
53+
runs-on: ubuntu-latest
54+
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- uses: shivammathur/setup-php@v2
59+
with:
60+
php-version: '8.4'
61+
tools: composer:v2
62+
coverage: none
63+
64+
- name: Install dependencies
65+
run: composer install --prefer-dist --no-progress --no-scripts
66+
67+
- name: Run composer audit
68+
run: composer audit --format=plain
69+
70+
# ============================================================================
71+
# STATIC ANALYSIS (Spec V4.0 S14 — Type Safety)
72+
# kcode analyse runs PHPStan Level 9 + Psalm (100% type inference).
73+
# Both tools must pass with zero errors — enforced by kcode exit code.
74+
# ============================================================================
75+
analyse:
76+
name: Static Analysis — PHPStan L9 + Psalm
77+
runs-on: ubuntu-latest
78+
79+
steps:
80+
- uses: actions/checkout@v4
81+
82+
- uses: shivammathur/setup-php@v2
83+
with:
84+
php-version: '8.4'
85+
extensions: mbstring, xml
86+
coverage: none
87+
tools: composer:v2
88+
89+
- name: Install dependencies
90+
run: composer install --prefer-dist --no-progress --no-scripts
91+
92+
- name: Install kcode
93+
run: |
94+
wget -q https://github.com/KaririCode-Framework/kariricode-devkit/releases/latest/download/kcode.phar
95+
chmod +x kcode.phar
96+
sudo mv kcode.phar /usr/local/bin/kcode
97+
98+
- name: Initialize devkit
99+
run: kcode init
100+
101+
# Runs PHPStan Level 9 then Psalm sequentially — both must pass
102+
- name: Run PHPStan + Psalm via kcode
103+
run: kcode analyse
104+
105+
# ============================================================================
106+
# CODE STYLE (ARFA 1.3 Naming / Formatting Standards)
107+
# kcode cs:fix enforces PSR-12 + PHP 8.4 migrations + KaririCode rules.
108+
# --check: dry-run only — fails if any violation exists.
109+
# ============================================================================
110+
cs-fixer:
111+
name: Code Style — PHP CS Fixer
112+
runs-on: ubuntu-latest
113+
114+
steps:
115+
- uses: actions/checkout@v4
116+
117+
- uses: shivammathur/setup-php@v2
118+
with:
119+
php-version: '8.4'
120+
extensions: mbstring, xml
121+
coverage: none
122+
tools: composer:v2
123+
124+
- name: Install dependencies
125+
run: composer install --prefer-dist --no-progress --no-scripts
126+
127+
- name: Install kcode
128+
run: |
129+
wget -q https://github.com/KaririCode-Framework/kariricode-devkit/releases/latest/download/kcode.phar
130+
chmod +x kcode.phar
131+
sudo mv kcode.phar /usr/local/bin/kcode
132+
133+
- name: Initialize devkit
134+
run: kcode init
135+
136+
- name: Check code style (dry-run)
137+
run: kcode cs:fix --check
138+
139+
# ============================================================================
140+
# UNIT & INTEGRATION TESTS (ARFA 1.3 §Testing — Zero Tolerance)
141+
# pcov is the mandatory driver (performance + accuracy over Xdebug).
142+
# Requires: 0 failures, 0 errors, 0 warnings, 0 risky tests.
143+
# ============================================================================
144+
tests:
145+
name: PHPUnit Tests (pcov)
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
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: Install kcode
162+
run: |
163+
wget -q https://github.com/KaririCode-Framework/kariricode-devkit/releases/latest/download/kcode.phar
164+
chmod +x kcode.phar
165+
sudo mv kcode.phar /usr/local/bin/kcode
166+
167+
- name: Initialize devkit
168+
run: kcode init
169+
170+
- name: Run tests with coverage (pcov)
171+
run: kcode test --coverage
172+
173+
# ============================================================================
174+
# QUALITY SUMMARY — Gate job (if: always())
175+
# Aggregates all job results and fails the workflow if any check failed.
176+
# Posts a markdown summary to the GitHub Actions run.
177+
# ============================================================================
178+
quality-summary:
179+
name: Quality Summary
180+
runs-on: ubuntu-latest
181+
needs: [dependencies, security, analyse, cs-fixer, tests]
182+
if: always()
183+
184+
steps:
185+
- name: Post quality summary
186+
run: |
187+
echo "## KaririCode Sanitizer — Quality Report (ARFA 1.3)" >> "$GITHUB_STEP_SUMMARY"
188+
echo "" >> "$GITHUB_STEP_SUMMARY"
189+
echo "| Check | Result |" >> "$GITHUB_STEP_SUMMARY"
190+
echo "|-------|--------|" >> "$GITHUB_STEP_SUMMARY"
191+
echo "| Dependency Validation | ${{ needs.dependencies.result }} |" >> "$GITHUB_STEP_SUMMARY"
192+
echo "| Security Audit | ${{ needs.security.result }} |" >> "$GITHUB_STEP_SUMMARY"
193+
echo "| Static Analysis (PHPStan L9 + Psalm) | ${{ needs.analyse.result }} |" >> "$GITHUB_STEP_SUMMARY"
194+
echo "| Code Style (CS Fixer) | ${{ needs.cs-fixer.result }} |" >> "$GITHUB_STEP_SUMMARY"
195+
echo "| PHPUnit Tests (pcov) | ${{ needs.tests.result }} |" >> "$GITHUB_STEP_SUMMARY"
196+
197+
if [ "${{ needs.security.result }}" != "success" ] || [ "${{ needs.analyse.result }}" != "success" ] || [ "${{ needs.cs-fixer.result }}" != "success" ] || [ "${{ needs.tests.result }}" != "success" ]; then
198+
echo "" >> "$GITHUB_STEP_SUMMARY"
199+
echo "❌ One or more quality gates failed. Merge blocked." >> "$GITHUB_STEP_SUMMARY"
200+
exit 1
201+
fi
202+
203+
echo "" >> "$GITHUB_STEP_SUMMARY"
204+
echo "✅ All quality gates passed — ARFA 1.3 compliant." >> "$GITHUB_STEP_SUMMARY"

.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+
# ARFA 1.3 / KaririCode Spec V4.0 — Release Pipeline
4+
# Triggers on semantic version tags (v*).
5+
# Full quality gate (kcode quality) must pass before release is published.
6+
7+
on:
8+
push:
9+
tags:
10+
- 'v*'
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
release:
17+
name: Quality Gate + GitHub Release
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
# PHP 8.4 + pcov: releases MUST pass with coverage (ARFA 1.3 §Testing)
24+
- uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: '8.4'
27+
extensions: mbstring, xml
28+
coverage: pcov
29+
tools: composer:v2
30+
31+
# --no-scripts prevents accidental environment pollution during release
32+
- name: Install dependencies
33+
run: composer install --no-interaction --prefer-dist --no-progress --no-scripts
34+
35+
- name: Install kcode (KaririCode Devkit)
36+
run: |
37+
wget -q https://github.com/KaririCode-Framework/kariricode-devkit/releases/latest/download/kcode.phar
38+
chmod +x kcode.phar
39+
sudo mv kcode.phar /usr/local/bin/kcode
40+
41+
- name: Initialize devkit
42+
run: kcode init
43+
44+
# Full pipeline: cs-fixer → phpstan (L9) → psalm → phpunit (pcov)
45+
# Exit code ≠ 0 aborts the release — zero tolerance (ARFA 1.3)
46+
- name: Run full quality pipeline (release gate)
47+
run: kcode quality
48+
49+
- name: Extract version from tag
50+
id: version
51+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
52+
53+
- name: Create GitHub Release
54+
uses: softprops/action-gh-release@v2
55+
with:
56+
tag_name: ${{ steps.version.outputs.tag }}
57+
name: KaririCode Sanitizer ${{ steps.version.outputs.tag }}
58+
draft: false
59+
prerelease: false
60+
body: |
61+
## KaririCode\Sanitizer ${{ steps.version.outputs.tag }}
62+
63+
PHP 8.4+ sanitizer engine — **zero external dependencies**, ARFA 1.3 compliant.
64+
65+
## Installation
66+
67+
```bash
68+
composer require kariricode/sanitizer
69+
```
70+
71+
## Quality Metrics
72+
73+
| Metric | Value |
74+
|--------|-------|
75+
| PHPStan Level | 9 (0 errors) |
76+
| Psalm | 100% (0 errors) |
77+
| Coverage | 100% |
78+
| Dependencies | 0 (runtime) |
79+
80+
See [CHANGELOG.md](CHANGELOG.md) for details.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,6 @@ tests/lista_de_arquivos_test.php
6464
lista_de_arquivos.txt
6565
lista_de_arquivos_tests.txt
6666
add_static_to_providers.php
67+
68+
# KaririCode Devkit — generated configs and build artifacts
69+
.kcode/

0 commit comments

Comments
 (0)