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