GitHub Pantheon GitHub Actions

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.

circle-info

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

Pantheon has its own repository example-drops-8-composerarrow-up-right 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

  3. Trigger creation of the multidev environment for the new branch

  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/masterarrow-up-right

There is a great article by Tyler Faheyarrow-up-right going deep into setting up similar configuration.

GitHub Actions secrets

DIFFY_API_KEY to be generated from https://app.diffy.website/#/keysarrow-up-right

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

PANTHEON_MACHINE_TOKEN to be generated in your Pantheon account under Personal Settings / Machine Tokensarrow-up-right

KNOWN_HOSTS an empty variable required by shimataro/ssh-key-action@v2 step to populate ssh key to container

PANTHEON_REPO URL to Pantheon's git repo (example ssh://codeserver.dev.51b73-XXX-b1f@codeserver.dev.51b-XXX-37cefb1f.drush.in:2222/~/repository.git)

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

PANTHEON_SSH_KEY private ssh key to connect to Pantheon so we can push the code to Pantheon's git repo. See section below.

SSH_CONFIG value is below. Used for connecting to Pantheon's git repo.

PANTHEON_SSH_KEY key for git push

You can generate a key pair with

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

Copy the private key (/tmp/new_key_for_ci) and add it as PANTHEON_SSH_KEY secret in GitHub Actions.

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-testingarrow-up-right

Full code

Pay attention that we check if we didn't reach the limit of number of multidev environments.

Last updated