CircleCI

CircleCI is a continuous integration platform that integrates with GitHub, Bitbucket, AWS and many more services.

If you want to run your PHPUnit tests or your Blackfire Player scenarios on CircleCI, read on to learn more about how to configure it.

Configuring the Project

To set up Blackfire on CircleCI, your need to define some environment variables in the build settings of your project.

Define environment variables for your Client credentials:

or to display your Blackfire's credentials.

Define environment variables for the Server credentials. Choose the credentials you want to use:

or to display your Blackfire's credentials.

Using the Blackfire Orb

In order to ease the integration with your CircleCI workflows, Blackfire provides an orb via the CircleCI Orb registry.

To use the Blackfire orb, you need to allow the use 3rd party orbs; this must be done on the Settings > Security page for your organization.

Note

This operation needs to be done by an administrator of your CircleCI organization.

Here is a configuration snippet using the Blackfire orb:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
version: 2.1

orbs:
    blackfire: blackfireio/php@0.1.0

jobs:
    build:
        docker:
            # You may use another Docker image.
            - image: circleci/php:7.3-node

        steps:
            - checkout

            - blackfire/setup

            - run:
                name: Tests
                environment:
                    APP_DEBUG: 0
                command: php bin/phpunit

            - run:
                name: Blackfire player scenarios
                command: blackfire-player run my_scenario.bkf --blackfire-env=${BLACKFIRE_SERVER_ID}

Running Blackfire from CircleCI builds requires to import the blackfireio/php orb and to run the setup command, right after the code checkout. The command will install the probe, the agent, and the player.

Note

Using orbs requires to use version 2.1 of the CircleCI DSL. If your project was added to CircleCI prior to 2.1, you must enable "pipelines" in Your Project > Settings > Advanced Settings.

Note

The snippet above works with any Docker image provided by CircleCI as they are based on official PHP Debian images.

It also works when using the "machine" executor.