-
Notifications
You must be signed in to change notification settings - Fork 3
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 #8 from Syrian-Open-Source/v1.1.0
V1.1.0
- Loading branch information
Showing
10 changed files
with
219 additions
and
31 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,23 @@ | ||
name: Check & fix styling | ||
|
||
on: [push,pull_request] | ||
|
||
jobs: | ||
php-cs-fixer: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Run PHP Code Style Fixer | ||
uses: docker://oskarstark/php-cs-fixer-ga | ||
with: | ||
args: --config=.php-cs-fixer.dist.php --allow-risky=yes | ||
|
||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Fix styling |
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
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
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,28 @@ | ||
name: "Update Changelog" | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: main | ||
|
||
- name: Update Changelog | ||
uses: stefanzweifel/changelog-updater-action@v1 | ||
with: | ||
latest-version: ${{ github.event.release.name }} | ||
release-notes: ${{ github.event.release.body }} | ||
|
||
- name: Commit updated CHANGELOG | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
branch: main | ||
commit_message: Update CHANGELOG | ||
file_pattern: CHANGELOG.md |
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
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
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,41 @@ | ||
Usage | ||
-------- | ||
* Define multiple process and execute them by start function, | ||
each task must be a callback function as you can see in the below example. | ||
|
||
```shell | ||
$process = \SOS\MultiProcess\Facades\MultiProcessFacade::setTasks( | ||
function () { | ||
return \Illuminate\Support\Facades\DB::statement('delete from users where id = 5'); | ||
}, function () { | ||
return \Illuminate\Support\Facades\DB::statement('delete from users where id = 6'); | ||
} | ||
); | ||
$process->runPHP(); | ||
``` | ||
* Add options. | ||
|
||
```shell | ||
|
||
// default options are in multi_process.php file. | ||
// you can change them from the file | ||
// or you can basicly added them from the setter function. | ||
$process = \SOS\MultiProcess\Facades\MultiProcessFacade::setTasks( | ||
"php artisan make:model modelName", | ||
"php artisan make:model ControllerName", | ||
// and you can define unlimited commands | ||
)->setOptions([ | ||
'timeOut' => 60, | ||
'ideTimeOut' => 60, | ||
'enableOutput' => true, | ||
'processTime' => 3, | ||
|
||
// thorw exceprtion if any task was failed. | ||
'throwIfTaskNotSuccess' => false, | ||
); | ||
|
||
// run or start your tasks. | ||
$process->start(); | ||
|
||
``` | ||
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
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
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,40 @@ | ||
<?php | ||
|
||
namespace SOS\MultiProcess\Tests\Feature; | ||
|
||
|
||
use SOS\MultiProcess\Classes\MultiProcess; | ||
use SOS\MultiProcess\Tests\BaseTest; | ||
|
||
class PHPTest extends BaseTest | ||
{ | ||
|
||
/** | ||
* test if the php codes are running successfully. | ||
* | ||
* @return void | ||
* @throws \Exception | ||
* | ||
*/ | ||
public function test_if_php_code_run_successfully() | ||
{ | ||
$completedState = 3; | ||
|
||
$processor = (new MultiProcess())->setTasks( | ||
function () { | ||
echo 'process 1'; | ||
}, | ||
function () { | ||
echo 'process 2'; | ||
}, | ||
function () { | ||
echo 'process 3'; | ||
} | ||
); | ||
|
||
foreach ($processor->runPHP()->getTasks() as $task) { | ||
$this->assertEquals($task['state'], $completedState); | ||
} | ||
|
||
} | ||
} |