Files
setup-php/examples/blackfire.yml
Shivam Mathur 90d81e2adc Update examples
2026-03-21 21:47:58 +05:30

50 lines
1.8 KiB
YAML

# GitHub Action for Blackfire
name: Profiling with blackfire
on: [push, pull_request]
jobs:
blackfire:
name: Blackfire (PHP ${{ matrix.php-versions }})
# Add your Blackfire credentials securely using GitHub Secrets
env:
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 }}
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['8.3', '8.4', '8.5']
# Blackfire supports the current PHP releases on Ubuntu, macOS, and Windows.
steps:
- name: Checkout
uses: actions/checkout@v6
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
# Setup Blackfire extension and CLI.
extensions: blackfire, :xdebug
tools: blackfire
# Disable Xdebug and PCOV coverage drivers
coverage: none
# Refer to https://blackfire.io/docs/cookbooks/profiling-cli
- name: Profile
shell: bash
run: |
set +e
output=$(blackfire run php my-script.php 2>&1)
exit_code=$?
printf '%s\n' "$output"
if [ "$exit_code" -ne 0 ]; then
if printf '%s' "$output" | grep -q "upgrade your subscription"; then
echo "Blackfire profiling reached the repository quota limit; treating this as a known non-fatal condition."
exit 0
fi
exit "$exit_code"
fi