Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: CI

on:
push:
branches: [master]
pull_request:

jobs:
shell:
name: Shell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Syntax check
run: bash -n scripts/drush-healthcheck.sh

- name: ShellCheck
uses: ludeeus/action-shellcheck@master
with:
severity: warning
scandir: ./scripts

php:
name: PHP ${{ matrix.php }} / Drupal ${{ matrix.drupal }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- drupal: '10.3'
php: '8.1'
- drupal: '11'
php: '8.3'

services:
mysql:
image: mariadb:10.6
env:
MYSQL_ALLOW_EMPTY_PASSWORD: 1
MYSQL_DATABASE: drupal
ports: ['3306:3306']
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=10s --health-timeout=5s --health-retries=5

steps:
- name: Checkout module
uses: actions/checkout@v4
with:
path: module

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gd, pdo_mysql, posix
coverage: none

- name: Build a Drupal site around the module
run: |
composer create-project drupal/recommended-project:^${{ matrix.drupal }} drupal \
--no-interaction --no-install
cd drupal
composer config minimum-stability dev
composer config --no-plugins allow-plugins true
composer config repositories.module path ../module
# -W because core-dev pulls dependency versions that conflict with
# the ones recommended-project pinned in its lock file.
# Drush is listed explicitly: a dependency's require-dev is not
# installed, so the module's own entry does not provide it here, and
# the site install step below needs it.
composer require --dev \
drupal/core-dev:^${{ matrix.drupal }} \
drush/drush:^13 \
-W --no-interaction
composer require fivejars/logs_monitoring:@dev --no-interaction

- name: Coding standards
working-directory: drupal
run: |
vendor/bin/phpcs --standard=Drupal,DrupalPractice \
--extensions=php,module,install,inc,test \
web/modules/contrib/logs_monitoring

- name: Static analysis
working-directory: drupal
run: |
vendor/bin/phpstan analyse \
--configuration=vendor/drupal/core-dev/phpstan-drupal-core.neon.dist \
--level=1 \
web/modules/contrib/logs_monitoring || \
vendor/bin/phpstan analyse --level=1 web/modules/contrib/logs_monitoring

# Functional tests reach their own test site by sending the DB prefix in
# the User-Agent, which core validates against the site's hash salt. With
# no settings.php there is no salt, validation fails, and every request
# falls through to the installer - which answers 200 to everything and
# makes every assertion fail in a way that looks like a module bug.
- name: Install Drupal
working-directory: drupal
run: |
vendor/bin/drush site:install standard \
--db-url=mysql://[email protected]:3306/drupal \
--account-pass=admin --no-interaction
chmod -R 0777 web/sites/default
mkdir -p web/sites/simpletest && chmod 0777 web/sites/simpletest

- name: Tests
working-directory: drupal
env:
SIMPLETEST_DB: mysql://[email protected]:3306/drupal
SIMPLETEST_BASE_URL: http://127.0.0.1:8080
BROWSERTEST_OUTPUT_DIRECTORY: /tmp/browser_output
SYMFONY_DEPRECATIONS_HELPER: weak
run: |
mkdir -p /tmp/browser_output
vendor/bin/drush runserver 127.0.0.1:8080 >/dev/null 2>&1 &
sleep 3
vendor/bin/phpunit \
--configuration web/core/phpunit.xml.dist \
--group logs_monitoring
Loading