Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into fail-on-build-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
byrond committed Jul 8, 2022
2 parents ce80249 + b1f0714 commit c3613be
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 96 deletions.
36 changes: 10 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# This CircleCI configuration is for testing the-build itself. For the configuration
# installed in projects, see defaults/install/.circleci/config.yml

version: 2
version: 2.1
jobs:
build:
working_directory: ~/example
docker:
- image: circleci/php:7.4-node-browsers
- image: circleci/mysql:5.7-ram
- image: cimg/php:7.4-browsers
- image: cimg/mysql:5.7
command: --max_allowed_packet=16M
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
Expand All @@ -22,35 +22,22 @@ jobs:
- run:
name: Install packages
command: |
sudo apt-get update
sudo apt-get install -y libpng-dev default-mysql-client
- run:
name: Install PHP extensions
command: sudo docker-php-ext-install pdo_mysql gd
sudo apt-get update && sudo apt-get install -y libpng-dev default-mysql-client
- run:
name: Configure PHP
command: |
echo "sendmail_path=/bin/true" | sudo tee -a "/usr/local/etc/php/php.ini"
echo "memory_limit=-1" | sudo tee -a "/usr/local/etc/php/php.ini"
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 example.ddev.site | sudo tee -a /etc/hosts

# 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.
# Note 2: drupal-check is pinned to a known stable version.
- run:
name: Install drupal-check
command: |
composer global require mglaman/drupal-check
ln -s ~/.config/composer/vendor/bin ~/bin
# Composer package cache
- restore_cache:
keys:
Expand All @@ -70,10 +57,7 @@ jobs:
# Use this copy of the-build
- run:
name: Replace the default version of the-build with this one
command: rm -r vendor/palantirnet/the-build

- checkout:
path: ~/example/vendor/palantirnet/the-build
command: composer require --dev --with-all-dependencies palantirnet/the-build:dev-${CIRCLE_BRANCH}

# Source cache - update when branch changes
- save_cache:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ _Note: If you are starting a new a project, you may be looking for the [drupal-s
$> composer require palantirnet/the-build
```

Composer 2.2.2 or greater is required for the-build.

## Setting up

Install the default templates and phing targets to your project:
Expand Down
25 changes: 11 additions & 14 deletions bin/the-build-installer
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
#!/bin/sh
#
# Wrapper for our install command; at least this way it's somewhat discoverable.
# Previously:
#
# The install command boils down to:
# vendor/bin/phing -f vendor/palantirnet/the-build/targets/install.xml
#
# * This script requires Composer 2.2.2 or greater, because of a series of script proxying
# changes between 2.1.x and 2.2.2. This requirement is enforced in composer.json.
# * This script assumes the composer bin dir is at vendor/bin/

# Relative path to this script.
SCRIPT=$(readlink "$0")

# Absolute path to this script's parent directory.
SCRIPTPATH=$(cd `dirname $0` && cd `dirname $SCRIPT` && pwd)

REPOPATH=$(cd `dirname $SCRIPTPATH` && cd ../../../ && pwd)

if [ "$REPOPATH" = `pwd` ]; then
# Run our install task.
$SCRIPTPATH/../../../bin/phing -f $SCRIPTPATH/../targets/install.xml
else
echo "Please run this command from your project root."
# Composer 2.2.2 through 2.2.6
if [ "$COMPOSER_BIN_DIR" != "" ]; then
COMPOSER_RUNTIME_BIN_DIR="$COMPOSER_BIN_DIR"
fi

(cd $COMPOSER_RUNTIME_BIN_DIR/../../ && $COMPOSER_RUNTIME_BIN_DIR/phing -f $COMPOSER_RUNTIME_BIN_DIR/../palantirnet/the-build/targets/install.xml)
11 changes: 9 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,29 @@
"bin/the-build-installer"
],
"require": {
"composer-runtime-api": "^2.2.2",
"cweagans/composer-patches": "^1.7",
"drupal/coder": "^8.3.6",
"drush/drush": "^9 || ^10",
"mglaman/drupal-check": "^1.2",
"palantirnet/phing-drush-task": "^1.1",
"pear/http_request2": "^2.3",
"pear/versioncontrol_git": "@dev",
"phing/phing": "^2.14",
"phpmd/phpmd": "^2.4"
"phpmd/phpmd": "^2.4",
"phpspec/prophecy-phpunit": "^2"
},
"autoload": {
"psr-0": {
"TheBuild\\": "src/"
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"cweagans/composer-patches": true
}
},
"extra": {
"patches": {
Expand Down
8 changes: 4 additions & 4 deletions defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ phpmd:
# Configuration for checking the site with the Drupal Checker code linter.
#
# @see https://github.com/mglaman/drupal-check
# These values are used in the defaults/build.xml template.
# @see defaults/build.xml
drupal-check:
# Location of the drupal-check script. This script is currently installed globally
# because of repository-level composer conflicts.
bin: "~/bin/drupal-check"
# Location of the drupal-check script. This shouldn't need to be overridden,
# but it is used in the defaults/build.xml template.
bin: "vendor/bin/drupal-check"
# Comma separated list of directories
directories: "${drupal.root}/modules/custom/,${drupal.root}/themes/custom/"

Expand Down
39 changes: 15 additions & 24 deletions defaults/install/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
version: 2
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/[email protected]
jobs:
build:
working_directory: ~/${projectname}
docker:
- image: circleci/php:7.3-node-browsers
- image: circleci/mysql:5.7-ram
- image: cimg/php:7.4-browsers
- image: cimg/mysql:5.7
command: --max_allowed_packet=16M
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
Expand All @@ -20,8 +26,7 @@ jobs:
- run:
name: Install packages
command: |
sudo apt-get update
sudo apt-get install -y libpng-dev default-mysql-client
sudo apt-get update && sudo apt-get install -y libpng-dev default-mysql-client
- run:
name: Install nvm
command: |
Expand All @@ -30,35 +35,21 @@ jobs:
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: Install PHP extensions
command: sudo docker-php-ext-install pdo_mysql gd
- run:
name: Configure PHP
command: |
echo "sendmail_path=/bin/true" | sudo tee -a "/usr/local/etc/php/php.ini"
echo "memory_limit=-1" | sudo tee -a "/usr/local/etc/php/php.ini"
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

# 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.
# Note 2: drupal-check is pinned to a known stable version.
- 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
# Composer package cache
- restore_cache:
keys:
Expand Down
9 changes: 3 additions & 6 deletions defaults/install/.circleci/deploy-acquia-example
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
deploy:
working_directory: ~/project
docker:
- image: circleci/php:7.2-node-browsers
- image: cimg/php:7.4-browsers
environment:
- NODE_VERSION: 8
- GITHUB_PUBKEY: "github.com,192.30.253.113 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="
Expand All @@ -33,7 +33,7 @@
- add_ssh_keys
- run:
name: Install packages
command: sudo apt-get install -y libpng-dev
command: sudo apt-get update && sudo apt-get install -y libpng-dev

- run:
name: Install nvm
Expand All @@ -43,13 +43,10 @@
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: Install PHP extensions
command: sudo docker-php-ext-install gd
- run:
name: Configure PHP
command: |
echo "memory_limit=-1" | sudo tee -a "/usr/local/etc/php/php.ini"
echo "sendmail_path=/bin/true" | sudo tee -a "/etc/php.d/circleci.ini"
- run:
name: Configure Git
command: |
Expand Down
9 changes: 3 additions & 6 deletions defaults/install/.circleci/deploy-pantheon.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
deploy:
working_directory: ~/project
docker:
- image: circleci/php:7.2-node-browsers
- image: cimg/php:7.4-browsers
environment:
- NODE_VERSION: 8
- GITHUB_PUBKEY: "github.com,192.30.253.113 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="
Expand All @@ -35,7 +35,7 @@
- add_ssh_keys
- run:
name: Install packages
command: sudo apt-get install -y libpng-dev
command: sudo apt-get update && sudo apt-get install -y libpng-dev

- run:
name: Install nvm
Expand All @@ -45,13 +45,10 @@
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: Install PHP extensions
command: sudo docker-php-ext-install gd
- run:
name: Configure PHP
command: |
echo "memory_limit=-1" | sudo tee -a "/usr/local/etc/php/php.ini"
echo "sendmail_path=/bin/true" | sudo tee -a "/etc/php.d/circleci.ini"
- run:
name: Configure Git
command: |
Expand Down
5 changes: 3 additions & 2 deletions defaults/install/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@

<!-- Target: behat -->
<target name="behat" description="Run the Behat tests.">
<property name="behat.command" value="vendor/bin/behat ${behat.args}" />
<property name="behat.command" value="${behat.bin} ${behat.args}" />
<echo msg="$> ${behat.command}" />
<exec command="${behat.command}" logoutput="true" checkreturn="true" />
</target>
Expand Down Expand Up @@ -134,8 +134,9 @@
<!-- Separated out so that we can use foreach. drupal-check only accepts a single directory argument. -->
<target name="drupal-check" hidden="true">
<fail unless="drupal-check.dir" />
<property name="drupal-check.bin" value="~/bin/drupal-check" />
<property name="drupal-check.bin" value="vendor/bin/drupal-check" />
<property name="drupal-check.command" value="${drupal-check.bin} ${drupal-check.dir}" />

<echo msg="$> ${drupal-check.command}" />
<exec command="${drupal-check.command}" logoutput="true" checkreturn="true" />
</target>
Expand Down
3 changes: 0 additions & 3 deletions defaults/install/the-build/build.circleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ drupal:

behat:
args: "--profile=circleci --suite=default --strict --format=junit --out=/tmp/artifacts --tags=~@skipci"

drupal-check:
bin: "/home/circleci/bin/drupal-check"
7 changes: 0 additions & 7 deletions defaults/install/the-build/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ drupal:
behat:
args: "--suite=default --strict"

# Configuration for checking the site with the Drupal Checker code linter.
drupal-check:
# Location of the drupal-check script. This script is currently installed globally
# on the-vagrant because of repository-level composer conflicts.
bin: "~/bin/drupal-check"


# 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
#
Expand Down
7 changes: 5 additions & 2 deletions targets/the-build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@
<!-- Use the project directory name as the project name, if it's not configured. -->
<basename property="projectname" file="${build.dir}" suffix="local" />

<!-- Configure the 'drush' Phing task. By default, we run the installed drush. -->
<!-- Configure binaries to run depending on whether we're inside of ddev or out. -->
<property name="drush.bin" value="${build.dir}/vendor/bin/drush" />
<!-- If this is a ddev project, and we're outside of ddev, run ddev's drush command instead. -->
<property name="behat.bin" value="${build.dir}/vendor/bin/behat" />

<!-- If this is a ddev project, and we're outside of ddev, run these commands within ddev. -->
<exec command="which ddev" returnProperty="which_ddev" />
<if>
<and>
Expand All @@ -99,6 +101,7 @@
</and>
<then>
<property name="drush.bin" value="ddev drush" override="true" />
<property name="behat.bin" value="ddev . vendor/bin/behat" override="true" />
</then>
</if>

Expand Down

0 comments on commit c3613be

Please sign in to comment.