Skip to content

chore(ci): bump actions/github-script from 7 to 9 #46

chore(ci): bump actions/github-script from 7 to 9

chore(ci): bump actions/github-script from 7 to 9 #46

Workflow file for this run

# CI: tests on PHP 8.1–8.5 × Symfony 6.4, 7.0, 8.0 (exclusions for incompatible pairs).
# Coverage with PCOV; release updated via release.yml on tag push.
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
name: PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4', '8.5']
symfony: ['6.4', '7.0', '8.0']
exclude:
- php: '8.1'
symfony: '7.0'
- php: '8.1'
symfony: '8.0'
- php: '8.2'
symfony: '8.0'
- php: '8.3'
symfony: '8.0'
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, pdo, pdo_mysql, pdo_pgsql, yaml
coverage: pcov
tools: composer:v2
- name: Validate composer.json
run: composer validate --strict
- 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@v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-
${{ runner.os }}-php-${{ matrix.php }}-composer-
- name: Install dependencies with Symfony ${{ matrix.symfony }}
run: |
# Do not run a partial `composer update` on PHP 8.1 before the steps below: if composer.lock was built
# on PHP 8.2+ (e.g. Symfony 7.4), Composer validates the whole lock against PHP 8.1 and aborts before any
# package can be downgraded. The require + full symfony/* update realigns the lock for this matrix.
# Pin browser-kit + dom-crawler to the matrix Symfony: they are require-dev with ^6.1||^7||^8 and could
# otherwise stay on 7.x while http-kernel is 6.4, breaking HttpKernelBrowser::doRequest vs AbstractBrowser.
# var-exporter must match the matrix Symfony major: ORM 3.6+ needs ProxyHelper::generateLazyGhost when native
# lazy objects are off; that method was removed in symfony/var-exporter 8.x, so a 7.x stack must not pull 8.x here.
# Pin every Symfony component used by the bundle (and symfony/console, which is only transitive): otherwise the
# lock can keep console 7.x while yaml/http-kernel are 6.4 → PHP fatal: Command::configure(): void vs LintCommand.
composer require \
symfony/config:^${{ matrix.symfony }} \
symfony/console:^${{ matrix.symfony }} \
symfony/dependency-injection:^${{ matrix.symfony }} \
symfony/framework-bundle:^${{ matrix.symfony }} \
symfony/form:^${{ matrix.symfony }} \
symfony/http-kernel:^${{ matrix.symfony }} \
symfony/yaml:^${{ matrix.symfony }} \
symfony/security-bundle:^${{ matrix.symfony }} \
symfony/stopwatch:^${{ matrix.symfony }} \
symfony/translation:^${{ matrix.symfony }} \
symfony/twig-bundle:^${{ matrix.symfony }} \
symfony/var-exporter:^${{ matrix.symfony }} \
symfony/browser-kit:^${{ matrix.symfony }} \
symfony/dom-crawler:^${{ matrix.symfony }} \
symfony/http-client:^${{ matrix.symfony }} \
symfony/mailer:^${{ matrix.symfony }} \
symfony/mime:^${{ matrix.symfony }} \
--no-interaction --no-update
# Quote 'symfony/*' so the shell never glob-expands it (with nullglob, symfony/* can vanish and Composer would
# skip all Symfony packages — leaving e.g. console 7.x with yaml 6.4 → fatal Command::configure(): void).
# Full update reconciles require-dev (php-cs-fixer, rector, …) with the pinned Symfony major.
composer update --with-all-dependencies --no-interaction --prefer-dist --no-progress
- name: Validate translation YAML files
run: php scripts/validate-translations-yaml.php src/Resources/translations
- name: Run tests
run: |
echo "🧪 Running tests on PHP ${{ matrix.php }} with Symfony ${{ matrix.symfony }}..."
composer test
if [ $? -ne 0 ]; then
echo "❌ ERROR: Some tests failed"
exit 1
fi
echo "✅ All tests passed successfully"
- name: Run tests with coverage (PHP 8.2 + Symfony 7.0 only)
if: matrix.php == '8.2' && matrix.symfony == '7.0'
run: |
echo "📊 Generating coverage report..."
composer test-coverage
if [ $? -ne 0 ]; then
echo "❌ ERROR: Tests failed when generating coverage"
exit 1
fi
echo "✅ All tests passed, validating coverage (minimum 80%)..."
php scripts/check-coverage.php coverage.xml --min-percent=80
code-style:
name: Code Style
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:v2, cs2pr
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Fix code style
run: composer cs-fix
- name: Check for changes
id: verify-changed-files
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Commit changes
if: steps.verify-changed-files.outputs.changed == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit -m "Apply PHP CS Fixer fixes [skip ci]"
git push
code-style-check:
name: Code Style Check
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer:v2, cs2pr
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction
- name: Check code style
run: composer cs-check
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: json, pdo, pdo_mysql, pdo_pgsql
coverage: pcov
tools: composer:v2
- name: Install dependencies (Symfony 7.0)
run: |
composer require \
symfony/config:^7.0 \
symfony/console:^7.0 \
symfony/dependency-injection:^7.0 \
symfony/framework-bundle:^7.0 \
symfony/form:^7.0 \
symfony/http-kernel:^7.0 \
symfony/yaml:^7.0 \
symfony/security-bundle:^7.0 \
symfony/stopwatch:^7.0 \
symfony/translation:^7.0 \
symfony/twig-bundle:^7.0 \
symfony/var-exporter:^7.0 \
symfony/browser-kit:^7.0 \
symfony/dom-crawler:^7.0 \
symfony/http-client:^7.0 \
symfony/mailer:^7.0 \
symfony/mime:^7.0 \
--no-interaction --no-update
composer update --with-all-dependencies --no-interaction --prefer-dist --no-progress
- name: Run tests with coverage
run: |
echo "🧪 Running tests with coverage..."
rm -rf .phpunit.cache
composer test-coverage
if [ $? -ne 0 ]; then
echo "❌ ERROR: Tests failed"
exit 1
fi
echo "✅ All tests passed successfully"
- name: Validate coverage (minimum 80%)
run: |
echo "📊 Validating coverage (minimum 80%)..."
php scripts/check-coverage.php coverage.xml --min-percent=80
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: coverage.xml
fail_ci_if_error: false
# Maintainer: Héctor Franco Aceituno (@HecFranco)
# Organization: nowo-tech (https://github.com/nowo-tech)