Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
05316f7
Experiment: convert the_build_utility to a Drupal recipe
becw Feb 21, 2025
dbed58f
Fix shortcut case.
becw Feb 24, 2025
cbf098b
Working config.
becw Feb 24, 2025
b3bc54e
Full replacement for 'standard' install profile.
becw Feb 24, 2025
092c856
Don't create article content type/taxonomy because we won't use them …
becw Feb 25, 2025
a402c0a
Move recipes into the Drupal root because drush likes this location b…
becw Feb 25, 2025
7ede72b
Add a recipe readme.
becw Feb 25, 2025
aece789
Use the recipe version of the-build
becw Feb 25, 2025
ec39fa7
Base install
becw Feb 26, 2025
cc1178d
Start rebuilding the artifact creation script as a Composer script.
becw Feb 27, 2025
a507c03
next step
becw Feb 27, 2025
638107a
Add safeToBuild method
becw Feb 27, 2025
81edd0e
Another step
becw Feb 28, 2025
331994f
Hack it together
becw Feb 28, 2025
4b31db2
Force remove temporary branches
becw Mar 4, 2025
ca894a5
Mostly code style changes.
becw Mar 4, 2025
ef9a941
comment updates
becw Mar 4, 2025
c786574
empty commit
becw Mar 4, 2025
7aac42f
begin transformation to using an Artifact object (from procedural sty…
becw Mar 4, 2025
7b4532f
check for dirty source repo, update base branch. next: set up build b…
becw Mar 5, 2025
72a16b2
Move more steps out of procedural methods, but it's still kind of pro…
becw Mar 6, 2025
510d89e
last steps, some cleanup.
becw Mar 7, 2025
1375ba5
some comments
becw Mar 12, 2025
39452e0
Command line arguments.
becw Apr 11, 2025
e1945d4
Consolidate some IO handling and arguments.
becw Apr 11, 2025
b80f177
Code comments.
becw Apr 14, 2025
f1b639d
Use io instead of print.
becw Apr 14, 2025
f34487b
Refactor a bit; still waffling as to whether to remove the user promp…
becw Apr 14, 2025
027cdf9
Refactor into two methods.
becw Apr 14, 2025
53b8d47
Handle building from a detatched head/tag.
becw Apr 14, 2025
2ffa974
Update comments.
becw Apr 14, 2025
dedb54c
Allow running other composer commands as build steps.
becw Apr 14, 2025
84aa663
Cleanup
becw Apr 14, 2025
168b9af
Update comments
becw Apr 14, 2025
d0c7679
Fix bug where first clone would return the wrong type of object.
becw Apr 14, 2025
0f2a41e
Comments.
becw Apr 14, 2025
136636e
Remove debug output
becw Apr 14, 2025
494c531
Use new the-artifact repo
becw Apr 15, 2025
b3a8e51
Add debug script
becw Apr 16, 2025
b3273a6
Remove debug code.
becw Apr 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 53 additions & 46 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# This CircleCI configuration is for testing the drupal-skeleton. For project-specific
# testing, use the configuration installed by palantirnet/the-build.

version: 2.1
# To use browsers on CircleCI, uncomment the lines below and add steps to install them.
# For example, add these to `jobs.build.steps`:
# - browser-tools/install-chrome
# - browser-tools/install-chromedriver
# orbs:
# browser-tools: circleci/browser-tools@1.2.3
jobs:
build:
working_directory: ~/drupal-skeleton
Expand All @@ -16,39 +19,41 @@ jobs:

environment:
- PALANTIR_ENVIRONMENT: circleci
- DRUPAL_ROOT: web
- NODE_VERSION: 18
- DRUPAL_ROOT: docroot
- NODE_VERSION: 20

steps:
- run:
name: Install packages
command: sudo apt-get update && sudo apt-get install -y default-mysql-client
command: |
sudo apt-get update && sudo apt-get install -y libpng-dev default-mysql-client
- run:
name: Install nvm
command: |
set +e
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
touch $BASH_ENV
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
- run:
name: Configure PHP
command: |
echo "sendmail_path=/bin/true" | sudo tee -a "/etc/php.d/circleci.ini"
- run:
name: Update Composer
command: |
sudo composer self-update
- run:
name: Create artifacts directory
command: mkdir /tmp/artifacts
- run:
name: Configure URL in /etc/hosts
command: echo 127.0.0.1 ${CIRCLE_PROJECT_REPONAME}.local | sudo tee -a /etc/hosts
- run:
name: Update to latest version of Composer
command: sudo composer self-update

# Note: phing and drupal-check have mutually exclusive requirements.
# It'd be better to add drupal-check as a dependency of the drupal project
# rather than as part of the virtual environment, but this will have to do
# for now. Also note, drupal-check is added as part of the-vagrant so it
# is available to run within our VM.
- run:
name: Install drupal-check
command: |
curl -O -L https://github.com/mglaman/drupal-check/releases/download/1.0.9/drupal-check.phar
mkdir --parents ~/bin
mv drupal-check.phar ~/bin/drupal-check
chmod +x ~/bin/drupal-check
# Package cache
- restore_cache:
keys:
- package-cache-v1-

# Source cache
- restore_cache:
Expand All @@ -57,33 +62,31 @@ jobs:
- source-v1-

- checkout

# Source cache - update when branch changes
- save_cache:
key: source-v1-{{ .Branch }}
paths:
- ".git"

# Composer package cache
- restore_cache:
keys:
- composer-v1-

- run:
name: Composer install
command: composer install --no-interaction --prefer-dist
- run:
name: Yarn install
command: yarn install

# Composer package cache - update when the contents of the Composer cache directory
# change
- run: ls -1R ~/.cache/composer/ > /tmp/composer-cache.txt
# Package cache. This is updated when the contents of the ~/.cache directory change.
# Both Composer and Yarn use this directory.
- run: ls -1R ~/.cache/ > /tmp/package-cache.txt
- save_cache:
key: composer-v1-{{ checksum "/tmp/composer-cache.txt" }}
key: package-cache-v1-{{ checksum "/tmp/package-cache.txt" }}
paths:
- ~/.cache/composer
- ~/.cache

# Source cache. This is updated for each different branch.
- save_cache:
key: source-v1-{{ .Branch }}
paths:
- ".git"

# Run code reviews before installing Drupal, so that tests fail earlier.
- run:
name: Install the-build in the project
command: printf 'drupal-skeleton\nhttp://drupal-skeleton.local\npantheon\nn' | vendor/bin/the-build-installer
name: Run code reviews
command: vendor/bin/phing code-review

- run:
name: Wait for DB
Expand All @@ -95,15 +98,19 @@ jobs:
command: vendor/bin/phing build
- run:
name: Install Drupal
command: printf 'y' | vendor/bin/phing install -Ddrupal.validate_clean_config.bypass=yes -Ddrupal.sites.default.profile=standard
command: vendor/bin/phing install
- run:
name: Run any migrations
command: vendor/bin/phing migrate
- run:
name: Run Behat tests
command: |
cd ${DRUPAL_ROOT}
nohup php -S example.ddev.site:8000 .ht.router.php > /tmp/artifacts/phpd.log 2>&1 &
google-chrome --headless --remote-debugging-port=9222 &>/dev/null &
cd ..
vendor/bin/behat --profile=circleci --suite=default --strict --format=junit --out=/tmp/artifacts
cd ${DRUPAL_ROOT}
nohup php -S ${CIRCLE_PROJECT_REPONAME}.local:8000 .ht.router.php > /tmp/artifacts/phpd.log 2>&1 &
google-chrome --headless --remote-debugging-port=9222 &>/dev/null &
cd ..
vendor/bin/phing test

- store_artifacts:
path: /tmp/artifacts
- store_test_results:
Expand Down
66 changes: 66 additions & 0 deletions .circleci/deploy-acquia-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Example snippet for deploy job in config.yml. Add this code to deploy to Acquia. Update ACQUIA_PUBKEY
# with the entry from your known_hosts file for the Git remote host.
#
# You will also need to add a step to the build job to persist to workspace:
#
# - persist_to_workspace:
# root: ..
# paths:
# - project
#
# And, finally, add the new job to the workflow section:
#
# - deploy:
# requires:
# - build
# filters:
# branches:
# only:
# - develop

deploy:
working_directory: ~/project
docker:
- image: cimg/php:8.3-browsers
environment:
- NODE_VERSION: 20
- GITHUB_PUBKEY: "github.com,192.30.253.113 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="
- ACQUIA_PUBKEY: "svn-23450.prod.hosting.acquia.com,54.245.120.237 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDit0Rj8j59i9Gj2vOg2TXjIbPswIc27PwncapyBLi9R3FtECXq+md1BfykBJjME83m78CtqkTlWwNZu+LyhF+IYlshKo82JXQzV4kWwi5L9H7KpdyFDMDLVCNVYmU4EQY9ngRq1cwbMBYsfWxv4sSlbsvZv2C8U7luNoc4SiBY4sGpgiMJLFOHWRw6YvhOamLTKfxSoJUT8uRbfkamxas1EK21XjvrdUSN0Bf5LmTdvs/9iIaUH4AlYr0SW0tc2IbIuoFVxuvSzZj2GJjmtCcW1poDMQLTGq+EuO4Mk1WyoUSJC9L8CFonKH7++EPHopvIbPMinO4r2zLEot3lL5TH"

steps:
- attach_workspace:
at: ..
- add_ssh_keys
- run:
name: Install packages
command: sudo apt-get update && sudo apt-get install -y libpng-dev

- run:
name: Install nvm
command: |
set +e
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
touch $BASH_ENV
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
- run:
name: Configure PHP
command: |
echo "sendmail_path=/bin/true" | sudo tee -a "/etc/php.d/circleci.ini"
- run:
name: Configure Git
command: |
git config --global user.email "circle@palantir.net"
git config --global user.name "Circle Deploy"
- run:
name: Add public keys to known hosts file.
command: |
mkdir -p ~/.ssh
echo $GITHUB_PUBKEY >> ~/.ssh/known_hosts
echo $ACQUIA_PUBKEY >> ~/.ssh/known_hosts
- run:
name: Make sites/default writable for artifact build
command: chmod u+w docroot/sites/default
- run:
name: Build and deploy an artifact
command: vendor/bin/phing artifact -Dpush=y
72 changes: 72 additions & 0 deletions .circleci/deploy-pantheon.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Example snippet for deploy job in config.yml. Add this code to deploy to Pantheon.
# Update PANTHEON_PUBKEY with the entry from your known_hosts file for the code server.
# (To get the known_hosts entry, git clone the SSH URL of the Pantheon repository.)
#
# You will also need to add a step to the build job to persist to workspace:
#
# - persist_to_workspace:
# root: ..
# paths:
# - project
#
# And, finally, add the new job to the workflow section:
#
# - deploy:
# requires:
# - build
# filters:
# branches:
# only:
# - develop
# - master
# - /multidev-.*/

deploy:
working_directory: ~/project
docker:
- image: cimg/php:8.3-browsers
environment:
- NODE_VERSION: 20
- GITHUB_PUBKEY: "github.com,192.30.253.113 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="
- PANTHEON_PUBKEY: "[codeserver.dev.56f20816-b4b7-4517-a90f-667b4785708d.drush.in]:2222,[35.193.151.123]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSY3gnr0DrbqJJSnEFy6jazDmAdBm4Zs/EkWIQa7x31qgSYyYJMz5V+pk62lBf2BN42VtubwO83vW9G+yG2K1RGOvZJaK5GBvBb/Ws2ZPcp/4sNHpPzkdd75e5/Pk8AWA59XUbJcBWmrDrHMbWV1j2zqPPikxbqGeTTjSx4QR18LIRei5OwT6VQnaVnJqPAqFZ+oCbpr0DL96foL3UEY8EWT/6GH2cANEGZO4ppbhdDw4uG6TaI7S0lxWMQEVy+iwjCNH/nanjd73cwoYd90E0OVdgNDr3hVbIuE6sUW6UwlaAwuyOM/xJYPg1y0rF66958pyVJlZ9KD5A0kY3bHg7"

steps:
- attach_workspace:
at: ..
- add_ssh_keys
- run:
name: Install packages
command: sudo apt-get update && sudo apt-get install -y libpng-dev

- run:
name: Install nvm
command: |
set +e
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
touch $BASH_ENV
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
- run:
name: Configure PHP
command: |
echo "sendmail_path=/bin/true" | sudo tee -a "/etc/php.d/circleci.ini"
- run:
name: Configure Git
command: |
git config --global user.email "circle@palantir.net"
git config --global user.name "Circle Deploy"
- run:
name: Add public keys to known hosts file.
command: |
mkdir -p ~/.ssh
echo $GITHUB_PUBKEY >> ~/.ssh/known_hosts
echo $PANTHEON_PUBKEY >> ~/.ssh/known_hosts
- run:
name: Make sites/default writable for artifact build
command: chmod u+w web/sites/default
- run:
name: Build and deploy an artifact
command: |
# Shorten multidev branch names from 'multidev-foo' to 'foo', max 11 characters
ARTIFACT_BRANCH=$(echo ${CIRCLE_BRANCH} | sed -E 's/^(multidev-)?(.{1,11}).*/\2/')
vendor/bin/phing artifact -Dartifact.result=push -Dartifact.git.remote_branch=${ARTIFACT_BRANCH}
15 changes: 15 additions & 0 deletions .the-build/build.circleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# @file
# Configuration properties specific to the CircleCI environment.
drupal:
twig:
debug: false
sites:
default:
database:
database: circle_test
username: root
password: ""
host: 127.0.0.1

behat:
args: "--profile=circleci --suite=default --strict --format=junit --out=/tmp/artifacts --tags=~@skipci"
61 changes: 61 additions & 0 deletions .the-build/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# @file
# Default build configuration properties.
#
# This file may be customized for your project. The full set of default values can be
# found in the-build's repository.
# @see https://github.com/palantirnet/the-build/blob/release-2.0/defaults.yml

projectname: drupal-skeleton

# These properties are used when building the settings.php and settings.yml for your
# Drupal site, and by some of the targets in the default build.xml file.
# @see .the-build/drupal/services.build.yml
# @see .the-build/drupal/settings.build.php
build:
host: acquia

drupal:
root: "docroot"

twig:
debug: true

sites:
default:
# REQUIRED: Name of the sites subdirectory where the `settings.php` file
# should live.
dir: default

# REQUIRED: Your site's URI; the default should be the URI of your local
# development environment.
uri: "https://drupal-skeleton.ddev.site"

# OPTIONAL: Drupal hash salt defaults to "temporary".
hash_salt: "temporary"

# OPTIONAL: The Drupal database name defaults to the site's "dir" value.
database:
database: "db"

# Multisites created by `phing drupal-add-multisite` will be automatically added here.
# @multisite_placeholder@

# Defaults for all sites; these can be overridden for individual sites.
_defaults:
database:
username: "db"
password: "db"
host: "db"

# Putting these flags in configuration allows you to vary the behat configuration per
# environment. Sometimes, there are tests that are appropriate to skip on CI. Compare
# these values to the defaults in build.circleci.yml.
behat:
args: "--suite=default --strict"

# To build an artifact from your code, add the URL to your artifact git repository.
# @see https://github.com/palantirnet/the-build/blob/release-2.0/defaults.yml
#
# artifact:
# git:
# remote:
Loading