Integration with Travis CI is included, although Phing tasks can be used with any CI tool. The default Travis CI build process is as follows:
- Pull request or commit to GitHub triggers Travis CI.
.travis.yml
is read and executed by Travis CI. The environment is built by installing composer dependencies.- Travis CI begins a a build and calls various Phing targets.
You may add your own custom tasks to the build engine by defining new Phing targets in [build/custom/phing/build.xml] (custom/phing/build.xml).
You may override or define custom Phing properties in build/custom/phing/build.yml
By default, the Travis CI automated tests install and test your site from scratch. Once you have a production site in a remote environment, it’s recommended to also run automated tests against a copy of your production database, especially in order to functionally test update hooks.
Automated testing of live content is easy to set up with two simple steps:
-
Add the hostname of your staging server to .travis.yml:
ssh_known_hosts: - staging-12345.prod.hosting.acquia.com
-
Override the default
ci:build:validate:test
target by adding the following tobuild/custom/phing/build.xml
:<!-- Override the core ci:build:validate:test target to include a local refresh--> <target name="ci:build:validate:test" description="Builds, validates, tests, and deploys an artifact." depends="validate:all, ci:setup, tests:security-updates, tests:phpunit, local:sync, local:update, tests:behat" />
Travis CI can be used to deploy a fully built site artifact (with the docroot) in the following manner:
- A pull request is merged into the GitHub repository
- Travis builds the docroot
- Travis commits the docroot to a specific "build" branch and pushes to Acquia Cloud
To set up this workflow, you must configure Acquia Cloud, GitHub, and Travis CI to work together. Step-by-step instructions are provided below.
-
Generate an SSH key locally. E.g.,
cd ~/.ssh ssh-keygen -t rsa -b 4096
Do not use a passphrase!
-
Create a new Acquia Cloud account to be used exclusively as a container for the SSH keys that will grant Travis push access to Acquia Cloud. This can be done by inviting a new team member on the "Teams" tab in Acquia Cloud. You can use an email address like
<email>[email protected]
. The team member must have SSH push access. -
Login the your new Acquia Cloud account and add the public SSH key from the key pair that was generated in step 1 by visiting
https://accounts.acquia.com/account/[uid]/security
. -
Add the same public SSH key to the "Deployment Keys" section on your project's GitHub settings page, located at
https://github.com/acquia-pso/[project-name]/settings/keys
. -
Add the private SSH key to your project's Travis CI settings located at
https://magnum.travis-ci.com/acquia-pso/[project-name]/settings
. -
Uncomment the example deployment steps in your .travis.yml file and customize them to deploy your desired branch.
-
Add your cloud git repository to the remotes section of your project.yml file:
remotes: - [email protected]:example.git`
-
Add your cloud git repository's server host name to
ssh_known_hosts
in your .travis.yml file.addons: ssh_known_hosts: - svn-14671.prod.hosting.acquia.com
-
Commits or merges to the develop branch on GitHub should now trigger a fully built artifact to be deployed to your specified remotes.
For information on manually deploying your project, read deploy.md