Skip to content

Bump actions/checkout from 6 to 7 #3284

Bump actions/checkout from 6 to 7

Bump actions/checkout from 6 to 7 #3284

Workflow file for this run

---
name: Main
on:
push:
branches: [ main, develop, wip ]
# As of September 19, 2023, these paths-ignore patterns don't work due to
# a bug in GitHub Actions See https://github.com/actions/runner/issues/2324
# Ditto below.
paths-ignore:
- '.idea/**'
- '**/*.md'
pull_request:
branches: [ develop ]
paths-ignore:
- '.idea/**'
- '**/*.md'
schedule:
# Every Monday at 00:00:00 UTC.
# @see https://crontab.cronhub.io/
- cron: "0 0 * * 1"
workflow_dispatch:
jobs:
static_analysis:
name: "Static Analysis"
runs-on: ubuntu-latest
steps:
- name: "Set up PHP"
uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action
with:
php-version: "8.2"
coverage: none
- name: "Checkout code"
uses: actions/checkout@v7 # https://github.com/marketplace/actions/checkout
- name: "Remove composer.lock to test latest dependencies"
run: if [ -f composer.lock ]; then rm composer.lock; fi
shell: bash
- name: "Install dependencies"
uses: ramsey/composer-install@v4 # https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: "Run all static analysis tools"
run: |
composer validate
composer dump-autoload --strict-psr --dry-run
./vendor/bin/phpcs
./vendor/bin/phpstan
tests:
name: "Tests: ${{ matrix.os }} / PHP ${{ matrix.php }} / Symfony ^${{ matrix.symfony_major }} / deps ${{ matrix.dependencies }}${{ matrix.os == 'ubuntu' && matrix.dependencies == 'high' && matrix.php == '8.3' && matrix.symfony_major == '7' && ' w/ coverage' || '' }}"
runs-on: "${{ matrix.os }}-latest"
env:
# Only collect coverage for ubuntu/8.3/high/Symfony 7.x
COVERAGE: ${{ matrix.os == 'ubuntu' && matrix.dependencies == 'high' && matrix.php == '8.3' && matrix.symfony_major == '7' }}
strategy:
fail-fast: false
matrix:
include:
# Ubuntu: Only PHP/Symfony combos supported by Drupal core, plus forward-compat jobs for Symfony 8.x and PHP 8.4/8.5.
# 8.1: Symfony 6.4 (low/high)
- { os: ubuntu, php: '8.1', dependencies: low, symfony_major: '6' }
- { os: ubuntu, php: '8.1', dependencies: high, symfony_major: '6' }
# 8.2: Symfony 6.4 (high), Symfony 7.4 (low/high)
- { os: ubuntu, php: '8.2', dependencies: high, symfony_major: '6' }
- { os: ubuntu, php: '8.2', dependencies: low, symfony_major: '7' }
- { os: ubuntu, php: '8.2', dependencies: high, symfony_major: '7' }
# 8.3: Symfony 6.4 (high), Symfony 7.4 (high)
- { os: ubuntu, php: '8.3', dependencies: high, symfony_major: '6' }
- { os: ubuntu, php: '8.3', dependencies: high, symfony_major: '7' }
# 8.4: Symfony 6.4 (high), Symfony 7.4 (high), Symfony 8.x (forward-compat, high)
- { os: ubuntu, php: '8.4', dependencies: high, symfony_major: '6' }
- { os: ubuntu, php: '8.4', dependencies: high, symfony_major: '7' }
- { os: ubuntu, php: '8.4', dependencies: high, symfony_major: '8' }
# 8.5: Symfony 8.x (forward-compat, high)
- { os: ubuntu, php: '8.5', dependencies: high, symfony_major: '8' }
# macOS/Windows: smoke test, forward-compat only
- { os: macos, php: '8.5', dependencies: high, symfony_major: '8' }
- { os: windows, php: '8.5', dependencies: high, symfony_major: '8' }
steps:
- name: "Install rsync"
if: runner.os != 'Windows'
uses: GuillaumeFalourd/setup-rsync@v1.2 # https://github.com/marketplace/actions/setup-rsync
- name: "Install rsync (Windows)"
if: runner.os == 'Windows'
run: choco install rsync --no-progress -y
- name: "Set up PHP"
uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action
with:
php-version: "${{ matrix.php }}"
coverage: ${{ env.COVERAGE == 'true' && 'xdebug' || 'none' }}
extensions: gd
ini-values: zend.assertions=1
- name: "Checkout code"
uses: actions/checkout@v7 # https://github.com/marketplace/actions/checkout
# For all jobs except the main supported combo (Ubuntu, PHP 8.2, Symfony 7, highest),
# remove composer.lock so Composer resolves the latest allowed and secure dependencies.
# This ensures forward-compatibility, lowest-dependencies, and other matrix jobs test
# real-world installability, while the main job remains reproducible.
- name: "Remove composer.lock for non-main jobs"
if: ${{ !(matrix.os == 'ubuntu' && matrix.php == '8.2' && matrix.symfony_major == '7' && matrix.dependencies == 'high') }}
run: if [ -f composer.lock ]; then rm composer.lock; fi
shell: bash
# For Symfony 6 and 7, explicitly require the specific major version to override the
# version ranges in composer.json. For Symfony 8, skip this step and use the existing
# "^8.0" constraint from composer.json, which combined with conflict rules, ensures
# only secure versions are installed.
- name: "Require specific Symfony major version"
if: matrix.symfony_major != '8'
run: composer require --no-update "symfony/filesystem:^${{ matrix.symfony_major }}" "symfony/process:^${{ matrix.symfony_major }}"
- name: "Install dependencies"
uses: ramsey/composer-install@v4 # https://github.com/marketplace/actions/install-php-dependencies-with-composer
with:
dependency-versions: "${{ matrix.dependencies }}est"
- name: "Show installed versions"
shell: bash
env:
NO_COLOR: "1"
run: |
output=$(composer show | awk '{print "- "$1" ("$2")"}')
echo "$output"
echo "Total packages: $(echo "$output" | wc -l | tr -d ' ')"
- name: "Run tests"
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
# Windows-specific test suite
./vendor/bin/phpunit --no-coverage --exclude-group=no_windows --colors=always
elif [[ "${{ env.COVERAGE }}" == "true" ]]; then
# Run with coverage collection (only ubuntu/8.3/high)
./vendor/bin/phpunit --testsuite=coverage --exclude-group=windows_only --colors=always
else
# Standard test run without coverage
./vendor/bin/phpunit --no-coverage --exclude-group=windows_only --colors=always
fi