GitHub Pantheon CircleCI

Pantheon Multidev allows you to spin environments on demand for your branches. So we could use those for creating environments per pull request and test them visually with Diffy.

Please bear in mind that Pantheon limits you with the number of environments you can create

Pantheon has its own repository example-drops-8-composer with the example setup of the CI to build the environments. In our example, we start from scratch with a clean Pantheon's project.

The basic workflow is:

  1. Pull request created in GitHub

  2. Branch copied to Pantheon git repo (uses Pantheon's CircleCI orb)

  3. Trigger creation of the multidev environment for the new branch (uses Pantheon's CircleCI orb)

  4. Run all post-deployment jobs (clear caches, import configuration, updatedb)

  5. Trigger visual regression testing

  6. Post results back to GitHub as a check

Our repo with all the configuration set is https://github.com/DiffyWebsite/diffy-multidev/tree/master

CircleCI variables

These can be set up in the settings of your CircleCI project under Environmental Variables.

DIFFY_API_KEY to be generated from https://app.diffy.website/#/keys

DIFFY_PROJECT_ID it is your project id. You can find it under project settings, General tab

TERMINUS_TOKEN to be generated in your Pantheon account under Personal Settings / Machine Tokens

TERMINUS_SITE machine name of your Pantheon's site. You can find in the list of all sites under your account.

SSH key for git push

The only last thing you would need to do is to generate an ssh key and set in up in CircleCI and Pantheon so CircleCI can push the code to Pantheon's repo.

Here are steps from instructions on Pantheon's CircleCI orb:

Copy the public key (/tmp/new_key_for_ci.pub) and add it to your Pantheon's SSH keys.

Copy the private key (/tmp/new_key_for_ci) and add it to your CircleCI Project settings / Additional SSH Keys section. Set the hostname as drush.in

Diffy configuration

In order for Diffy to post results back to GitHub as a check you need to add github repo to Diffy's Project settings under Notifications / GitHub and authenticate Diffy's GitHub check by visiting https://github.com/apps/diffy-testing

Complete code example

Last updated