From 9229e30e89d0d3ba92512fae4ad98837815f30b0 Mon Sep 17 00:00:00 2001 From: lukewertz Date: Wed, 12 Jun 2019 08:43:07 -0500 Subject: [PATCH 1/8] Refs #129: Adds Drupal Check. --- .circleci/config.yml | 60 +++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fd666c56..b0399eba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 jobs: build: - working_directory: ~/example + working_directory: ~/cleanup docker: - image: circleci/php:7.1-node-browsers - image: circleci/mysql:5.7-ram @@ -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: @@ -53,26 +62,10 @@ jobs: - source-v1-{{ .Branch }} - source-v1- - # Create a new project using the drupal-skeleton project - - run: - name: Create a new Drupal project - command: composer create-project palantirnet/drupal-skeleton example dev-drupal8 --no-interaction - working_directory: ~/ - - # Use this copy of the-build + - checkout - 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 - - # Source cache - update when branch changes - - save_cache: - key: source-v1-{{ .Branch }} - paths: - - ".git" - + name: Composer install + command: composer install --no-interaction --prefer-dist # Composer package cache - update when the contents of the Composer cache directory # change @@ -81,33 +74,36 @@ jobs: key: composer-v1-{{ checksum "/tmp/composer-cache.txt" }} paths: - ~/.composer + # Source cache - update when branch changes + - save_cache: + key: source-v1-{{ .Branch }} + paths: + - ".git" - - # Install the-build + # Run code reviews before installing Drupal, so that tests fail earlier. - run: - name: Install the-build in the project - command: printf 'http://the-build.local\nother\nn' | vendor/bin/the-build-installer + name: Run code reviews + command: vendor/bin/phing code-review - run: name: Wait for DB # Dockerize is preinstalled in circleci/* docker image command: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s - # Install Drupal (separately, so that we can see it fail separately) + - run: + name: Build Drupal's settings.php + command: vendor/bin/phing build - run: name: Install Drupal - command: printf 'y' | vendor/bin/phing install -Ddrupal.validate_clean_config.bypass=yes - - # Add a multisite + command: vendor/bin/phing install - run: - name: Add a multisite to the project - command: printf 'intranet\nintranet.the-build.local' | vendor/bin/phing drupal-add-multisite - + name: Run any migrations + command: vendor/bin/phing migrate - run: name: Run Behat tests command: | nohup php -S ${CIRCLE_PROJECT_REPONAME}.local:8000 -t $(pwd)/${DRUPAL_ROOT}/ > /tmp/artifacts/phpd.log 2>&1 & - vendor/bin/phing test -Dbuild.env=circleci + vendor/bin/phing test - store_artifacts: path: /tmp/artifacts From 793b1a6212c1d57ed4c0740d9372d4bc1eedf4a3 Mon Sep 17 00:00:00 2001 From: lukewertz Date: Wed, 12 Jun 2019 08:48:40 -0500 Subject: [PATCH 2/8] Refs #129: Clean the CircleCI Config file. I had accidentally pushed the CircleCI config file from my test project. This commit resets everything but the drupal-check piece. --- .circleci/config.yml | 51 +++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b0399eba..1a76ba80 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 jobs: build: - working_directory: ~/cleanup + working_directory: ~/example docker: - image: circleci/php:7.1-node-browsers - image: circleci/mysql:5.7-ram @@ -62,10 +62,26 @@ jobs: - source-v1-{{ .Branch }} - source-v1- - - checkout + # Create a new project using the drupal-skeleton project - run: - name: Composer install - command: composer install --no-interaction --prefer-dist + name: Create a new Drupal project + command: composer create-project palantirnet/drupal-skeleton example dev-drupal8 --no-interaction + working_directory: ~/ + + # 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 + + # Source cache - update when branch changes + - save_cache: + key: source-v1-{{ .Branch }} + paths: + - ".git" + # Composer package cache - update when the contents of the Composer cache directory # change @@ -74,36 +90,33 @@ jobs: key: composer-v1-{{ checksum "/tmp/composer-cache.txt" }} paths: - ~/.composer - # Source cache - update when branch changes - - save_cache: - key: source-v1-{{ .Branch }} - paths: - - ".git" - # Run code reviews before installing Drupal, so that tests fail earlier. + + # Install the-build - run: - name: Run code reviews - command: vendor/bin/phing code-review + name: Install the-build in the project + command: printf 'http://the-build.local\nother\nn' | vendor/bin/the-build-installer - run: name: Wait for DB # Dockerize is preinstalled in circleci/* docker image command: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s - - run: - name: Build Drupal's settings.php - command: vendor/bin/phing build + # Install Drupal (separately, so that we can see it fail separately) - run: name: Install Drupal - command: vendor/bin/phing install + command: printf 'y' | vendor/bin/phing install -Ddrupal.validate_clean_config.bypass=yes + + # Add a multisite - run: - name: Run any migrations - command: vendor/bin/phing migrate + name: Add a multisite to the project + command: printf 'intranet\nintranet.the-build.local' | vendor/bin/phing drupal-add-multisite + - run: name: Run Behat tests command: | nohup php -S ${CIRCLE_PROJECT_REPONAME}.local:8000 -t $(pwd)/${DRUPAL_ROOT}/ > /tmp/artifacts/phpd.log 2>&1 & - vendor/bin/phing test + vendor/bin/phing test -Dbuild.env=circleci - store_artifacts: path: /tmp/artifacts From f3e1298867a1e9d30df3f885955a58eb5333f880 Mon Sep 17 00:00:00 2001 From: Patrick Weston Date: Fri, 23 Aug 2019 17:10:55 -0400 Subject: [PATCH 3/8] Update defaults.yml --- defaults.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/defaults.yml b/defaults.yml index b3007189..34cc1c8c 100644 --- a/defaults.yml +++ b/defaults.yml @@ -250,6 +250,13 @@ 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 build.dist.xml template: +drupal-check: + # Space seperated list of directories + directories: "${drupal.root}/modules/custom/ ${drupal.root}/themes/custom/ ${drupal.root}/profiles/custom/" # Configuration for running behat tests. # From f35fceea8e3c460581ed5c6ae5d02541078bbed8 Mon Sep 17 00:00:00 2001 From: Patrick Weston Date: Fri, 23 Aug 2019 17:14:16 -0400 Subject: [PATCH 4/8] Update build.xml --- defaults/install/build.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/defaults/install/build.xml b/defaults/install/build.xml index f5988085..7f956fb9 100644 --- a/defaults/install/build.xml +++ b/defaults/install/build.xml @@ -140,6 +140,11 @@ + + + + + From 62ae8f5c986f078cf5da50c36af76afa926ef048 Mon Sep 17 00:00:00 2001 From: Patrick Weston Date: Fri, 23 Aug 2019 17:45:51 -0400 Subject: [PATCH 5/8] Update build.xml --- defaults/install/build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/install/build.xml b/defaults/install/build.xml index 7f956fb9..66fd4a73 100644 --- a/defaults/install/build.xml +++ b/defaults/install/build.xml @@ -142,7 +142,7 @@ - + From be46584301186bc3f655e90c6151e2565786f01b Mon Sep 17 00:00:00 2001 From: lukewertz Date: Fri, 6 Sep 2019 16:18:41 -0400 Subject: [PATCH 6/8] Refs #129 - Try different drupal-check command. --- defaults/install/build.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/defaults/install/build.xml b/defaults/install/build.xml index 66fd4a73..ff919b1a 100644 --- a/defaults/install/build.xml +++ b/defaults/install/build.xml @@ -140,14 +140,14 @@ - + - + - + @@ -156,7 +156,7 @@ - + From 68566b8c1c6a0fc778de7efd96baaef3dc6c8419 Mon Sep 17 00:00:00 2001 From: lukewertz Date: Fri, 6 Sep 2019 16:37:54 -0400 Subject: [PATCH 7/8] Refs #129 - Use drupal-check from global. --- defaults/install/build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/install/build.xml b/defaults/install/build.xml index ff919b1a..51cf66b7 100644 --- a/defaults/install/build.xml +++ b/defaults/install/build.xml @@ -142,7 +142,7 @@ - + From 40d966ef116e4ff1cc228dafde27a3355cb3a20f Mon Sep 17 00:00:00 2001 From: Bec White Date: Fri, 18 Oct 2019 13:33:34 -0500 Subject: [PATCH 8/8] Update drupal-check usage so that it works on local environments as well. --- defaults.yml | 9 ++++++--- defaults/install/build.xml | 10 +++++++++- defaults/install/the-build/build.circleci.yml | 3 +++ defaults/install/the-build/build.yml | 7 +++++++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/defaults.yml b/defaults.yml index 34cc1c8c..abdc0fe3 100644 --- a/defaults.yml +++ b/defaults.yml @@ -253,10 +253,13 @@ 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 build.dist.xml template: +# These values are used in the defaults/build.xml template. drupal-check: - # Space seperated list of directories - directories: "${drupal.root}/modules/custom/ ${drupal.root}/themes/custom/ ${drupal.root}/profiles/custom/" + # 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. # diff --git a/defaults/install/build.xml b/defaults/install/build.xml index 51cf66b7..98c6d87e 100644 --- a/defaults/install/build.xml +++ b/defaults/install/build.xml @@ -142,7 +142,15 @@ - + + + + + + + + + diff --git a/defaults/install/the-build/build.circleci.yml b/defaults/install/the-build/build.circleci.yml index e122e1af..1a2d4620 100644 --- a/defaults/install/the-build/build.circleci.yml +++ b/defaults/install/the-build/build.circleci.yml @@ -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" diff --git a/defaults/install/the-build/build.yml b/defaults/install/the-build/build.yml index b536351b..e50c19cc 100644 --- a/defaults/install/the-build/build.yml +++ b/defaults/install/the-build/build.yml @@ -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 #