GitHub

Note

This integration is available to our Enterprise users.

GitHub is a Git repository management and hosting platform for companies, individuals and Open-Source projects to collaborate, track bugs and review code.

Integrating Blackfire with GitHub enables you to automate the performance testing of your code any time you modify it.

Triggering Scenarios on Deployed Environments

Caution

The following options require that Backfire is able to reach the HTTP server serving the pull request version of the code.

The expected workflow is as follows:

  1. A developer in your team creates a Pull Request
  2. The Pull Request is automatically deployed
  3. Your tool chain triggers Blackfire to run your scenarios
  4. Blackfire sends a notification to GitHub that is displayed as a commit status on the corresponding Pull Request

Using the Plaform.sh Integration

Blackfire supports an integration with Platform.sh. Platform.sh can automatically deploy your GitHub Pull Requests and trigger Blackfire scenarios.

Using a Webhook

If your tool chain enables to deploy your code automatically at each new Pull Request, create a webhook payload that you will use (for instance with Jenkins, Travis,...) to let Blackfire run the test scenarios.

Please read the builds webhook documentation to configure them.

In order to make sure that GitHub can receive a notification back from Blackfire, please make sure to configure the following parameters:

endpoint (Mandatory) The endpoint to profile
title (Optional) A title for the build (e.g .the Pull Request reference or title)
external_id (Mandatory) The Git commit sha1 of the tip of the pull request
external_parent_id (Optional) The sha1 of the parent build. This is typically the sha1 of the base branch of the pull request.

The external_id will make it possible for Blackfire to point the build report notification to the correct commit. The external_parent_id will make it possible for you to write comparison assertions.

Triggering Scenarios on Non-Deployed Code

Using the PHP SDK

Blackfire's PHP SDK enables to test the performance of your code without deploying it. You will need to configure it to:

Setting up the GitHub Notification Channel

Anytime a build report is available, the GitHub notification channel will update the commit status on the corresponding Pull Request.

Note

You must make sure to create the webhook payload like described above.

To configure a GitHub notification channel:

  • Go to your personal settings in GitHub to create a new personal access token, and grant it the repo:status scope.
  • Go to the Dashboard Build tab of the related Blackfire environment and look for the Notification Channel section.
  • Add a new GitHub notification channel. The configuration simply requires the repository name (Example: username/project-name) and the GitHub Token to be able to post build statuses on pull requests.