-
Notifications
You must be signed in to change notification settings - Fork 168
/
Copy pathconfig.yml
91 lines (91 loc) · 4.58 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
services:
# The main webserver contains our Open Social distribution.
webserver:
image: ghcr.io/goalgorilla/ci-tugboat-php:8.1-apache
default: true
depends:
- db
commands:
init:
- composer config --global github-protocols https
# Undo the weird symlink in the default Tugboat image.
- rm -rf $DOCROOT/html.original $DOCROOT/html
# Update is run as single string rather than individual steps since
# individual steps are executed in separate shell instances.
update: |
set -e
git config --global --add safe.directory /var/www/html/profiles/contrib/social
# Docroot for the PHP image points to /var/www/html so we set-up Open
# Social one folder up so that our web files are in the html folder.
cd $DOCROOT/..
# Create a config/sync directory so Drupal stops complaining, even if we
# don't need it.
mkdir -p $DOCROOT/../config/sync
# Create a private file path.
mkdir -p $DOCROOT/../files_private
# Find the branch name regardless of preview type. This does fail for
# non-GitHub PRs or branches until Tugboat provdes a better way.
export BRANCH_NAME=$([ "$TUGBOAT_PREVIEW_TYPE" = "pullrequest" ] && echo "$TUGBOAT_GITHUB_HEAD" || echo "$TUGBOAT_PREVIEW_REF")
# Find the project name from the root composer.json file
export COMPOSER_PROJECT_NAME=`cat "$TUGBOAT_ROOT/composer.json" | jq -r '.name'`
# Copy the composer.json test project file.
cp $TUGBOAT_ROOT/.tugboat/composer.json .
# Add the GitHub repository that the branch is in.
composer config repositories.open_social git "https://github.com/$TUGBOAT_GITHUB_OWNER/$TUGBOAT_GITHUB_REPO"
# Install our preview version through private packagist.
composer require --update-with-all-dependencies $COMPOSER_PROJECT_NAME:dev-$BRANCH_NAME#$TUGBOAT_PREVIEW_SHA
# Use the tugboat-specific Drupal settings.
cat $DOCROOT/sites/default/default.settings.php | \
sed -z "s@#\n# if (file_exists(\$app_root . '/' . \$site_path . '/settings.local.php')) {\n# include \$app_root . '/' . \$site_path . '/settings.local.php';\n# }@if (file_exists(__DIR__ . '/settings.local.php')) {\n include __DIR__ . '/settings.local.php';\n}@" \
> $DOCROOT/sites/default/settings.php
cp "${TUGBOAT_ROOT}/.tugboat/settings.local.php" "${DOCROOT}/sites/default/"
mkdir -p ${DOCROOT}/sites/default/files && chmod -R 755 ${DOCROOT}/sites/default/files
chown -R www-data:www-data $DOCROOT/..
# Install Open Social.
cd html
../vendor/bin/drush \
--yes \
--site-name="Open Social QA" \
--account-pass=${ADMIN_PASSWORD} \
site:install social
# Install the database log, it's bad for performance but helps in quickly
# capturing errors while testing.
../vendor/bin/drush \
--yes \
en dblog
# Enable the demo content.
../vendor/bin/drush \
--yes \
en social_demo
../vendor/bin/drush \
sda \
file user group topic event event_enrollment post comment like
# Allow site managers to enable modules so developers can change the
# set-up during testing.
../vendor/bin/drush role:perm:add --yes 'sitemanager' 'administer modules'
# Uninstall the social_demo module since demo content has been
# installed and the module silences useful status messages.
../vendor/bin/drush \
--yes \
pmu social_demo
# Change file owner again because of the way demo content is copied.
chown -R www-data:www-data $DOCROOT
build: |
cd $DOCROOT/..
export BRANCH_NAME=$([ "$TUGBOAT_PREVIEW_TYPE" = "pullrequest" ] && echo "$TUGBOAT_GITHUB_HEAD" || echo "$TUGBOAT_PREVIEW_REF")
export COMPOSER_PROJECT_NAME=`cat "$TUGBOAT_ROOT/composer.json" | jq -r '.name'`
composer require --update-with-all-dependencies $COMPOSER_PROJECT_NAME:dev-$BRANCH_NAME#$TUGBOAT_PREVIEW_SHA
composer install --optimize-autoloader
cd html && ../vendor/bin/drush updatedb -y
# A database for storage of Open Social data.
db:
image: tugboatqa/mariadb:latest
# SOLR is used to power Open Social's search
solr:
image: ghcr.io/goalgorilla/ci-tugboat-solr:8.11
commands:
init:
- su -s /bin/sh -c "/opt/solr/bin/solr create_core -c drupal -force" solr
build:
- cd "/var/solr/data/drupal" && rm -rf conf
- cd "/var/solr/data/drupal" && ln -snf "/solr-conf/conf" conf