mirror of
https://github.com/shivammathur/setup-php.git
synced 2026-03-24 00:10:37 +07:00
Add workflow examples for Drupal and WordPress plugins
This commit is contained in:
59
examples/drupal.yml
Normal file
59
examples/drupal.yml
Normal file
@@ -0,0 +1,59 @@
|
||||
# GitHub Action for Drupal 11 composer-managed projects
|
||||
# Requires drupal/core-dev in require-dev for vendor/bin/phpunit
|
||||
name: Testing Drupal
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
drupal:
|
||||
name: Drupal (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
SIMPLETEST_BASE_URL: http://127.0.0.1:8080
|
||||
SIMPLETEST_DB: sqlite://localhost/sites/default/files/.ht.sqlite
|
||||
BROWSERTEST_OUTPUT_DIRECTORY: /tmp/browser_output
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-versions: ['8.3', '8.4', '8.5']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# Docs: https://github.com/shivammathur/setup-php
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: apcu, ctype, curl, dom, gd, iconv, intl, mbstring, pdo_sqlite, simplexml, xml, zip
|
||||
coverage: none
|
||||
|
||||
- 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 }}
|
||||
# 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 Composer dependencies
|
||||
run: |
|
||||
if [ "${{ matrix.php-versions }}" = "8.3" ]; then
|
||||
composer require --dev drupal/core-dev:11.2.10 doctrine/instantiator:^2.0.0 --no-interaction --no-update
|
||||
composer update drupal/core-dev doctrine/instantiator --with-all-dependencies --no-interaction --no-progress --prefer-dist --optimize-autoloader
|
||||
else
|
||||
composer install --no-interaction --no-progress --prefer-dist --optimize-autoloader
|
||||
fi
|
||||
|
||||
- name: Prepare Drupal test directories
|
||||
run: mkdir -p web/sites/default/files "$BROWSERTEST_OUTPUT_DIRECTORY"
|
||||
|
||||
- name: Start Drupal web server
|
||||
run: php -S 127.0.0.1:8080 -t web >/tmp/php-server.log 2>&1 &
|
||||
|
||||
- name: Test with phpunit
|
||||
# Adjust the test path to match your custom modules or themes.
|
||||
run: vendor/bin/phpunit -c web/core web/modules/custom
|
||||
Reference in New Issue
Block a user