Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 25 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: CI

on:
push:
branches: ['*.x']
pull_request:
schedule:
- cron: '0 0 1,16 * *'
Expand All @@ -15,9 +16,9 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ 8.1, 8.2, 8.3, 8.4 ]
php: [ 8.1, 8.2, 8.3, 8.4, 8.5 ]
deps: [ highest ]
symfony: [ 6.4.*, 7.2.*, 7.3.* ]
symfony: [ 6.4.*, 7.2.*, 7.3.*, 8.0.* ]
include:
- php: 8.1
deps: lowest
Expand All @@ -27,10 +28,19 @@ jobs:
symfony: 7.2.*
- php: 8.1
symfony: 7.3.*
- php: 8.1
symfony: 8.0.*
- php: 8.2
symfony: 8.0.*
- php: 8.3
symfony: 8.0.*
# PHP 8.5: laminas-diagnostics 1.28+ conflicts with symfony/process < 7.4 (Symfony 6.4)
- php: 8.5
symfony: 6.4.*

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -40,22 +50,19 @@ jobs:
tools: flex

- name: Install dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ inputs.deps }}
composer-options: --prefer-dist
run: composer update --prefer-dist
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}

- name: Run tests
run: vendor/bin/phpunit -v
run: vendor/bin/phpunit

code-coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -64,19 +71,19 @@ jobs:
coverage: xdebug

- name: Install dependencies
uses: ramsey/composer-install@v2
with:
composer-options: --prefer-dist
run: composer update --prefer-dist
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}

- name: Run code coverage
run: vendor/bin/phpunit -v --coverage-text
run: vendor/bin/phpunit --coverage-text

composer-validate:
name: Validate composer.json
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -92,7 +99,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -101,9 +108,9 @@ jobs:
coverage: none

- name: Install dependencies
uses: ramsey/composer-install@v2
with:
composer-options: --prefer-dist
run: composer update --prefer-dist
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}

- name: Check CS
run: vendor/bin/php-cs-fixer fix --diff --dry-run --verbose
4 changes: 2 additions & 2 deletions DependencyInjection/Compiler/MailerCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function process(ContainerBuilder $container): void
throw new \InvalidArgumentException('To enable mail reporting you have to install "symfony/mailer".');
}

$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../../Resources/config'));
$loader->load('symfony_mailer.xml');
$loader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__.'/../../Resources/config'));
$loader->load('symfony_mailer.php');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct()

public function process(ContainerBuilder $container): void
{
if (!($this->loader instanceof CompilerPassInterface)) {
if (!$this->loader instanceof CompilerPassInterface) {
return;
}

Expand Down
12 changes: 6 additions & 6 deletions DependencyInjection/LiipMonitorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public function __construct()
*/
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('runner.xml');
$loader->load('helper.xml');
$loader->load('commands.xml');
$loader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('runner.php');
$loader->load('helper.php');
$loader->load('commands.php');

$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
Expand All @@ -47,7 +47,7 @@ public function load(array $configs, ContainerBuilder $container): void
if ($config['enable_controller']) {
$container->setParameter(sprintf('%s.view_template', $this->getAlias()), $config['view_template']);
$container->setParameter(sprintf('%s.failure_status_code', $this->getAlias()), $config['failure_status_code']);
$loader->load('controller.xml');
$loader->load('controller.php');
}

$this->configureMailer($container, $config);
Expand All @@ -74,7 +74,7 @@ public function load(array $configs, ContainerBuilder $container): void
$this->setParameters($container, $check, $group, $values);

if (!in_array($check, $checksLoaded)) {
$loader->load('checks/'.$check.'.xml');
$loader->load('checks/'.$check.'.php');
$checksLoaded[] = $check;
}
}
Expand Down
3 changes: 0 additions & 3 deletions Helper/ArrayReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public function onAfterRun(CheckInterface $check, ResultInterface $result, $chec
*/
public function onStart(\ArrayObject $checks, $runnerConfig)
{
return;
}

/**
Expand All @@ -91,14 +90,12 @@ public function onBeforeRun(CheckInterface $check, $checkAlias = null)
*/
public function onStop(ResultsCollection $results)
{
return;
}

/**
* @return void
*/
public function onFinish(ResultsCollection $results)
{
return;
}
}
4 changes: 0 additions & 4 deletions Helper/ConsoleReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,26 @@ public function onAfterRun(CheckInterface $check, ResultInterface $result, $chec
*/
public function onStart(\ArrayObject $checks, $runnerConfig)
{
return;
}

/**
* @return bool|void
*/
public function onBeforeRun(CheckInterface $check, $checkAlias = null)
{
return;
}

/**
* @return void
*/
public function onStop(ResultsCollection $results)
{
return;
}

/**
* @return void
*/
public function onFinish(ResultsCollection $results)
{
return;
}
}
4 changes: 0 additions & 4 deletions Helper/RawConsoleReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,30 +72,26 @@ protected function getNagiosPerformanceData(): string
*/
public function onStart(\ArrayObject $checks, $runnerConfig)
{
return;
}

/**
* @return bool|void
*/
public function onBeforeRun(CheckInterface $check, $checkAlias = null)
{
return;
}

/**
* @return void
*/
public function onStop(ResultsCollection $results)
{
return;
}

/**
* @return void
*/
public function onFinish(ResultsCollection $results)
{
return;
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ If you want to enable the REST API provided by the bundle then add the following

```yml
_monitor:
resource: "@LiipMonitorBundle/Resources/config/routing.xml"
resource: "@LiipMonitorBundle/Resources/config/routing.yaml"
prefix: /monitor/health
```

Expand Down Expand Up @@ -488,7 +488,7 @@ liip_monitor:
## REST API DOCS ##

For documentation on the REST API see: [http://myproject.org/monitor/health/](http://myproject.org/monitor/health/).
Don't forget to add the bundle routes in your `routing.xml` file.
Don't forget to add the bundle routes in your `routing.yaml` file.


## Nagios integration ##
Expand Down
14 changes: 14 additions & 0 deletions Resources/config/checks/apc_fragmentation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

return function (ContainerConfigurator $container): void {
$container->services()
->set('liip_monitor.check.apc_fragmentation', \Laminas\Diagnostics\Check\ApcFragmentation::class)
->args([
'%%liip_monitor.check.apc_fragmentation.warning%%',
'%%liip_monitor.check.apc_fragmentation.critical%%',
])
->tag('liip_monitor.check', ['alias' => 'apc_fragmentation'])
->public();
};
14 changes: 0 additions & 14 deletions Resources/config/checks/apc_fragmentation.xml

This file was deleted.

14 changes: 14 additions & 0 deletions Resources/config/checks/apc_memory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

return function (ContainerConfigurator $container): void {
$container->services()
->set('liip_monitor.check.apc_memory', \Laminas\Diagnostics\Check\ApcMemory::class)
->args([
'%%liip_monitor.check.apc_memory.warning%%',
'%%liip_monitor.check.apc_memory.critical%%',
])
->tag('liip_monitor.check', ['alias' => 'apc_memory'])
->public();
};
14 changes: 0 additions & 14 deletions Resources/config/checks/apc_memory.xml

This file was deleted.

11 changes: 11 additions & 0 deletions Resources/config/checks/class_exists.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

return function (ContainerConfigurator $container): void {
$container->services()
->set('liip_monitor.check.class_exists', \Laminas\Diagnostics\Check\ClassExists::class)
->args(['%%liip_monitor.check.class_exists%%'])
->tag('liip_monitor.check', ['alias' => 'class_exists'])
->public();
};
13 changes: 0 additions & 13 deletions Resources/config/checks/class_exists.xml

This file was deleted.

11 changes: 11 additions & 0 deletions Resources/config/checks/cpu_performance.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

return function (ContainerConfigurator $container): void {
$container->services()
->set('liip_monitor.check.cpu_performance', \Laminas\Diagnostics\Check\CpuPerformance::class)
->args(['%%liip_monitor.check.cpu_performance%%'])
->tag('liip_monitor.check', ['alias' => 'cpu_performance'])
->public();
};
13 changes: 0 additions & 13 deletions Resources/config/checks/cpu_performance.xml

This file was deleted.

15 changes: 15 additions & 0 deletions Resources/config/checks/custom_error_pages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

return function (ContainerConfigurator $container): void {
$container->services()
->set('liip_monitor.check.custom_error_pages', \Liip\MonitorBundle\Check\CustomErrorPages::class)
->args([
'%%liip_monitor.check.custom_error_pages.error_codes%%',
'%%liip_monitor.check.custom_error_pages.path%%',
param('kernel.project_dir'),
])
->tag('liip_monitor.check', ['alias' => 'custom_error_pages'])
->public();
};
Loading