Skip to content

Run distribution tests #3802

Run distribution tests

Run distribution tests #3802

Workflow file for this run

name: Run distribution tests
on:
pull_request:
paths-ignore:
- '**.md'
- 'package.json'
- 'package-lock.json'
schedule:
- cron: '0 6 * * *'
env:
DRUPAL_TESTING_COMPOSER_PROJECT: thunder/thunder-project
DRUPAL_TESTING_COMPOSER_PROJECT_VERSION: "^4.0@stable"
DRUPAL_TESTING_CLEANUP: false
DRUPAL_TESTING_DATABASE_USER: root
DRUPAL_TESTING_DATABASE_PASSWORD: root
DRUPAL_TESTING_TEST_DUMP_FILE: site-dump.tar.gz
DRUPAL_TESTING_DATABASE_ENGINE: mysql
DRUPAL_TESTING_TEST_CODING_STYLES: false
DRUPAL_TESTING_TEST_PROFILE: thunder
DRUPAL_TESTING_HTTP_PORT: 8888
DRUPAL_TESTING_VERBOSE: false
DRUPAL_TESTING_VERSION: "^1.0.42"
DRUPAL_TESTING_TEST_FILTER: ""
DRUPAL_TESTING_SELENIUM_HOST: 127.0.0.1
DRUPAL_TESTING_SELENIUM_PORT: 9515
PHPSTAN_MEMORY_LIMIT: 4G
DRUPAL_TESTING_PARALLEL_TESTING: false
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless", "--no-sandbox", "--disable-dev-shm-usage"]}}, "http://127.0.0.1:9515"]'
SIMPLETEST_BASE_URL: http://thunder-testing:8888
BROWSERTEST_OUTPUT_DIRECTORY: /tmp
SKIP_TEST_CLEANUP: true
# The following variable set the version that the upgrade test starts with.
DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION: 3.0.12
DRUPAL_TESTING_UPGRADE_DRUSH_VERSION: 10.3.6
DRUPAL_TESTING_UPGRADE_VERSION: 6.5.4
jobs:
build:
runs-on: ubuntu-24.04
services:
mysql:
image: mariadb:lts
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
strategy:
matrix:
PHP_VERSION: [ '8.1', '8.3' ]
env:
DRUPAL_TESTING_TEST_DEPRECATION: true
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: ${{ matrix.PHP_VERSION }}
extensions: :redis, Imagick
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-cache-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-cache-
- name: Get build environment
run: |
composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --no-plugins
composer global require thunder/drupal-testing:${DRUPAL_TESTING_VERSION}
composer global require php-parallel-lint/php-parallel-lint
- name: Lint
run: |
parallel-lint --version
parallel-lint --no-progress -e php,module,install,inc,profile,theme .
- name: Prepare the build
run: test-drupal-project prepare_build
- name: Build the docroot
run: test-drupal-project build
- name: Test for deprecations
run: test-drupal-project deprecation
- name: Install drupal
run: test-drupal-project install
- name: Zip build
run: cd /tmp/test; tar cfz build-${{ matrix.PHP_VERSION }}.tgz thunder; mv build-${{ matrix.PHP_VERSION }}.tgz ${GITHUB_WORKSPACE}
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.PHP_VERSION }}
path: build-${{ matrix.PHP_VERSION }}.tgz
test-max:
needs: build
runs-on: ubuntu-24.04
services:
mysql:
image: mariadb:lts
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
chrome:
image: drupalci/chromedriver:production
options: --add-host=thunder-testing:host-gateway --name chrome
ports:
- 9515:9515
strategy:
fail-fast: false
matrix:
PHP_VERSION: [ '8.3' ]
CHUNK: [ 1, 2, 3 ]
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: ${{ matrix.PHP_VERSION }}
extensions: :redis, :sodium, Imagick, gd, PDO, mysql, pdo_mysql, mbstring, xmlwriter, pdo, date, dom, filter, hash, json, pcre, session, SimpleXML, SPL, tokenizer, xml, curl
- name: Add host
run: echo "127.0.0.1 thunder-testing" | sudo tee -a /etc/hosts
- name: Prepare fixtures
run: docker cp ./tests/fixtures chrome:/fixtures
- name: Get build environment
run: |
composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --no-plugins
composer global require thunder/drupal-testing:${DRUPAL_TESTING_VERSION}
- name: Download build
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.PHP_VERSION }}
- name: Unzip build artifact
run: mkdir -p /tmp/test; tar xCfz /tmp/test build-${{ matrix.PHP_VERSION }}.tgz thunder; rm -rf build-${{ matrix.PHP_VERSION }}
- name: Setup Apache
uses: thunder/apache-shiva-php-action@v1
with:
php-version: ${{ matrix.PHP_VERSION }}
site-directory: /tmp/test/thunder/install/docroot
http-port: ${{ env.DRUPAL_TESTING_HTTP_PORT }}
- name: Run tests
run: test-drupal-project run_tests
env:
THUNDER_TEST_CHUNK: ${{ matrix.CHUNK }}
DRUPAL_TESTING_TEST_PATH: /tmp/test/thunder/install/docroot/profiles/contrib/thunder/tests/src/TestSuites/ThunderTestSuite.php
- name: Upload test output
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: text-max-output-${{ matrix.CHUNK }}-${{ matrix.PHP_VERSION }}
path: /tmp/test/thunder/install/docroot/sites/simpletest/browser_output/
test-upgrade:
runs-on: ubuntu-24.04
services:
mysql:
image: mariadb:lts
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
chrome:
image: drupalci/chromedriver:production
options: --add-host=thunder-testing:host-gateway --name chrome
ports:
- 9515:9515
strategy:
matrix:
PHP_VERSION: [ '8.1' ]
if: ${{ contains(github.event.pull_request.labels.*.name, 'test-upgrade') || github.event_name == 'schedule' }}
env:
DRUPAL_TESTING_TEST_GROUP_EXCLUDE: "NoUpdate"
DRUPAL_TESTING_TEST_GROUP: Thunder
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: ${{ matrix.PHP_VERSION }}
extensions: :redis, Imagick, gd, pdo_mysql
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-cache-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-cache-
- name: Prepare fixtures
run: docker cp ./tests/fixtures chrome:/fixtures
- name: Add host
run: echo "127.0.0.1 thunder-testing" | sudo tee -a /etc/hosts
- name: Get build environment
run: |
composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --no-plugins
composer global require thunder/drupal-testing:${DRUPAL_TESTING_VERSION}
- name: Prepare the old install
run: test-drupal-project prepare_old_install
env:
COMPOSER_ROOT_VERSION: ${{ env.DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION }}
- name: Fix the old install
run: |
composer upgrade caxy/php-htmldiff
working-directory: /tmp/test/thunder/install
env:
COMPOSER_ROOT_VERSION: ${{ env.DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION }}
- name: Install drupal
run: test-drupal-project install
env:
COMPOSER_ROOT_VERSION: ${{ env.DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION }}
- name: Prepare the upgrade
run: test-drupal-project prepare_upgrade
env:
COMPOSER_ROOT_VERSION: ${{ env.DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION }}
- name: Update the docroot
run: |
composer remove thunder/thunder-distribution --no-update
composer config name "drupal-testing-thunder/thunder-distribution" --working-dir="${GITHUB_WORKSPACE}"
composer require "drupal-testing-thunder/thunder-distribution:*" --no-update
composer require "drupal/ckeditor" --no-update
composer require "drupal/seven" --no-update
composer require "drupal/entity_browser" --no-update
composer require "drupal/thunder_admin" --no-update
composer require "drupal/shariff" --no-update
composer require "drupal/ctools" --no-update
composer require "drupal/core-dev:~10.0.0" --no-update
composer update
composer exec -- drush updb -y
cd docroot
php core/scripts/db-tools.php dump-database-d8-mysql --database-url "${SIMPLETEST_DB}" >"sites/default/database-dump.php"
tar -czf "${DRUPAL_TESTING_TEST_DUMP_FILE}" --exclude='config_*' --exclude='php' --exclude='styles' --directory='sites/default' files database-dump.php
working-directory: /tmp/test/thunder/install
env:
COMPOSER_ROOT_VERSION: ${{ env.DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION }}
- name: Setup Apache
uses: thunder/apache-shiva-php-action@v1
with:
php-version: ${{ matrix.PHP_VERSION }}
site-directory: /tmp/test/thunder/install/docroot
http-port: ${{ env.DRUPAL_TESTING_HTTP_PORT }}
- name: Run tests suite
run: test-drupal-project run_tests
env:
COMPOSER_ROOT_VERSION: ${{ env.DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION }}
test-min:
runs-on: ubuntu-24.04
services:
mysql:
image: mariadb:lts
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
chrome:
image: drupalci/chromedriver:production
options: --add-host=thunder-testing:host-gateway --name chrome
ports:
- 9515:9515
strategy:
matrix:
PHP_VERSION: [ '8.1' ]
if: ${{ contains(github.event.pull_request.labels.*.name, 'test-min') || github.event_name == 'schedule' }}
env:
DRUPAL_TESTING_TEST_GROUP: Thunder
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: ${{ matrix.PHP_VERSION }}
extensions: :redis, Imagick, gd, pdo_mysql
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-cache-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-cache-
- name: Prepare fixtures
run: docker cp ./tests/fixtures chrome:/fixtures
- name: Add host
run: echo "127.0.0.1 thunder-testing" | sudo tee -a /etc/hosts
- name: Get build environment
run: |
composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --no-plugins
composer global require thunder/drupal-testing:${DRUPAL_TESTING_VERSION}
- name: Prepare the build
run: test-drupal-project prepare_build
- name: Install suggested dependencies
run: |
composer require "league/container:^4.2" "drupal/core-dev:^10.3" --no-update --no-progress --working-dir=/tmp/test/thunder/install
composer config allow-plugins.php-http/discovery true --no-plugins --working-dir=/tmp/test/thunder/install
- name: Build the docroot
run: test-drupal-project build
env:
DRUPAL_TESTING_MIN_BUILD: true
- name: Setup Apache
uses: thunder/apache-shiva-php-action@v1
with:
php-version: ${{ matrix.PHP_VERSION }}
site-directory: /tmp/test/thunder/install/docroot
http-port: ${{ env.DRUPAL_TESTING_HTTP_PORT }}
- name: Run the tests
run: test-drupal-project run_tests
# Start a debug session.
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3