Skip to content

Drupal 11 readiness. #805

Drupal 11 readiness.

Drupal 11 readiness. #805

Workflow file for this run

name: Tests
on:
push:
branches: [ 8.x-4.x ]
pull_request:
branches: [ 8.x-4.x ]
jobs:
drupal:
name: Drupal ${{ matrix.drupal-core }} (PHP ${{ matrix.php-versions }})
# We cannot use ubuntu-latest right now as it still points to 22.04 and we need a newer database driver."
runs-on: ubuntu-24.04
env:
extensions: mbstring, xml, pdo_sqlite, gd, opcache
strategy:
fail-fast: false
matrix:
php-versions: ['8.1', '8.2', '8.3']
drupal-core: ['10.3.x']
phpstan: ['0']
include:
# Extra run to test older supported Drupal 10.2.x.
- php-versions: '8.1'
drupal-core: '10.2.x'
phpstan: '0'
# We only need to run PHPStan once on the latest PHP version.
- php-versions: '8.3'
drupal-core: '11.0.x'
phpstan: '1'
steps:
- name: Checkout Drupal core
uses: actions/checkout@v4
with:
repository: drupal/drupal
ref: ${{ matrix.drupal-core }}
- name: Checkout graphql module
uses: actions/checkout@v4
with:
path: modules/graphql
- name: Setup PHP extension cache
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
# Ideally this would be based on env.extensions, how can we make a
# hash out of that?
key: cache-v1
- name: Cache PHP extensions
uses: actions/cache@v4
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
# Disable Xdebug for better performance.
coverage: none
ini-file: development
extensions: ${{ env.extensions }}
- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Drupal core dependencies
run: |
composer install --no-progress --prefer-dist --optimize-autoloader
composer --no-interaction run-script drupal-phpunit-upgrade
composer config --no-plugins allow-plugins.phpstan/extension-installer true
# Revisit - check for latest release of dependent modules.
- name: Install GraphQL dependencies
run: |
composer --no-interaction --no-progress require \
webonyx/graphql-php:^14.8 \
drupal/typed_data:^2.0 \
drupal/redirect:dev-1.x
- name: Run PHPUnit
run: |
cp modules/graphql/phpunit.xml.dist core/phpunit.xml
./vendor/bin/phpunit --configuration core/phpunit.xml modules/graphql
env:
SIMPLETEST_DB: "sqlite://localhost/:memory:"
- name: Install PHPStan and Coder dependencies
if: ${{ matrix.phpstan == '1' }}
# Pin the exact Coder version to upgrade manually when we want to.
run: |
composer --no-interaction --no-progress require \
phpstan/phpstan:^1.11.9 \
mglaman/phpstan-drupal:^1.1.2 \
phpstan/phpstan-deprecation-rules:^1.0.0 \
jangregor/phpstan-prophecy:^1.0.0 \
phpstan/phpstan-phpunit:^1.4 \
phpstan/extension-installer:^1.4
composer --no-interaction --no-progress --with-all-dependencies upgrade drupal/coder:8.3.24
- name: Run PHPStan
if: ${{ matrix.phpstan == '1' }}
run: cd modules/graphql && ../../vendor/bin/phpstan analyse
- name: Run PHPCS
if: ${{ matrix.phpstan == '1' }}
run: cd modules/graphql && ../../vendor/bin/phpcs -p