Commit c4cf17c7 authored by Joe Parsons's avatar Joe Parsons Committed by mmarler
Browse files

Issue #3265745: Enable Tugboat live previews

parent 826a8d30
Loading
Loading
Loading
Loading

.tugboat/config.yml

0 → 100644
+51 −0
Original line number Diff line number Diff line
services:
  php:
    image: q0rban/tugboat-drupal:9.3
    default: true
    http: false
    depends: mysql
    commands:
      update: |
        set -eux
        # Check out a branch using the unique Tugboat ID for this repository, to
        # ensure we don't clobber an existing branch.
        git checkout -b $TUGBOAT_REPO_ID
        # Composer is hungry. You need a Tugboat project with a pretty sizeable
        # chunk of memory.
        export COMPOSER_MEMORY_LIMIT=-1
        # This is an environment variable we added in the Dockerfile that
        # provides the path to Drupal composer root (not the web root).
        cd $DRUPAL_COMPOSER_ROOT
        # We configure the Drupal project to use the checkout of the module as a
        # Composer package repository.
        composer config repositories.tugboat vcs $TUGBOAT_ROOT
        # Now we can require this module, specifing the branch name we created
        # above that uses the $TUGBOAT_REPO_ID environment variable.
        composer require drupal/google_cse:dev-$TUGBOAT_REPO_ID
        # Install Drupal on the site.
        vendor/bin/drush \
          --yes \
          --db-url=mysql://tugboat:tugboat@mysql:3306/tugboat \
          --site-name="Live preview for ${TUGBOAT_PREVIEW_NAME}" \
          --account-pass=admin \
          site:install standard
        # Set up the files directory permissions.
        mkdir -p $DRUPAL_DOCROOT/sites/default/files
        chgrp -R www-data $DRUPAL_DOCROOT/sites/default/files
        chmod 2775 $DRUPAL_DOCROOT/sites/default/files
        chmod -R g+w $DRUPAL_DOCROOT/sites/default/files
        # Enable the module.
        vendor/bin/drush --yes pm:enable google_cse
      build: |
        set -eux
        # Delete and re-check out this branch in case this is built from a Base Preview.
        git branch -D $TUGBOAT_REPO_ID && git checkout -b $TUGBOAT_REPO_ID || true
        export COMPOSER_MEMORY_LIMIT=-1
        cd $DRUPAL_COMPOSER_ROOT
        composer install --optimize-autoloader
        # Update this module, including all dependencies.
        composer update drupal/google_cse --with-all-dependencies
        vendor/bin/drush --yes updb
        vendor/bin/drush cache:rebuild
  mysql:
    image: tugboatqa/mariadb

composer.json

0 → 100644
+22 −0
Original line number Diff line number Diff line
{
  "name": "drupal/google_cse",
  "description": "Use Google Custom Search to search your site and/or any other sites.",
  "type": "drupal-module",
  "license": "GPL-2.0-or-later",
  "minimum-stability": "dev",
  "homepage": "https://drupal.org/project/google_cse",
  "support": {
    "issues": "https://www.drupal.org/project/issues/google_cse?version=8.x",
    "source": "https://git.drupalcode.org/project/google_cse"
  },
  "require": {
    "drupal/core": "^8 || ^9 || ^10"
  },
  "extra": {
    "drush": {
      "services": {
        "drush.services.yml": "^9 || ^10"
      }
    }
  }
}