Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Normalize line endings
* text=auto

# PHP files
*.php text eol=lf diff=php

# Config files
*.json text eol=lf
*.md text eol=lf
*.neon text eol=lf
*.xml text eol=lf
*.yaml text eol=lf
*.yml text eol=lf

# Exclude from releases
.editorconfig export-ignore
.gitattributes export-ignore
.github/ export-ignore
.gitignore export-ignore
.markdownlint.json export-ignore
.php-cs-fixer.* export-ignore
.phpstan/ export-ignore
.phpunit.* export-ignore
codecov.yml export-ignore
coverage/ export-ignore
coverage.clover export-ignore
coverage.xml export-ignore
DEVELOPMENT.md export-ignore
phpstan.neon.dist export-ignore
phpunit.xml* export-ignore
tests/ export-ignore
var/ export-ignore
vendor/ export-ignore
151 changes: 122 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ on:
push:
branches:
- 'main'
- 'legacy/*'
- 'feature/*'
- 'hotfix/*'
- 'release/*'
- 'legacy/*' # Legacy branches: legacy/v1.x
- 'feature/*' # Feature branches: feature/new-feature
- 'hotfix/*' # Hotfix branches: hotfix/urgent-fix
- 'release/*' # Release branches: release/v1.4.0
pull_request:
branches:
- 'main'
- 'legacy/*'
workflow_dispatch:
- 'legacy/*' # PRs to legacy branches
workflow_dispatch: # Allows manual triggering via GitHub UI

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

strategy:
fail-fast: false
matrix:
Expand All @@ -35,7 +35,7 @@ jobs:
- php: '8.4'
symfony-version: '6.4.*'
allowed-to-fail: false

# Symfony 7.x current versions
- php: '8.2'
symfony-version: '7.0.*'
Expand All @@ -61,30 +61,60 @@ jobs:
- php: '8.4'
symfony-version: '7.4.*'
allowed-to-fail: false

# Symfony 8.0 - Requires PHP 8.4+
- php: '8.4'
symfony-version: '8.0.*'
allowed-to-fail: false

# PHP 8.5 with various Symfony versions
- php: '8.5'
symfony-version: '7.3.*'
symfony-version: '8.0.*'
allowed-to-fail: false

# Symfony 8.1
- php: '8.4'
symfony-version: '8.1.*'
allowed-to-fail: false
- php: '8.5'
symfony-version: '7.4.*'
symfony-version: '8.1.*'
allowed-to-fail: false

# Symfony 8.2 (development / pre-release)
- php: '8.4'
symfony-version: '8.2.*'
allowed-to-fail: true
- php: '8.5'
symfony-version: '8.2.*'
allowed-to-fail: true

# PHP 8.6 (beta / experimental)
- php: '8.6'
symfony-version: '8.0.*'
allowed-to-fail: false
allowed-to-fail: true
- php: '8.6'
symfony-version: '8.1.*'
allowed-to-fail: true
- php: '8.6'
symfony-version: '8.2.*'
allowed-to-fail: true

# Development stability tests
- php: '8.4'
stability: 'dev'
allowed-to-fail: true
- php: '8.5'
stability: 'dev'
allowed-to-fail: true
- php: '8.6'
stability: 'dev'
allowed-to-fail: true

name: "PHP ${{ matrix.php }}${{ matrix.symfony-version && format(' | Symfony {0}', matrix.symfony-version) || '' }}${{ matrix.stability && format(' | {0}', matrix.stability) || '' }}"

name: "PHP ${{ matrix.php }}${{ matrix.symfony-version && format(' | Symfony {0}', matrix.symfony-version) || '' }}"

continue-on-error: ${{ matrix.allowed-to-fail }}

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -99,12 +129,18 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Configure stability
if: matrix.stability
run: |
composer config minimum-stability ${{ matrix.stability }}
composer config prefer-stable true

- name: Configure Symfony version
if: matrix.symfony-version
run: |
Expand All @@ -120,24 +156,35 @@ jobs:
- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-progress

- name: Validate composer.json
run: composer validate --strict --no-check-lock
- name: Validate composer.json and composer.lock
run: |
if [[ "${{ github.ref }}" == *"beta"* || "${{ github.ref }}" == *"alpha"* || "${{ github.ref }}" == *"rc"* ]]; then
composer validate --no-check-version
else
composer validate --strict
fi

- name: Run code style check
run: composer cs

- name: Run static analysis
run: composer analyse -- --memory-limit=1G

- name: Run tests
run: ./vendor/bin/simple-phpunit -v
run: composer test

code-quality:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: Code Quality Checks

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.4'
extensions: json, mbstring, tokenizer
coverage: none
tools: composer:v2
Expand All @@ -147,7 +194,7 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -157,4 +204,50 @@ jobs:
run: composer install --prefer-dist --no-interaction --no-progress

- name: Validate composer.json and composer.lock
run: composer validate --strict
run: |
if [[ "${{ github.ref }}" == *"beta"* || "${{ github.ref }}" == *"alpha"* || "${{ github.ref }}" == *"rc"* ]]; then
composer validate --no-check-version
else
composer validate --strict
fi

coverage:
runs-on: ubuntu-24.04
name: Code Coverage

steps:
- name: Checkout code
uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: json, mbstring, tokenizer
coverage: xdebug
tools: composer:v2

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress

- name: Run tests with coverage
run: composer test-coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
18 changes: 16 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,24 @@ composer.lock
# Symfony var (cache, logs, sessions)
/var/

###> symfony/phpunit-bridge ###
# PHPUnit
.phpunit
.phpunit.result.cache
.phpunit.cache/
/phpunit.xml
/tests/cache/
###< symfony/phpunit-bridge ###

# PHPStan
.phpstan/

# PHP CS Fixer
.php-cs-fixer.cache
.php-cs-fixer.php

# Coverage reports
coverage/
coverage.xml
*.clover

# Environment files
.env
22 changes: 22 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->exclude('vendor')
->exclude('coverage')
->exclude('.phpunit.cache')
->name('*.php');

$config = new PhpCsFixer\Config();
$config->setFinder($finder)
->setRules([
'@PSR12' => true,
'@PSR12:risky' => true,
])
->setRiskyAllowed(true)
->setUnsupportedPhpVersionAllowed(true);

return $config;
Loading