-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
547 additions
and
0 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,25 @@ | ||
name: PHP code sniffer | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: null | ||
|
||
jobs: | ||
codesniffer: | ||
runs-on: ubuntu-latest | ||
name: PHP code sniffer | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Composer update | ||
run: composer update --no-progress --no-interaction | ||
|
||
- name: Install PHP code sniffer as dev dependency | ||
run: composer require squizlabs/php_codesniffer --dev | ||
|
||
- name: Code sniffer | ||
run: vendor/bin/phpcs src --standard=PSR2 -n |
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,32 @@ | ||
name: Composer outdated | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: null | ||
|
||
jobs: | ||
composer: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: [ '7.4', '8.0', '8.1' ] | ||
|
||
name: Composer outdated - PHP ${{ matrix.php }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
|
||
- name: Composer update | ||
run: composer update --no-progress --no-interaction | ||
|
||
- name: Composer outdated | ||
run: composer outdated -D --strict |
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,25 @@ | ||
name: PHP extensions finder | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: null | ||
|
||
jobs: | ||
extensions_finder: | ||
runs-on: ubuntu-latest | ||
name: PHP extensions finder | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Composer update | ||
run: composer update --no-progress --no-interaction | ||
|
||
- name: Install PHP extensions finder as dev dependency | ||
run: composer require efabrica/php-extensions-finder --dev | ||
|
||
- name: PHP extensions finder | ||
run: vendor/bin/php-extensions-finder check src |
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,36 @@ | ||
name: PHP static analysis | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: null | ||
|
||
jobs: | ||
phpstan: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: [ '7.4', '8.0', '8.1' ] | ||
|
||
name: PHPStan - PHP ${{ matrix.php }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: none # disable xdebug, pcov | ||
|
||
- name: Composer update | ||
run: composer update --no-progress --no-interaction | ||
|
||
- name: Install PHPStan as dev dependency | ||
run: composer require phpstan/phpstan --dev | ||
|
||
- name: PHPStan analyse | ||
run: vendor/bin/phpstan analyze src --level=max --no-progress |
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,36 @@ | ||
name: PHP static analysis with lowest dependencies | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: null | ||
|
||
jobs: | ||
phpstan: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: [ '7.4', '8.0', '8.1' ] | ||
|
||
name: PHPStan with lowest dependencies - PHP ${{ matrix.php }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: none # disable xdebug, pcov | ||
|
||
- name: Composer update | ||
run: composer update --prefer-lowest --no-progress --no-interaction | ||
|
||
- name: Install PHPStan as dev dependency | ||
run: composer require phpstan/phpstan --dev | ||
|
||
- name: PHPStan analyse | ||
run: vendor/bin/phpstan analyze src --level=max --no-progress |
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,30 @@ | ||
name: PHP syntax checker | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: null | ||
|
||
jobs: | ||
syntax_checker: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: [ '7.4', '8.0', '8.1' ] | ||
|
||
name: PHP syntax checker - PHP ${{ matrix.php }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: none # disable xdebug, pcov | ||
|
||
- name: Check syntax | ||
run: find src -name "*.php" -print0 | xargs -0 -n1 -P8 php -l |
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,3 @@ | ||
/vendor | ||
/composer.lock | ||
/.idea |
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,11 @@ | ||
# Change Log | ||
|
||
## [Unreleased][unreleased] | ||
|
||
### Added | ||
- HermesWorker (symfony command) | ||
- RedisProxySetDriver (driver implementation using RedisProxy) | ||
- RedisProxySortedSetDriver | ||
- DummyDriver (for testing purposes) | ||
|
||
[unreleased]: https://github.com/efabrica-team/hermes-extension/compare/8b055557b0c87b5c52961cf2bfa13340e50915ad...HEAD |
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,17 @@ | ||
{ | ||
"name": "efabrica/hermes-extension", | ||
"description": "Extension for tomaj/hermes", | ||
"keywords": ["worker", "driver", "redis-proxy"], | ||
"license": "MIT", | ||
"require": { | ||
"php": ">= 7.4 < 8.2", | ||
"tomaj/hermes": "^4.0", | ||
"lulco/redis-proxy": "dev-master as 1.0.0", | ||
"symfony/console": "^5.4 | ^6.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Efabrica\\HermesExtension\\": "src/" | ||
} | ||
} | ||
} |
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 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Efabrica\HermesExtension\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Tomaj\Hermes\DispatcherInterface; | ||
|
||
final class HermesWorker extends Command | ||
{ | ||
private DispatcherInterface $dispatcher; | ||
|
||
public function __construct(DispatcherInterface $dispatcher, string $name = 'hermes:worker') | ||
{ | ||
parent::__construct($name); | ||
$this->dispatcher = $dispatcher; | ||
} | ||
|
||
protected function configure(): void | ||
{ | ||
$this->setDescription('Handle hermes messages'); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$this->dispatcher->handle(); | ||
$output->writeln('Hermes worker end.'); | ||
return self::SUCCESS; | ||
} | ||
} |
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 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Efabrica\HermesExtension\Driver; | ||
|
||
use Closure; | ||
use Tomaj\Hermes\Dispatcher; | ||
use Tomaj\Hermes\Driver\DriverInterface; | ||
use Tomaj\Hermes\MessageInterface; | ||
|
||
final class DummyDriver implements DriverInterface | ||
{ | ||
public function send(MessageInterface $message, int $priority = Dispatcher::DEFAULT_PRIORITY): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function wait(Closure $callback, array $priorities = []): void | ||
{ | ||
// do nothing | ||
} | ||
|
||
public function setupPriorityQueue(string $name, int $priority): void | ||
{ | ||
// do nothing | ||
} | ||
} |
Oops, something went wrong.