test: add coverage config, CI workflow and changelog
Tests / PHP 8.3 (push) Failing after 8m19s
Tests / PHP 8.4 (push) Failing after 7m43s

- Move coverage reports to phpunit.coverage.xml.dist: a coverage driver is optional and
  failOnWarning would turn its absence into a failed gate.
- Add a composer coverage script and document the requirement.
- Exclude development-only files from the distribution archive via export-ignore.
- Add a Gitea Actions workflow running composer check on PHP 8.3 and 8.4.
- Add CHANGELOG.md following Keep a Changelog.
- Add Packagist and CI badges to the README.
This commit is contained in:
dgarcia committed 2026-11-15 10:21:12 -03:00
1 parent d879c9781e
commit 9bfd039d50
6 files changed
+99

No files matched your search

+10
View File
@@ -1 +1,11 @@
* text=auto eol=lf
# Files excluded from the distribution archive installed by Composer.
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.github export-ignore
/AGENTS.md export-ignore
/mago.toml export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
+34
View File
@@ -0,0 +1,34 @@
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
check:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.3', '8.4']
name: PHP ${{ matrix.php }}
steps:
- uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json
coverage: none
tools: composer:v2
- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-progress
- name: Run gate
run: composer check
+18
View File
@@ -0,0 +1,18 @@
# Changelog
All notable changes to this project are documented here. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- `Controller`, `CrudController`, `Router`, `Request`, `JsonRequest`, `Response`, `Route`,
`ResourceGateway`, `Middleware` and `Pipeline`.
- Routing with path parameters, 404 and 405 responses carrying an `Allow` header.
- Generic CRUD over a `ResourceGateway` port implemented by the application.
- Security middlewares: `BearerAuth`, `RequireRole`, `RateLimit`, `Cors`.
- Transport middlewares: `Logging`, `ContentNegotiation`.
- Nine typed HTTP exceptions with snake_case JSON bodies.
- MIT license and Composer metadata for Packagist.
+5
View File
@@ -1,5 +1,10 @@
# camelia/controllers
[![Latest Stable Version](https://img.shields.io/packagist/v/camelia/controllers.svg)](https://packagist.org/packages/camelia/controllers)
[![Total Downloads](https://img.shields.io/packagist/dt/camelia/controllers.svg)](https://packagist.org/packages/camelia/controllers)
[![License](https://img.shields.io/packagist/l/camelia/controllers.svg)](https://packagist.org/packages/camelia/controllers)
[![Tests](https://git.dr2gsistemas.duckdns.org/dr2gsistemas/camelia-controller/actions/workflows/tests.yml/badge.svg)](https://git.dr2gsistemas.duckdns.org/dr2gsistemas/camelia-controller/actions)
Framework-agnostic REST controller toolkit: routing, request parsing, validation and JSON responses
over any data source. Vanilla PHP, no framework.
+1
View File
@@ -31,6 +31,7 @@
},
"scripts": {
"test": "phpunit --configuration phpunit.xml.dist",
"coverage": "phpunit --configuration phpunit.coverage.xml.dist --coverage-text",
"fmt": "mago fmt",
"fmt:check": "mago fmt --check",
"lint": "mago lint",
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Coverage configuration, kept out of phpunit.xml.dist on purpose: a coverage report
needs Xdebug or PCOV, and `failOnWarning` turns the missing driver into a failed run.
Invoke it explicitly with `composer coverage` on a machine that has a driver.
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheDirectory=".phpunit.cache"
failOnRisky="true"
failOnEmptyTestSuite="true">
<testsuites>
<testsuite name="unit">
<directory>tests/Unit</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>src</directory>
</include>
</source>
<coverage>
<report>
<text outputFile="php://stdout" showOnlySummary="true"/>
<clover outputFile="coverage/clover.xml"/>
<html outputDirectory="coverage/html"/>
</report>
</coverage>
</phpunit>