Skip to content

Commit

Permalink
Update wrapper release in composer.json (#7)
Browse files Browse the repository at this point in the history
* update-composer-for-wrapper

* Improve CI

Co-authored-by: Eric COURTIAL <[email protected]>
  • Loading branch information
alex-mercier and Eric COURTIAL authored Jun 9, 2020
1 parent 16b6bd2 commit 199d9c7
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 23 deletions.
102 changes: 102 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
version: '2.1'
executors:
php7-2:
docker:
- image: php:7.2-alpine
php7-3:
docker:
- image: php:7.3-alpine
php7-4:
docker:
- image: php:7.4-alpine

jobs:
phpcs:
parameters:
executor:
type: executor
executor: << parameters.executor >>
steps:
- checkout
- restore_cache:
key: composer-<< parameters.executor >>-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
- attach_workspace:
at: .
- run:
name: Install alpine requirements for checkout
command: apk add git openssh-client curl libzip-dev zip && docker-php-ext-install zip
- run:
name: composer
command: |
if [[ ! -f vendor/autoload.php ]]; then
curl https://getcomposer.org/composer-stable.phar --location --silent --output /usr/bin/composer; \
chmod +x /usr/bin/composer; \
composer install --no-progress --no-interaction; \
fi
- run:
name: phpcs
command: vendor/bin/phpcs -n

phpstan:
parameters:
executor:
type: executor
executor: << parameters.executor >>
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Install alpine requirements for checkout
command: apk add git openssh-client curl libzip-dev zip && docker-php-ext-install zip
- run:
name: composer
command: |
if [[ ! -f vendor/autoload.php ]]; then
curl https://getcomposer.org/composer-stable.phar --location --silent --output /usr/bin/composer; \
chmod +x /usr/bin/composer; \
composer install --no-progress --no-interaction; \
fi
- run:
name: phpstan
command: vendor/bin/phpstan analyse

phpunit:
parameters:
executor:
type: executor
executor: << parameters.executor >>
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Install alpine requirements for checkout
command: apk add git openssh-client curl libzip-dev zip && docker-php-ext-install zip
- run:
name: composer
command: |
if [[ ! -f vendor/autoload.php ]]; then
curl https://getcomposer.org/composer-stable.phar --location --silent --output /usr/bin/composer; \
chmod +x /usr/bin/composer; \
composer install --no-progress --no-interaction; \
fi
- run:
name: phpunit
command: vendor/bin/phpunit --testdox

workflows:
all-tests:
jobs:
- phpcs:
matrix:
parameters:
executor: [php7-2, php7-3, php7-4]
- phpstan:
matrix:
parameters:
executor: [php7-2, php7-3, php7-4]
- phpunit:
matrix:
parameters:
executor: [php7-2, php7-3, php7-4]
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
composer.lock
.php_cs.cache
.phpunit.result.cache
# Symfo
var/*
42 changes: 31 additions & 11 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
<?php
$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->exclude('config')
->in(__DIR__)
->exclude('tests')
->exclude('vendor')
->in(__DIR__)
;

$customRules = [
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
'increment_style' => ['style' => 'post'],
'declare_strict_types' => true,
'phpdoc_summary' => false,
];

$psr12Rules = [
'@PSR2' => true,
'blank_line_after_opening_tag' => true,
'braces' => ['allow_single_line_closure' => true],
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'function_typehint_space' => true,
'new_with_braces' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_whitespace_in_blank_line' => true,
'return_type_declaration' => ['space_before' => 'none'],
'single_trait_insert_per_statement' => true,
];

return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
'increment_style' => ['style' => 'post'],
'declare_strict_types' => true,
'phpdoc_summary' => false
])
->setFinder($finder)
->setRules($customRules + $psr12Rules)
->setFinder($finder)
;
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
phpcs:
vendor/bin/phpcs
vendor/bin/phpcs -n

phpcbf:
vendor/bin/phpcbf

phpstan:
vendor/bin/phpstan clear-result-cache
vendor/bin/phpstan analyse

phpcsfixer:
vendor/bin/php-cs-fixer fix --dry-run --allow-risky=yes
vendor/bin/php-cs-fixer fix --dry-run --allow-risky=yes --diff

test:
vendor/bin/phpunit
vendor/bin/phpunit --testdox

infection:
vendor/bin/infection
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,21 @@
"philkra/elastic-apm-php-agent": "dev-master",
"symfony/dependency-injection": "~3.0",
"symfony/symfony": ">=3.0 <4.3",
"wizaplace/elastic-apm-wrapper": "^0.3.0"
"wizaplace/elastic-apm-wrapper": "^0.4.0"
},
"repositories": [
{
"type": "git",
"url": "git@github.com:wizaplace/elastic-apm-wrapper.git"
"url": "https://github.com/wizaplace/elastic-apm-wrapper.git"
}
],
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"phpstan/phpstan": "^0.12.5",
"infection/infection": "^0.15.3",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.27",
"phpstan/phpstan-deprecation-rules": "^0.12.4",
"phpstan/phpstan-strict-rules": "^0.12.2",
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.5"
}
Expand Down
22 changes: 22 additions & 0 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"timeout": 10,
"source": {
"directories": [
"src"
]
},
"logs": {
"text": "var/tmp-infection/infection.log",
"summary": "var/tmp-infection/summary.log",
"perMutator": "var/tmp-infection/per-mutator.md",
"badge": {
"branch": "master"
}
},
"mutators": {
"@default": true
},
"tmpDir": "var/tmp-infection",
"testFramework":"phpunit",
"testFrameworkOptions": "-vvv"
}
1 change: 0 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
<arg name="basepath" value="."/>
<arg name="colors"/>
<arg name="report" value="diff"/>
<rule ref="PSR12"/>
<file>src</file>
</ruleset>
3 changes: 3 additions & 0 deletions src/DependencyInjection/Compiler/ElasticApmEnginePass.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?php

/**
* @author Wizacha DevTeam <[email protected]>
* @copyright Copyright (c) Wizacha
* @license Proprietary
*/

declare(strict_types=1);

namespace Wizacha\ElasticApmBundle\DependencyInjection\Compiler;

use PhilKra\Agent;
Expand Down
10 changes: 5 additions & 5 deletions tests/ElasticApmSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

namespace Wizacha\ElasticApmBundle\Tests;

use PHPUnit\Framework\TestCase;
use PhilKra\Events\Transaction;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
use Symfony\Component\HttpFoundation\Response;
use Wizacha\ElasticApm\Service\AgentService;
use Wizacha\ElasticApmBundle\ElasticApmSubscriber;

Expand All @@ -25,7 +25,7 @@ class ElasticApmSubscriberTest extends TestCase
/** @var AgentService */
private $agentService;

/** @var KernelInterface */
/** @var KernelInterface */
private $kernel;

public function setUp(): void
Expand Down

0 comments on commit 199d9c7

Please sign in to comment.