-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from imanghafoori1/1.x
"Check imports" workflow for Github actions
- Loading branch information
Showing
2 changed files
with
55 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Check Imports | ||
|
||
on: | ||
push: | ||
branches: [ "1.x" ] | ||
pull_request: | ||
branches: [ "1.x" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
check_imports: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php- | ||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-progress && composer require imanghafoori/php-imports-analyzer --dev | ||
|
||
- name: Check Imports | ||
run: ./vendor/bin/check_imports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
<a href="https://packagist.org/packages/laracraft-tech/laravel-xhprof"><img src="https://img.shields.io/packagist/dt/laracraft-tech/laravel-xhprof" alt="Total Downloads"></a> | ||
<a href="https://packagist.org/packages/laracraft-tech/laravel-xhprof"><img src="https://img.shields.io/packagist/v/laracraft-tech/laravel-xhprof" alt="Latest Stable Version"></a> | ||
<a href="https://packagist.org/packages/laracraft-tech/laravel-xhprof"><img src="https://img.shields.io/packagist/l/laracraft-tech/laravel-xhprof" alt="License"></a> | ||
<a href="https://github.com/laracraft-tech/laravel-xhprof/actions/workflows/check_imports.yml"><img src="https://github.com/laracraft-tech/laravel-xhprof/actions/workflows/check_imports.yml/badge.svg?branch=1.x" alt="License"></a> | ||
</p> | ||
|
||
<!-- | ||
|
@@ -16,9 +17,9 @@ | |
|
||
## Introduction | ||
|
||
Laravel XHProf provides you with a simple setup to profile your laravel application | ||
with the well known XHProf PHP extension originally developed by facebook. | ||
It also leads you through the steps to install XHProf UI, a UI to visualize, save and analyze the results | ||
Laravel XHProf provides you with a simple setup to profile your Laravel application | ||
with the well-known XHProf PHP extension originally developed by Facebook. | ||
It also leads you through the steps to install XHProf UI, a UI to visualize, save, and analyze the results | ||
of the profiling. | ||
|
||
<p align="center"> | ||
|
@@ -27,8 +28,8 @@ of the profiling. | |
|
||
## Installation | ||
|
||
First you'll need to install the PHP extension. | ||
It's highly recommended using ondrejs ppa. | ||
First, you'll need to install the PHP extension. | ||
It's highly recommended to use ondrejs ppa. | ||
It's well maintained and provides quite all PHP versions. | ||
|
||
### Normal environment | ||
|
@@ -38,13 +39,13 @@ If you have a normal PHP environment, just install the XHProf extension: | |
``` bash | ||
sudo add-apt-repository ppa:ondrej/php | ||
sudo apt-get update | ||
sudo apt-get install php php-xhprof graphviz | ||
# you can now check if the extension was successfully installed | ||
sudo apt-get install php php-xhprof Graphviz | ||
# You can now check if the extension was successfully installed | ||
php -i | grep xhprof | ||
# maybe restart your webserver or php-fpm... | ||
``` | ||
|
||
Note: we need graphviz to generate callgraphs. | ||
Note: we need Graphviz to generate callgraphs. | ||
|
||
### Laravel Sail environment | ||
|
||
|
@@ -54,12 +55,12 @@ If you are using laravel sail, here's a setup for you: | |
sail up -d | ||
sail artisan sail:publish | ||
# in docker-compose.yml check wich php version is used under build->context (eg. ./docker/8.1) | ||
# if you know the php-version you can type: | ||
# If you know the php-version you can type: | ||
nano docker/<php-version>/Dockerfile | ||
# find the block where all php extionsions are installed and add "php<php-version>-xhprof graphviz \" | ||
# now you need to rebuild sail | ||
# find the block where all php extensions are installed and add "php<php-version>-xhprof graphviz \" | ||
# Now you need to rebuild the sail | ||
sail down ; sail build --no-cache ; sail up -d # this may take a while... | ||
# you can now check if the extension was successfully installed | ||
# You can now check if the extension was successfully installed | ||
sail php -i | grep xhprof | ||
``` | ||
|
||
|
@@ -79,7 +80,7 @@ https://www.php.net/manual/en/xhprof.requirements.php | |
|
||
``` bash | ||
mkdir public/vendor ; git clone [email protected]:preinheimer/xhprof.git ./public/vendor/xhprof | ||
# if you havent already, I recommend adding public/vendor to your .gitignore | ||
# If you haven't already, I recommend adding public/vendor to your .gitignore | ||
echo "/public/vendor" >> .gitignore | ||
``` | ||
|
||
|
@@ -88,11 +89,11 @@ echo "/public/vendor" >> .gitignore | |
Since the database table name, | ||
which the UI package is using behind to store and read data from the database, | ||
is hard coded to ``details`` and you already may have a table named like that, | ||
you may need to make some additional steps. If not, here at first the simple way: | ||
you may need to take some additional steps. If not, here at first the simple way: | ||
|
||
<br/> | ||
|
||
#### In case you DON'T already HAVE an own ``details`` table in your database: | ||
#### In case you DON'T already HAVE your own ``details`` table in your database: | ||
|
||
``` bash | ||
php artisan vendor:publish --provider="LaracraftTech\LaravelXhprof\XHProfServiceProvider" --tag="migrations" | ||
|
@@ -102,7 +103,7 @@ php artisan migrate | |
|
||
#### In case you already HAVE an own ``details`` table in your database: | ||
|
||
I recommend to just use a different database. | ||
I recommend just using a different database. | ||
|
||
``` mysql | ||
CREATE DATABASE xhprof; | ||
|
@@ -134,17 +135,17 @@ CREATE TABLE IF NOT EXISTS `details` ( | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | ||
``` | ||
|
||
Note: you also need to create a user which has privileges on that new database! | ||
Note: you also need to create a user who has privileges on that new database! | ||
|
||
### Config | ||
|
||
Now let's configure some settings! | ||
|
||
``` bash | ||
cp public/vendor/xhprof/xhprof_lib/config.sample.php public/vendor/xhprof/xhprof_lib/config.php | ||
# 1. change the db credentials to your needs | ||
# 1. Change the DB credentials to your needs | ||
# 2. enable dot_binary section | ||
# 3. if you're local, set $controlIPs to false | ||
# 3. If you're local, set $controlIPs to false | ||
nano public/vendor/xhprof/xhprof_lib/config.php | ||
``` | ||
|
||
|
@@ -154,7 +155,7 @@ Just set ``XHPROF_ENABLED=true`` in your .env file and | |
now every request you make to your application gets profiled. \ | ||
Visit ``<your-host>/vendor/xhprof/xhprof_html/`` to see your profiling results. | ||
|
||
Happy analysing! | ||
Happy analyzing! | ||
|
||
|
||
<!-- | ||
|
@@ -173,7 +174,7 @@ composer test | |
|
||
## Security | ||
|
||
If you discover any security related issues, please email [email protected] instead of using the issue tracker. | ||
If you discover any security-related issues, please email [email protected] instead of using the issue tracker. | ||
|
||
## Credits | ||
|
||
|