From c04fdf31408e47f5c23bcefa4bf5eb7193584006 Mon Sep 17 00:00:00 2001 From: Bec White Date: Wed, 11 Apr 2018 16:54:49 -0500 Subject: [PATCH 1/3] Test Circle 2.0 configuration. --- .circleci/config.yml | 27 ++++++++++++++++++++ circle.yml | 59 -------------------------------------------- 2 files changed, 27 insertions(+), 59 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 circle.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..be1a6bf --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,27 @@ +# This circle.yml is for testing the drupal-skeleton. For project-specific +# testing, use the circle.yml installed by palantirnet/the-build. + +version: 2 +jobs: + build: + working_directory: ~/drupal-skeleton + docker: + - image: circleci/php:7.1-node-browsers + - image: tkuchiki/delayed-mysql + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_ROOT_PASSWORD: '' + MYSQL_DATABASE: drupal + steps: + - checkout + - add_ssh_keys + - run: + name: Composer install + command: composer install --no-interaction + - run: + name: Wait for DB + # preinstalled in circleci/* docker image + command: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s + - run: + name: MySQL version + command: mysql --version diff --git a/circle.yml b/circle.yml deleted file mode 100644 index a4235f4..0000000 --- a/circle.yml +++ /dev/null @@ -1,59 +0,0 @@ -# This circle.yml is for testing the drupal-skeleton. For project-specific -# testing, use the circle.yml installed by palantirnet/the-build. - -machine: - hosts: - drupal-skeleton.local: 127.0.0.1 - php: - version: 7.1.9 - environment: - PALANTIR_ENVIRONMENT: circle - -general: - branches: - ignore: - - gh-pages - - /.*(readme|documentation).*/ - -dependencies: - pre: - # Configure PHP - - echo "sendmail_path=/bin/true" >> "/opt/circleci/php/$(phpenv version-name)/etc/php.ini" - - echo "date.timezone=America/Chicago" >> "/opt/circleci/php/$(phpenv version-name)/etc/php.ini" - - echo "memory_limit=256M" > "/opt/circleci/php/$(phpenv version-name)/etc/conf.d/memory.ini" - # Disable XDebug - - rm "/opt/circleci/php/$(phpenv global)/etc/conf.d/xdebug.ini" - - override: - - composer install --no-interaction - - cache_directories: - - ~/.composer - -test: - pre: - # Start the PHP development server - - nohup php -S localhost:8000 -t web/ > "${CIRCLE_ARTIFACTS}/phpd.log" 2>&1 & - - > - vendor/bin/phing -f vendor/palantirnet/the-build/tasks/install.xml - -Dbuild.artifact_mode=symlink - -Dbuild.test_output=/dev/null - -Ddrupal.site_name=drupal-skeleton - -Ddrupal.profile=standard - -Ddrupal.modules_enable='' - -Ddrupal.database.database=circle_test - -Ddrupal.database.username=ubuntu - -Ddrupal.database.password='' - -Ddrupal.database.host=127.0.0.1 - -Ddrupal.settings.file_public_path=sites/default/files - -Ddrupal.settings.file_private_path= - -Ddrupal.twig.debug=false - -Ddrupal.uri=http://drupal-skeleton.local - -Ddrupal.hash_salt=temporary - -Ddrupal.root=web - - vendor/bin/phing build - - vendor/bin/phing install - - vendor/bin/phing migrate - - override: - - vendor/bin/behat --profile=circleci --suite=default --strict --format=junit --out=$CIRCLE_TEST_REPORTS From f4203b0fd28ef5a5095e1ad75b156193b7ec3f61 Mon Sep 17 00:00:00 2001 From: Bec White Date: Wed, 11 Apr 2018 17:08:52 -0500 Subject: [PATCH 2/3] Update CircleCI config to install Drupal and run tests. --- .circleci/config.yml | 108 ++++++++++++++++++++++++++++++++++++++++--- behat.yml | 4 +- composer.json | 2 +- 3 files changed, 104 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index be1a6bf..afa1b0c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,17 +11,111 @@ jobs: environment: MYSQL_ALLOW_EMPTY_PASSWORD: yes MYSQL_ROOT_PASSWORD: '' - MYSQL_DATABASE: drupal + MYSQL_DATABASE: circle_test + + environment: + - PALANTIR_ENVIRONMENT: circle + steps: + - run: + name: Install packages + command: sudo apt-get install -y libpng-dev mysql-client + - 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" + - run: + name: PHP version + command: php -r 'phpinfo(INFO_GENERAL | INFO_CREDITS | INFO_CONFIGURATION | INFO_MODULES);' + - run: + name: Composer version + command: composer --version + - 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 + + # Composer package cache + - restore_cache: + keys: + - composer-v1- + # Source cache + - restore_cache: + keys: + - source-v1-{{ .Branch }} + - source-v1- + # Composer dependency cache + - restore_cache: + keys: + - dependencies-v1-{{ .Branch }}- + - checkout - - add_ssh_keys - run: - name: Composer install - command: composer install --no-interaction + name: Composer install / update + command: composer update --no-interaction --prefer-dist + + # Composer package cache - update when the contents of the Composer cache directory + # change + - run: ls -1R ~/.composer/cache/ > /tmp/composer-cache.txt + - save_cache: + key: composer-v1-{{ checksum "/tmp/composer-cache.txt" }} + paths: + - ~/.composer + # Source cache - update when branch changes + - save_cache: + key: source-v1-{{ .Branch }} + paths: + - ".git" + # Composer dependency cache - update for every commit, because when this cache gets + # polluted, builds will repeatedly fail. For this project, + # the entire web/ directory is set up by the composer install process. + - save_cache: + key: dependencies-v1-{{ .Branch }}-{{ .Revision }} + paths: + - composer.lock + - vendor + - web + - drush + - run: name: Wait for DB - # preinstalled in circleci/* docker image + # Dockerize is preinstalled in circleci/* docker image command: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s - run: - name: MySQL version - command: mysql --version + name: Install and configure the-build + command: > + vendor/bin/phing -f vendor/palantirnet/the-build/tasks/install.xml + -Dbuild.artifact_mode=symlink + -Dbuild.test_output=/dev/null + -Ddrupal.site_name=drupal-skeleton + -Ddrupal.profile=standard + -Ddrupal.modules_enable='' + -Ddrupal.database.database=circle_test + -Ddrupal.database.username=root + -Ddrupal.database.password='' + -Ddrupal.database.host=127.0.0.1 + -Ddrupal.settings.file_public_path=sites/default/files + -Ddrupal.settings.file_private_path= + -Ddrupal.twig.debug=false + -Ddrupal.uri=http://${CIRCLE_PROJECT_REPONAME}.local:8000 + -Ddrupal.hash_salt=temporary + -Ddrupal.root=web + - run: + name: Build Drupal's settings.php + command: vendor/bin/phing build + - run: + name: Install Drupal + command: vendor/bin/phing install + - run: + name: Run Behat tests + command: | + nohup php -S ${CIRCLE_PROJECT_REPONAME}.local:8000 -t $(pwd)/web/ > /tmp/artifacts/phpd.log 2>&1 & + vendor/bin/behat --profile=circle --suite=default --strict --format=junit --out=/tmp/artifacts + - store_artifacts: + path: /tmp/artifacts + - store_test_results: + path: /tmp/artifacts diff --git a/behat.yml b/behat.yml index 090e185..12146e9 100644 --- a/behat.yml +++ b/behat.yml @@ -30,7 +30,7 @@ default: region_map: anywhere: "*" -circleci: +circle: extensions: Behat\MinkExtension: - base_url: http://localhost:8000 + base_url: http://drupal-skeleton.local:8000 diff --git a/composer.json b/composer.json index bd8a1d6..75dee60 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "composer/installers": "^1.0", "drupal-composer/drupal-scaffold": "^2.3", "drupal/coder": "^8.0", - "drupal/config_installer": "^1.5", + "drupal/config_installer": "^1.7", "drupal/core": "^8.5" }, "require-dev": { From 3c32adcd330da383c0dcbc6e254d0ba4d40d223b Mon Sep 17 00:00:00 2001 From: Bec White Date: Mon, 16 Apr 2018 15:17:21 -0500 Subject: [PATCH 3/3] Update the required versions of the-build and the-vagrant. --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 75dee60..c0eca6a 100644 --- a/composer.json +++ b/composer.json @@ -39,8 +39,8 @@ "behat/mink-extension": "^2.2", "behat/mink-goutte-driver": "^1.2", "drupal/drupal-extension": "^3.1", - "palantirnet/the-build": "^1.5", - "palantirnet/the-vagrant": "^2.0" + "palantirnet/the-build": "^1.7", + "palantirnet/the-vagrant": "^2.0.1" }, "suggest": { "cweagans/composer-patches": "Try ^1.0. Apply patches to packages, especially Drupal.org contrib."