Improve blackfire examples

This commit is contained in:
Shivam Mathur 2020-02-28 15:42:17 +05:30
parent acee5b203f
commit 2b0d6e221f
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
3 changed files with 47 additions and 16 deletions

View File

@ -470,6 +470,8 @@ Examples for setting up this GitHub Action with different PHP Frameworks/Package
|Framework/Package|Runs on|Workflow|
|--- |--- |--- |
|Blackfire|`macOS`, `ubuntu` and `windows`|[blackfire.yml](./examples/blackfire.yml "GitHub Action using Blackfire")|
|Blackfire Player|`macOS`, `ubuntu` and `windows`|[blackfire-player.yml](./examples/blackfire-player.yml "GitHub Action using Blackfire Player")|
|CakePHP with `MySQL` and `Redis`|`ubuntu`|[cakephp-mysql.yml](./examples/cakephp-mysql.yml "GitHub Action for CakePHP with MySQL and Redis")|
|CakePHP with `PostgreSQL` and `Redis`|`ubuntu`|[cakephp-postgres.yml](./examples/cakephp-postgres.yml "GitHub Action for CakePHP with Postgres and Redis")|
|CakePHP without services|`macOS`, `ubuntu` and `windows`|[cakephp.yml](./examples/cakephp.yml "GitHub Action for CakePHP without services")|
@ -491,7 +493,6 @@ Examples for setting up this GitHub Action with different PHP Frameworks/Package
|Yii2 Starter Kit with `MySQL`|`ubuntu`|[yii2-mysql.yml](./examples/yii2-mysql.yml "GitHub Action for Yii2 Starter Kit with MySQL")|
|Yii2 Starter Kit with `PostgreSQL`|`ubuntu`|[yii2-postgres.yml](./examples/yii2-postgres.yml "GitHub Action for Yii2 Starter Kit with PostgreSQL")|
|Zend Framework|`macOS`, `ubuntu` and `windows`|[zend-framework.yml](./examples/zend-framework.yml "GitHub Action for Zend Framework")|
|Blackfire|`macOS`, `ubuntu` and `windows`|[blackfire.yml](./examples/blackfire.yml "GitHub Action using blackfire")|
## :scroll: License

View File

@ -0,0 +1,31 @@
# GitHub Action for Blackfire Player
name: Play a Blackfire Scenario
on: [push, pull_request]
jobs:
blackfire-player:
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: ['7.2', '7.3', '7.4']
# blackfire-player supports PHP >= 5.5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: blackfire
tools: blackfire, blackfire-player #Setup Blackfire client, agent and player
coverage: none
- name: Play the scenario
run: blackfire-player run scenario.bkf # Refer to https://blackfire.io/docs/player/index#usage

View File

@ -1,23 +1,22 @@
# GitHub Action for blackfire
# GitHub Action for Blackfire
name: Profiling with blackfire
on: [push, pull_request]
jobs:
bedrock:
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 }}
services:
blackfire:
image: blackfire/blackfire
ports:
- 8707:8707
env:
BLACKFIRE_SERVER_ID: "<id>"
BLACKFIRE_SERVER_TOKEN: "<token>"
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.1', '7.2', '7.3', '7.4']
php-versions: ['7.2', '7.3', '7.4']
# Blackfire supports PHP >= 5.3 on ubuntu and macos and PHP >= 5.4 on windows
steps:
- name: Checkout
uses: actions/checkout@v2
@ -25,8 +24,8 @@ jobs:
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: blackfire-1.30.0
ini-values: blackfire.agent_socket=tcp://localhost:8707
extensions: blackfire
tools: blackfire #Setup Blackfire client and agent
coverage: none
- name: Profile
# Note that blackfire agent is not installed. So an implementation with the sdk is required!
run: php your-blackfire-sdk-script.php
run: blackfire run php my-script.php # Refer to https://blackfire.io/docs/cookbooks/profiling-cli