Skip to content

Commit c7f9ca8

Browse files
Merge pull request #5 from Pharaonic/feature/codebase-enhancement
Feature/codebase enhancement
2 parents 6c7c05d + 23bdbe3 commit c7f9ca8

32 files changed

+685
-767
lines changed

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: MoamenEltouny
2+
buy_me_a_coffee: moameneltouny

.github/workflows/php-cs-fixer.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: PHP Coding Standards Fixer
2+
3+
on: [push]
4+
5+
jobs:
6+
php-cs-fixer:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v4
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- name: Run PHP CS Fixer
16+
uses: docker://oskarstark/php-cs-fixer-ga
17+
with:
18+
args: --config=.php-cs-fixer.dist.php --allow-risky=yes
19+
20+
- name: Commit changes
21+
uses: stefanzweifel/git-auto-commit-action@v4
22+
with:
23+
commit_message: Fixing php-cs

.github/workflows/build.yml renamed to .github/workflows/tests.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
name: build
1+
name: Tests
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
47

58
jobs:
69
run:
710
runs-on: ${{ matrix.operating-system }}
811
strategy:
912
matrix:
1013
operating-system: [ubuntu-latest]
11-
php-versions: ["8.1", "8.2", "8.3"]
14+
php-versions: ['8.2', '8.3', '8.4']
1215
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
1316

1417
steps:
@@ -19,7 +22,7 @@ jobs:
1922
uses: shivammathur/setup-php@v2
2023
with:
2124
php-version: ${{ matrix.php-versions }}
22-
extensions: mbstring, pdo, pdo_sqlite, sqlite3, intl, zip
25+
extensions: mbstring, pdo, intl, zip
2326
coverage: none
2427

2528
- name: Check PHP Version
@@ -35,7 +38,7 @@ jobs:
3538
run: composer validate
3639

3740
- name: Install dependencies
38-
run: composer install --prefer-dist --no-progress --no-suggest
41+
run: composer install --prefer-dist --no-progress
3942

4043
- name: Run test suite
41-
run: vendor/bin/phpunit
44+
run: vendor/bin/phpunit --testdox

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
vendor
1+
/vendor
22
composer.lock
3-
.phpunit.cache
3+
.phpunit.result.cache
4+
.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->notPath('bootstrap/*')
5+
->notPath('storage/*')
6+
->notPath('storage/*')
7+
->notPath('resources/view/mail/*')
8+
->in([
9+
__DIR__ . '/src',
10+
__DIR__ . '/tests',
11+
])
12+
->name('*.php')
13+
->notName('*.blade.php')
14+
->ignoreDotFiles(true)
15+
->ignoreVCS(true);
16+
17+
return (new PhpCsFixer\Config())
18+
->setRules([
19+
'@PSR12' => true,
20+
'indentation_type' => true,
21+
'array_syntax' => ['syntax' => 'short'],
22+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
23+
'no_unused_imports' => true,
24+
'not_operator_with_successor_space' => true,
25+
'trailing_comma_in_multiline' => true,
26+
'phpdoc_scalar' => true,
27+
'unary_operator_spaces' => true,
28+
'binary_operator_spaces' => true,
29+
'blank_line_before_statement' => [
30+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
31+
],
32+
'phpdoc_single_line_var_spacing' => true,
33+
'phpdoc_var_without_name' => true,
34+
'method_argument_space' => [
35+
'on_multiline' => 'ensure_fully_multiline',
36+
'keep_multiple_spaces_after_comma' => true,
37+
],
38+
])
39+
->setFinder($finder);

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
<p align="center"><a href="https://pharaonic.io" target="_blank"><img src="https://raw.githubusercontent.com/Pharaonic/logos/main/executor.jpg"></a></p>
22

33
<p align="center">
4-
<a href="https://laravel.com" target="_blank"><img src="https://img.shields.io/static/v1?label=Laravel&message=10.x, 11.x&color=F05340&style=flat-square" alt="Laravel Version : 10.x, 11.x"></a>
5-
<img src="https://img.shields.io/static/v1?label=License&message=MIT&color=brightgreen&style=flat-square" alt="License">
6-
<img src="https://img.shields.io/github/actions/workflow/status/pharaonic/laravel-executor/build.yml" alt="GitHub Actions Workflow Status">
7-
<br>
8-
<a href="https://packagist.org/packages/Pharaonic/laravel-executor" target="_blank"><img src="https://img.shields.io/static/v1?label=Packagist&message=pharaonic/laravel-executor&color=blue&logo=packagist&logoColor=white" alt="Source"></a>
9-
<a href="https://packagist.org/packages/pharaonic/laravel-executor" target="_blank"><img src="https://poser.pugx.org/pharaonic/laravel-executor/v" alt="Packagist Version"></a>
10-
<a href="https://packagist.org/packages/pharaonic/laravel-executor" target="_blank"><img src="https://poser.pugx.org/pharaonic/laravel-executor/downloads" alt="Packagist Downloads"></a>
4+
<a href="https://github.com/Pharaonic/laravel-executor/actions"><img src="https://github.com/Pharaonic/laravel-executor/workflows/tests/badge.svg" alt="Build Status"></a>
5+
<a href="https://laravel.com" target="_blank"><img src="https://img.shields.io/static/v1?label=Laravel&message=11.x&color=F05340&style=flat-square" alt="Laravel Version : 11.x"></a>
6+
<a href="https://packagist.org/packages/pharaonic/laravel-executor" target="_blank"><img src="https://poser.pugx.org/pharaonic/laravel-executor/downloads" alt="Total Downloads"></a>
7+
<a href="https://packagist.org/packages/Pharaonic/laravel-executor"><img src="https://img.shields.io/packagist/v/Pharaonic/laravel-executor" alt="Latest Stable Version"></a>
8+
<a href="https://packagist.org/packages/Pharaonic/laravel-executor"><img src="https://img.shields.io/static/v1?label=License&message=MIT&color=brightgreen&style=flat-square" alt="License"></a>
119
</p>
1210

1311
<h3 align="center">Allows you to execute commands, actions, jobs, and automated tasks on your production server.</h3>

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
}
2525
],
2626
"require": {
27-
"php": ">=8.1",
28-
"laravel/framework": ">=10.0"
27+
"php": "~8.2|~8.3|~8.4",
28+
"laravel/framework": "^11.0",
29+
"pharaonic/php-dot-array": "^2.0"
2930
},
3031
"require-dev": {
31-
"orchestra/testbench": "^8.0"
32+
"orchestra/testbench": "^9.15"
3233
},
3334
"config": {
3435
"sort-packages": true

config/executor.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
return [
4+
/**
5+
* The database connection that should be used by the executor.
6+
*/
7+
'connection' => env('EXECUTOR_CONNECTION', config('database.default')),
8+
9+
/**
10+
* The table that should be used to store the executors.
11+
*/
12+
'table' => env('EXECUTOR_TABLE', 'executors'),
13+
];

database/migrations/2024_07_07_000001_create_executors_table.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ class CreateExecutorsTable extends Migration
1414
*/
1515
public function up()
1616
{
17-
Schema::create('executors', function (Blueprint $table) {
18-
$table->id();
19-
$table->unsignedTinyInteger('type')->default(ExecutorType::Always);
20-
$table->string('executor');
21-
$table->string('tag')->nullable();
22-
$table->integer('batch')->default(1);
23-
$table->integer('executed')->default(0);
24-
$table->timestamp('last_executed_at')->nullable();
25-
});
17+
Schema::connection(config('pharaonic.executor.connection', config('database.default')))
18+
->create(config('pharaonic.executor.table', 'executors'), function (Blueprint $table) {
19+
$table->id();
20+
$table->unsignedTinyInteger('type')->default(ExecutorType::Always);
21+
$table->string('name');
22+
$table->json('tags')->nullable();
23+
$table->json('servers')->nullable();
24+
$table->integer('batch')->nullable();
25+
$table->integer('executed')->default(0);
26+
$table->timestamp('last_executed_at')->nullable();
27+
});
2628
}
2729

2830
/**
@@ -32,6 +34,7 @@ public function up()
3234
*/
3335
public function down()
3436
{
35-
Schema::dropIfExists('executors');
37+
Schema::connection(config('pharaonic.executor.connection', config('database.default')))
38+
->dropIfExists(config('pharaonic.executor.table', 'executors'));
3639
}
3740
}

phpunit.xml.dist

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3-
<testsuites>
4-
<testsuite name="laravel-executor Test Suite">
5-
<directory suffix="Test.php">./tests/</directory>
6-
</testsuite>
7-
</testsuites>
8-
<source>
9-
<include>
10-
<directory suffix=".php">./src/</directory>
11-
</include>
12-
</source>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true">
6+
7+
<testsuites>
8+
<testsuite name="laravel-executor Test Suite">
9+
<directory>tests</directory>
10+
</testsuite>
11+
</testsuites>
12+
1313
</phpunit>

0 commit comments

Comments
 (0)