Once integrate with your Drupal project, this action will automatically run the list of jobs below (on commit):
- PHPUnit
- PHP Code Sniffer (PHPCS)
- PHPStan
- Create a .github/workflows/drupal-ci.yml in the consuming repository:
name: Drupal CI
on: [push]
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- name: tests
uses: skyred/drupal-actions@v0
with:
drupal_version: '10.4'
php_version: '8.2'
mysql_version: 'latest'
phpunit_coverage_path: 'coverage'
phpunit_config_file: 'phpunit.xml'
test_target_directory: 'modules/custom'
junit_path: 'junit'
simpletest_db: 'mysql://root:mysql_strong_password@mysql/drupal'
browsertest_output_directory: '.tmp/browser_output'
simpletest_base_url: 'http://localhost'
phpcs_config_file: 'phpcs.xml'
phpcs_target_directory: 'modules/custom/custom'
phpstan_config_file: 'phpstan.neon'
- composer.json:
"require-dev": {
"drupal/core-dev": "^10",
"drupal/coder": "^8.3",
"phpstan/phpstan": "^1.10"
}-
Run
composer install --devto installphpunit/phpunit,drupal/coder(forphpcs), andphpstan/phpstan`. -
Configuration Files:
- phpunit.xml: See the documentation on Drupal.org
- phpcs.xml: @todo
- phpstan.neon @todo
| Input | Description | Default | Required |
|---|---|---|---|
| drupal_version | Drupal version for the container | latest | No |
| php_version | PHP version for the container | 8.4 | No |
| mysql_version | MySQL version for the service | latest | No |
| phpunit_coverage_path | Path for PHPUnit coverage output | coverage | No |
| phpunit_config_file | PHPUnit configuration file | phpunit.xml | No |
| test_target_directory | Target directory for tests | '' (empty) | No |
| junit_path | Path for JUnit output | junit | No |
| simpletest_db | Database connection string for Simpletest | mysql://root:mysql_strong_password@mysql/drupal | No |
| browsertest_output_directory | Browser test output directory | .tmp/browser_output | No |
| simpletest_base_url | Base URL for Simpletest | http://localhost | No |
| phpcs_config_file | PHPCS configuration file | phpcs.xml | No |
| phpcs_target_directory Target directory for PHPCS | modules/custom themes/custom | No | |
| phpstan_config_file | PHPStan configuration file | phpstan.neon | No |