Skip to content

Commit

Permalink
Merge pull request #110 from basz/next
Browse files Browse the repository at this point in the history
removed travis in favor of gh actions plus support for php 8.2
  • Loading branch information
basz committed Sep 21, 2023
2 parents a358163 + a18af8a commit e87d034
Show file tree
Hide file tree
Showing 90 changed files with 3,375 additions and 416 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,56 @@
name: PHP Tests

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php-version: ["7.4", "8.0", "8.1", "8.2"]
amqp-version: ["v1.11.0", "v2.1.0"]
composer-flags: ["", "--prefer-lowest --prefer-stable"]

steps:
- uses: actions/checkout@v4

- name: RabbitMQ in GitHub Actions
uses: Namoshek/rabbitmq-github-action@v1.1.0
with:
version: "3"
ports: "5672:5672 5671:5671"
certificates: ${{ github.workspace }}/provision/test_certs
config: ${{ github.workspace }}/provision/rabbitmq.config
definitions: ${{ github.workspace }}/provision/definitions.json
container-name: "rabbitmq"

- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: amqp-${{ matrix.amqp-version }}
tools: composer:v2
coverage: "xdebug"

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer update --prefer-dist ${{ matrix.composer-flags }}

- name: Run tests
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit --exclude-group=ssl --coverage-text --coverage-clover ./build/logs/clover.xml

# - name: Upload coverage
# run: php vendor/bin/php-coveralls -v
# if: ${{ matrix.php-version }} == '8.1'
28 changes: 11 additions & 17 deletions .php_cs → .php-cs-fixer.php
Expand Up @@ -20,13 +20,9 @@ public function getRules(): array
return [
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'align_double_arrow' => false,
'align_equals' => false,
],
'blank_line_after_opening_tag' => true,
'blank_line_after_namespace' => true,
'blank_line_before_return' => true,
'blank_line_before_statement' => true,
'braces' => true,
'cast_spaces' => true,
'class_definition' => true,
Expand All @@ -38,30 +34,30 @@ public function getRules(): array
'full_opening_tag' => true,
'function_declaration' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'single_line_comment_style' => true,
'header_comment' => false,
'include' => true,
'indentation_type' => true,
'linebreak_after_opening_tag' => true,
'line_ending' => true,
'lowercase_constants' => true,
'constant_case' => ['case' => 'lower'],
'lowercase_keywords' => true,
'method_argument_space' => true,
'method_separation' => true,
'class_attributes_separation' => ['elements' => ['property' => 'one']],
'modernize_types_casting' => true,
'native_function_casing' => true,
'new_with_braces' => true,
'no_alias_functions' => true,
'no_blank_lines_after_class_opening' => true,
'no_closing_tag' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_multiline_whitespace_before_semicolons' => true,
'multiline_whitespace_before_semicolons' => true,
'no_short_bool_cast' => true,
'no_short_echo_tag' => true,
'echo_tag_syntax' => ['format' => 'long'],
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_around_offset' => true,
'no_trailing_comma_in_list_call' => true,
Expand All @@ -80,8 +76,8 @@ public function getRules(): array
'object_operator_without_whitespace' => true,
'ordered_imports' => true,
'phpdoc_indent' => true,
'phpdoc_inline_tag' => true,
'psr4' => true,
'phpdoc_inline_tag_normalizer' => true,
'psr_autoloading' => true,
'return_type_declaration' => true,
'semicolon_after_instruction' => true,
'short_scalar_cast' => true,
Expand All @@ -95,7 +91,7 @@ public function getRules(): array
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => true,
Expand All @@ -107,8 +103,6 @@ public function getRules(): array
$config = new Prooph();
$config->getFinder()->in(__DIR__);

$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;

$config->setCacheFile($cacheDir . '/.php_cs.cache');
$config->setCacheFile(__DIR__ . '/.php_cs.cache');

return $config;
58 changes: 0 additions & 58 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions bin/humus-amqp.php
Expand Up @@ -31,6 +31,7 @@
foreach ($autoloadFiles as $autoloadFile) {
if (file_exists($autoloadFile)) {
require_once $autoloadFile;

break;
}
}
Expand Down Expand Up @@ -62,6 +63,7 @@
foreach ($GLOBALS as $helperSetCandidate) {
if ($helperSetCandidate instanceof HelperSet) {
$helperSet = $helperSetCandidate;

break;
}
}
Expand Down
141 changes: 75 additions & 66 deletions composer.json
@@ -1,69 +1,78 @@
{
"name": "prolic/humus-amqp",
"type": "library",
"description": "PHP-AMQP library with RabbitMQ Extensions",
"keywords": ["rabbit", "rabbitmq", "queue", "amqp", "humus", "messaging"],
"homepage": "https://github.com/prolic/HumusAmqp",
"license": "MIT",
"authors": [
{
"name": "Sascha-Oliver Prolic",
"email": "saschaprolic@googlemail.com"
}
],
"require": {
"php": "^7.4 || ^8.0",
"ext-json": "*",
"beberlei/assert": "^3.2.7",
"marc-mabe/php-enum": "^4.2",
"psr/log": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"ext-pcntl": "*",
"laminas/laminas-servicemanager": "^3.0",
"malukenho/docheader": "^0.1.8",
"php-amqplib/php-amqplib": "^2.11",
"php-coveralls/php-coveralls": "^2.4",
"php-mock/php-mock-phpunit": "^2.6",
"phpspec/prophecy": "^1.10",
"phpunit/phpunit": "^8.5",
"prooph/php-cs-fixer-config": "^0.4.0",
"psr/container": "^1.0",
"sandrokeil/interop-config": "^1.0 || ^2.0",
"symfony/console": "^5.0"
},
"conflict": {
"sandrokeil/interop-config": "<1.0",
"container-interop/container-interop": "<1.2"
},
"suggest": {
"ext-pcntl": "For process control management",
"ext-amqp": ">= 1.9.3 For usage together with php amqp extension",
"php-amqplib/php-amqplib": ">= 2.11 For usage together with php-amqplib",
"symfony/console": "For usage of the provided console tool",
"psr/container": "For usage of provided factories",
"sandrokeil/interop-config": "For usage of provided factories"
},
"autoload": {
"psr-4": {
"Humus\\Amqp\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"HumusTest\\Amqp\\": "tests/"
}
},
"bin": [
"bin/humus-amqp"
],
"scripts": {
"check": [
"@cs",
"@test"
],
"cs": "php-cs-fixer fix -v --diff --dry-run",
"cs-fix": "php-cs-fixer fix -v --diff",
"test": "phpunit"
"name": "prolic/humus-amqp",
"type": "library",
"description": "PHP-AMQP library with RabbitMQ Extensions",
"keywords": [
"rabbit",
"rabbitmq",
"queue",
"amqp",
"humus",
"messaging"
],
"homepage": "https://github.com/prolic/HumusAmqp",
"license": "MIT",
"authors": [
{
"name": "Sascha-Oliver Prolic",
"email": "saschaprolic@googlemail.com"
}
],
"require": {
"php": "^7.4 || ^8.0",
"ext-json": "*",
"beberlei/assert": "^3.2.7",
"marc-mabe/php-enum": "^4.7",
"psr/log": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"ext-pcntl": "*",
"laminas/laminas-servicemanager": "^3.0",
"malukenho/docheader": "^0.1.8 || ^1.0",
"php-amqplib/php-amqplib": "^3.0",
"php-coveralls/php-coveralls": "^2.4",
"php-mock/php-mock-phpunit": "^2.6",
"phpspec/prophecy": "^1.17",
"phpunit/phpunit": "^9.6",
"prooph/php-cs-fixer-config": "^0.5.0",
"psr/container": "^1.0",
"sandrokeil/interop-config": "^1.0 || ^2.0",
"symfony/console": "^5.4 || ^6.3",
"phpspec/prophecy-phpunit": "^2.0"
},
"conflict": {
"sandrokeil/interop-config": "<1.0",
"container-interop/container-interop": "<1.2"
},
"suggest": {
"ext-pcntl": "For process control management",
"ext-amqp": ">= 1.9.3 For usage together with php amqp extension",
"php-amqplib/php-amqplib": ">= 2.11 For usage together with php-amqplib",
"symfony/console": "For usage of the provided console tool",
"psr/container": "For usage of provided factories",
"sandrokeil/interop-config": "For usage of provided factories"
},
"autoload": {
"psr-4": {
"Humus\\Amqp\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"HumusTest\\Amqp\\": "tests/",
"AMQPBasicProperties\\": "stubs/amqp/"
}
},
"bin": [
"bin/humus-amqp"
],
"scripts": {
"check": [
"@cs",
"@test"
],
"cs": "php-cs-fixer fix -v --diff --dry-run",
"cs-fix": "php-cs-fixer fix -v --diff",
"test": "phpunit"
}
}

0 comments on commit e87d034

Please sign in to comment.