simplytest-8.x-4.x-dev/modules/simplytest_tugboat/templates/simplytest-tugboat-config-9-yml.html.twig
modules/simplytest_tugboat/templates/simplytest-tugboat-config-9-yml.html.twig
{#
/**
* Tugboat variables
* https://docs.tugboat.qa/reference/environment-variables/
*
* Simplytest progress status list:
* @see \Drupal\simplytest_tugboat\InstanceManager::getStatusList()
*
* Available variables:
*
* - additionals: array of additional projects to install
* - drupal_core_version: the version (branch or tag) of Drupal core to use
* - patches: array of URLs to patch files to apply
* - perform_install (bool): whether to 'drush si'
* - project: the primary project to install
* - project_type: the type (Module, Theme, or Distribution) of the primary project
* - project_version: the version string for the primary project
* - status_endpoint: The base_url + route uri + instance id for reporting
* status back to the simplytest server.
*/
#}
{% set interface = 'Drupal\\simplytest_tugboat\\InstanceManagerInterface' %}
# Drupal 9
services:
# What to call the service hosting the site.
php:
# Use PHP 7.3 with Apache
image: tugboatqa/php:7.3-apache
# Set this as the default service. This does a few things
# 1. Clones the git repository into the service container
# 2. Exposes port 80 to the Tugboat HTTP proxy
# 3. Routes requests to the preview URL to this service
default: true
depends: mysql
# A set of commands to run while building this service
commands:
# Commands that set up the basic preview infrastructure
build:
# Fetch the right drupal version.
- composer self-update
- rm -rf "${DOCROOT}"
{% set used_version = (project == 'drupal') ? project_version : drupal_core_version %}
{% if used_version ends with 'x' %}
{% set require_version = used_version ~ '-dev' %}
{% set used_version = used_version[:-2] %}
{% else %}
{% set require_version = used_version %}
{% endif %}
# Load drupal code base.
- composer -n create-project drupal/recommended-project:^{{ used_version }}@dev stm --no-install
- cd stm && composer require --no-update drupal/core-recommended:{{ require_version ~ "\n" }}
- cd stm && composer require --no-update drupal/core-composer-scaffold:{{ require_version ~ "\n" }}
- cd stm && composer require --dev --no-update drupal/dev-dependencies:{{ "dev-default\n" }}
- composer global require szeidler/composer-patches-cli:~1.0
- cd stm && composer require cweagans/composer-patches:~1.0 --no-update
- cd stm && composer require --dev --no-update drush/drush:^10.0
- cd stm && composer update
- ln -snf "${TUGBOAT_ROOT}/stm/web" "${DOCROOT}"
# Start the downloads
- wget -O/dev/null {{ status_endpoint }}/{{ constant(interface~'::DOWNLOAD') }}
{% if project_type == 'Module' or project_type == 'Theme' %}
- cd stm && composer require drupal/{{ project }}:{{ project_version }} --no-update
{% endif %}
- wget -O/dev/null {{ status_endpoint }}/{{ constant(interface~'::PATCHING') }}
{% if patches is not empty %}
# Apply patches.
- cd "${DOCROOT}" && composer patch-enable --file='patches.json'
{% for patch in patches %}
- cd "${DOCROOT}" && composer patch-add drupal/{{ (project == 'drupal') ? 'core' : project }} "STM patch {{ 'now' | date('U') }}" "{{ patch }}"
{% endfor %}
{% endif %}
{% for additional in additionals %}
- cd stm && composer require drupal/{{ additional }} --no-update
{% endfor %}
- cd stm && composer update --no-ansi
- cd "${DOCROOT}" && chmod -R 777 sites/default
- wget -O/dev/null {{ status_endpoint }}/{{ constant(interface~'::INSTALLING') }}
{% if perform_install %}
# Install drupal.
- cd "${DOCROOT}" && ../vendor/bin/drush si {{ (project_type == 'Distribution') ? project : 'standard' }} --db-url=mysql://tugboat:tugboat@mysql:3306/tugboat --account-name=admin --account-pass=admin -y
- cd "${DOCROOT}" && chmod -R 777 sites/default/files
{% if project_type == 'Module' or project_type == 'Theme' %}
- cd "${DOCROOT}" && ../vendor/bin/drush en {{ project }} -y
{% endif %}
{% for additional in additionals %}
- cd "${DOCROOT}" && ../vendor/bin/drush en {{ additional }} -y
{% endfor %}
{% endif %}
- wget -O/dev/null {{ status_endpoint }}/{{ constant(interface~'::FINALIZE') }}
# What to call the service hosting MySQL. This name also acts as the
# hostname to access the service by from the php service.
mysql:
# Use the latest available 5.x version of MySQL
image: tugboatqa/mysql:5
