Skip to content

Commit

Permalink
Merge pull request #89 from palantirnet/circle-2.0
Browse files Browse the repository at this point in the history
Configuration for Circle 2.0
  • Loading branch information
becw authored Apr 16, 2018
2 parents 9577501 + 9c88ff3 commit 7a99d4b
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 48 deletions.
99 changes: 99 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
version: 2
jobs:
build:
working_directory: ~/@projectname@
docker:
- image: circleci/php:7.1-node-browsers
- image: tkuchiki/delayed-mysql
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_PASSWORD: ''
MYSQL_DATABASE: circle_test

environment:
- PALANTIR_ENVIRONMENT: circle
- DRUPAL_ROOT: web

branches:
ignore:
- gh-pages
- /.*(readme|documentation).*/

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-

- checkout
- run:
name: Composer install
command: composer install --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"

- 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
- run:
name: Install Drupal
command: vendor/bin/phing install
- run:
name: Run any migrations
command: vendor/bin/phing migrate
- run:
name: Run code reviews
command: vendor/bin/phing code-review
- 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
- store_artifacts:
path: /tmp/artifacts
- store_test_results:
path: /tmp/artifacts
36 changes: 36 additions & 0 deletions behat.dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
default:
suites:
default:
contexts:
- FeatureContext
- Drupal\DrupalExtension\Context\DrupalContext
- Drupal\DrupalExtension\Context\MinkContext
- Drupal\DrupalExtension\Context\MessageContext
- Drupal\DrupalExtension\Context\DrushContext
filters:
tags: "~@skipci"
gherkin:
cache: ~
extensions:
Behat\MinkExtension:
goutte: ~
selenium2:
wd_host: "http://127.0.0.1:8643/wd/hub"
javascript_session: selenium2
base_url: http://@[email protected]
Drupal\DrupalExtension:
blackbox: ~
api_driver: 'drupal'
drupal:
drupal_root: 'web'
text:
username_field: 'name'
password_field: 'pass'
log_out: 'Log out'
region_map:
anywhere: "*"

circle:
extensions:
Behat\MinkExtension:
base_url: http://@[email protected]:8000
45 changes: 0 additions & 45 deletions circle.dist.yml

This file was deleted.

9 changes: 9 additions & 0 deletions conf/build.circle.dist.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build.test_output=/tmp/artifacts
drupal.database.database=circle_test
drupal.database.username=root
drupal.database.password=
drupal.database.host=127.0.0.1

drupal.twig.debug=false

behat.args=--profile=circle --suite=default --strict --format=junit --out=${build.test_output} --tags=~@skipci
2 changes: 1 addition & 1 deletion tasks/boilerplate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<property name="prompt.build.artifact_mode" value="Artifact mode (copy,symlink)" />
<property name="default.build.artifact_mode" value="symlink" />

<property name="prompt.build.test_output" value="Test output directory (use ${env.CIRCLE_TEST_REPORTS} for Circle)" />
<property name="prompt.build.test_output" value="Test output directory (for example, use '/tmp/artifacts' on CircleCI)" />
<property name="default.build.test_output" value="/dev/null" />

<property name="update" value="build.artifact_mode,build.test_output" />
Expand Down
17 changes: 15 additions & 2 deletions tasks/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,28 @@
</filterchain>
</copy>

<!-- Copy the circle.yml -->
<copy file="${phing.dir.install}/../circle.dist.yml" tofile="${application.startdir}/circle.yml" overwrite="true">
<!-- Copy the behat template. -->
<copy file="${phing.dir.install}/../behat.dist.yml" tofile="${application.startdir}/behat.yml" overwrite="true">
<filterchain>
<replacetokens>
<token key="projectname" value="${projectname}"/>
</replacetokens>
</filterchain>
</copy>

<!-- Copy the CircleCI configuration -->
<copy todir="${application.startdir}/" overwrite="true">
<fileset dir="${phing.dir.install}/../" includes=".circleci/" />
<filterchain>
<replacetokens>
<token key="projectname" value="${projectname}"/>
</replacetokens>
</filterchain>
</copy>

<!-- Copy the CircleCI properties. -->
<copy file="${phing.dir.install}/../conf/build.circle.dist.properties" tofile="${application.startdir}/conf/build.circle.properties" overwrite="true" />

<!-- Copy the build configuration templates. -->
<mkdir dir="${application.startdir}/conf" />
<copy tofile="${application.startdir}/conf/apache.circle.conf" file="${phing.dir.install}/../conf/apache.circle.conf" overwrite="true" />
Expand Down

0 comments on commit 7a99d4b

Please sign in to comment.