GitHub Actions support for Blackfire
Announcing the support of GitHub Actions for Blackfire.
Nowadays, GitHub Actions is a major player in the CI/CD world. It perfectly integrates with GitHub ecosystem and makes it easy to define a workflow for testing, building, and deploying your applications.
In this context, we are thrilled to announce the support of GitHub Actions support for Blackfire, for all supported languages (PHP, Python and Go). This was made possible thanks to the great work of Shivam Mathur on the setup-php
action.
Here is a quick example of Blackfire usage with GitHub Actions:
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Setup Blackfire via setup-php Action uses: shivammathur/setup-php@v2 with: # PHP Only: Setup PHP extensions, including Blackfire Probe. # It is recommended to disable xdebug. # Not needed for other languages. extensions: blackfire, :xdebug # Setup Blackfire Agent and CLI tool + Blackfire Player tools: blackfire, blackfire-player env: # Expose your Blackfire credentials stored in secrets # as environment variables. BLACKFIRE_SERVER_ID: ${{ secrets.BLACKFIRE_SERVER_ID }} BLACKFIRE_SERVER_TOKEN: ${{ secrets.BLACKFIRE_SERVER_TOKEN }} BLACKFIRE_CLIENT_ID: ${{ secrets.BLACKFIRE_CLIENT_ID }} BLACKFIRE_CLIENT_TOKEN: ${{ secrets.BLACKFIRE_CLIENT_TOKEN }} # Trigger a profile using Blackfire CLI tool. - name: Profile a command env: APP_ENV: prod APP_DEBUG: 0 run: blackfire run php bin/console app:list-users # Other example using Python: #run: blackfire run python my_script.py
But this action is designed for PHP! You said that Blackfire integrates with GitHub actions for all supported languages 🤔.
It is indeed correct that the setup-php
action is designed for PHP apps. However, all Blackfire components are made available by this action, including Blackfire agent, blackfire
CLI tool and blackfire-player
(which requires PHP). This makes it possible to use Blackfire with other languages such as Python or Go.
You can now enjoy the simplicity of GitHub Actions together with the power of profiling with Blackfire!
Happy profiling!