Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refs #129: Adds drupal-check #133

Merged
merged 10 commits into from
Oct 18, 2019
9 changes: 9 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ jobs:
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.
- run:
name: Install drupal-check
command: composer global require mglaman/drupal-check

# Composer package cache
- restore_cache:
keys:
Expand Down
10 changes: 10 additions & 0 deletions defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,16 @@ phpmd:
# File extensions to review.
suffixes: php,inc,module,theme,profile,install,test

# 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.
drupal-check:
# Location of the drupal-check script. This script is currently installed globally
# because of repository-level composer conflicts.
bin: "~/bin/drupal-check"
# Comma separated list of directories
directories: "${drupal.root}/modules/custom/,${drupal.root}/themes/custom/,${drupal.root}/profiles/custom/"

# Configuration for running behat tests.
#
Expand Down
17 changes: 15 additions & 2 deletions defaults/install/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,22 @@
<property name="phpmd.command" value="vendor/bin/phpmd ${phpmd.directories} ${phpmd.format} ${phpmd.rulesets} --suffixes=${phpmd.suffixes}" />
<echo msg="$> ${phpmd.command}" />
<exec command="${phpmd.command}" logoutput="true" checkreturn="true" />

<!-- Run Drupal Check. -->
<foreach list="${drupal-check.directories}" param="drupal-check.dir" target="drupal-check" />
</target>


<!-- Separated out so that we can use foreach. drupal-check only accepts a single directory argument. -->
<target name="drupal-check">
<fail unless="drupal-check.dir" />
<property name="drupal-check.bin" value="~/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>


<!-- Target: code-fix -->
<target name="code-fix" description="Run the automated code fixer.">
<!-- Run PHP Code Beautifier and Fixer. -->
Expand All @@ -151,7 +164,7 @@
<exec command="${phpcbf.command}" logoutput="true" checkreturn="false" />
</target>


<!-- Target: artifact -->
<target name="artifact" description="Build and deploy the application.">
<phing phingfile="build.xml" target="artifact-main" inheritAll="false">
Expand Down
3 changes: 3 additions & 0 deletions defaults/install/the-build/build.circleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ drupal:

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

drupal-check:
bin: "/home/circleci/.composer/vendor/bin/drupal-check"
7 changes: 7 additions & 0 deletions defaults/install/the-build/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ 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