PHP 8.3.13 #1389
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Drupal | |
on: | |
pull_request: | |
push: | |
branches: | |
# Push events on main branch | |
- main | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
env: | |
DRUPAL_DB_HOST: 127.0.0.1 | |
DRUPAL_DB_PORT: 3306 | |
DRUPAL_INSTALL_PROFILE: minimal | |
SIMPLETEST_DB: mysql://drupal:[email protected]:3306/drupal | |
SIMPLETEST_BASE_URL: http://127.0.0.1:8080 | |
BROWSERTEST_OUTPUT_DIRECTORY: 'public/sites/simpletest' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
services: | |
db: | |
# See https://hub.docker.com/r/druidfi/mysql | |
image: druidfi/mysql:8.0-drupal-lts | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Setup PHP with composer v2 | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
tools: composer:v2 | |
- name: Validate composer.json | |
run: composer validate | |
- 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 Composer dependencies | |
run: composer install --prefer-dist --optimize-autoloader --no-progress | |
- name: Lint | |
run: | | |
vendor/bin/phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer,vendor/slevomat/coding-standard | |
vendor/bin/phpcs -i | |
vendor/bin/phpcs --standard=Drupal,DrupalPractice -n public/modules/custom | |
vendor/bin/phpcs --standard=Drupal,DrupalPractice -n public/themes/custom | |
- name: Install Drupal | |
run: vendor/bin/drush site-install --verbose --yes $DRUPAL_INSTALL_PROFILE | |
- name: Operate on Drupal | |
run: | | |
vendor/bin/drush status | |
# composer require --no-progress drupal/ctools | |
# vendor/bin/drush en --yes ctools | |
- name: Run web server with Drush | |
run: | | |
vendor/bin/drush runserver $SIMPLETEST_BASE_URL > /dev/null 2>&1 & | |
chromedriver --port=4444 & | |
- name: Wait for web server to start | |
run: for i in {1..5}; do RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$SIMPLETEST_BASE_URL" || true); if [ "$RESPONSE_CODE" -gt "301" ] || [ "$RESPONSE_CODE" -lt "200" ]; then sleep 2; fi; done | |
- name: Run PHPUnit tests | |
run: | | |
set -o pipefail && vendor/bin/phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist | |
- name: Create an artifact from test report | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: results | |
path: public/sites/simpletest/browser_output/ | |
retention-days: 1 |