1e6557729f
- Introduced a new trait `HasCompositePrimaryKey` to enable Eloquent models to handle composite primary keys, which are not supported natively by Eloquent. The trait requires models to implement a method to define the composite key columns and manages key retrieval for save and select queries. chore: add GrumPHP configuration for pre-commit checks - Added a `grumphp.yml` configuration file to enforce code style and static analysis checks before commits. This setup includes Laravel Pint for code style and Larastan for static analysis, ensuring code quality and consistency. chore: create PHPStan configuration file - Created a `phpstan.neon` file to configure PHPStan with Larastan for static analysis. The configuration specifies the paths to analyze and sets the analysis level to 5 for a balance between catching bugs and avoiding excessive strictness.
54 lines
1.6 KiB
YAML
54 lines
1.6 KiB
YAML
name: CI - Intégration continue
|
|
|
|
# Intégration continue : à chaque push et chaque pull request, on vérifie
|
|
# automatiquement la qualité du code (Laravel Pint) puis on exécute les tests
|
|
# automatisés (PHPUnit). Un déploiement (voir deploy.yml) ne doit se faire que
|
|
# si cette étape est au vert.
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
quality-and-tests:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Récupération du code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Installation de PHP 8.2
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.2'
|
|
extensions: pdo_mysql, pdo_sqlite, sqlite3, mbstring, exif, pcntl, bcmath, gd
|
|
coverage: none
|
|
|
|
- name: Cache des dépendances Composer
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: vendor
|
|
key: composer-${{ hashFiles('composer.lock') }}
|
|
|
|
- name: Installation des dépendances
|
|
run: composer install --no-interaction --prefer-dist --optimize-autoloader
|
|
|
|
- name: Préparation de l'environnement de test
|
|
run: |
|
|
cp .env.example .env
|
|
php artisan key:generate
|
|
|
|
- name: Vérification du style de code (Laravel Pint)
|
|
run: vendor/bin/pint --test
|
|
|
|
- name: Analyse statique (Larastan / PHPStan)
|
|
run: vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=512M --no-progress
|
|
|
|
- name: Exécution des tests automatisés (PHPUnit)
|
|
env:
|
|
DB_CONNECTION: sqlite
|
|
DB_DATABASE: ':memory:'
|
|
run: php artisan test
|