From ce8095f22a1e27d1975bd6ed0e3462eb858ed972 Mon Sep 17 00:00:00 2001 From: Vitalii Shtykhno Date: Tue, 25 Feb 2025 14:22:12 +0100 Subject: [PATCH 1/6] chore: update dependency to psr log --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2c4e086..71c077e 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "php": ">=7.2.0", "ext-json": "*", "oat-sa/lib-health-check": "^1.1", - "psr/log": "^1.1", + "psr/log": "^1.1 || ^2.0 || ^3.0", "symfony/console": "^4.4 || ^5.0 || ^6.0", "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0", "symfony/yaml": "^4.4 || ^5.0 || ^6.0" From 48f1e9c1d254fe7478876269722d42678cf58880 Mon Sep 17 00:00:00 2001 From: Vitalii Shtykhno Date: Tue, 25 Feb 2025 14:22:29 +0100 Subject: [PATCH 2/6] feat: add continues integration to repo --- .github/workflows/continuous-integration.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/continuous-integration.yaml diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml new file mode 100644 index 0000000..6cadd11 --- /dev/null +++ b/.github/workflows/continuous-integration.yaml @@ -0,0 +1,62 @@ +name: Continuous integration + +on: + push: + branches: [ master, develop ] + pull_request: + branches: [ master, develop ] + +jobs: + build: + + runs-on: ${{ matrix.operating-system }} + if: "!contains(github.event.head_commit.message, 'ci: add updated coverage_badge.svg')" + + strategy: + fail-fast: false + matrix: + operating-system: [ ubuntu-latest ] + php-version: [ '7.2', '7.4', '8.0', '8.1', '8.2', '8.3'] + include: + - php-version: '7.2' + coverage: true + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.head_ref || github.ref_name }} + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: php${{ matrix.coverage && ' -dxdebug.mode=coverage' }} vendor/bin/phpunit --coverage-clover clover.xml --log-junit junit.xml + continue-on-error: true + + - name: Publish a test report + uses: mikepenz/action-junit-report@v3 + with: + report_paths: 'junit.xml' + fail_on_failure: true + require_tests: true + summary: PHP ${{ matrix.php-version }} + + - name: Generate a coverage badge + uses: timkrase/phpunit-coverage-badge@v1.2.0 + if: ${{ matrix.coverage }} + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Push a coverage badge + uses: EndBug/add-and-commit@v9 + if: ${{ matrix.coverage }} + with: + add: coverage_badge.svg + commit: --signoff + message: 'ci: add updated coverage_badge.svg' From 6c23fe27d45a3d00f2d7c384fe35eedc828d3f12 Mon Sep 17 00:00:00 2001 From: Vitalii Shtykhno Date: Tue, 25 Feb 2025 14:26:55 +0100 Subject: [PATCH 3/6] chore: allow phpunit 9.5 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 71c077e..be9b3a1 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "symfony/yaml": "^4.4 || ^5.0 || ^6.0" }, "require-dev": { - "phpunit/phpunit": "8.5.14", + "phpunit/phpunit": "8.5.14 || ^9.5", "php-coveralls/php-coveralls": "^2.4", "symfony/browser-kit": "^4.4 || ^5.0" }, From 2112054bcfa701a4e0782a0ae4485d505d5c7ad6 Mon Sep 17 00:00:00 2001 From: Vitalii Shtykhno Date: Tue, 25 Feb 2025 14:39:37 +0100 Subject: [PATCH 4/6] test: add to support new php version for tests --- Tests/Functional/Action/HealthCheckActionTest.php | 4 ++-- Tests/Functional/Command/HealthCheckCommandTest.php | 4 ++-- Tests/Resources/Kernel/HealthCheckTestKernel.php | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Tests/Functional/Action/HealthCheckActionTest.php b/Tests/Functional/Action/HealthCheckActionTest.php index 809323a..86906d7 100644 --- a/Tests/Functional/Action/HealthCheckActionTest.php +++ b/Tests/Functional/Action/HealthCheckActionTest.php @@ -45,7 +45,7 @@ protected function setUp(): void $this->client = static::createClient(); - $this->logger = static::$container->get(LoggerInterface::class); + $this->logger = $this->getContainer()->get(LoggerInterface::class); } public function testHealthCheckEndpointWithRegisteredSuccessCheckers(): void @@ -81,7 +81,7 @@ public function testHealthCheckEndpointWithRegisteredSuccessCheckers(): void public function testHealthCheckEndpointWithAddedFailingChecker(): void { // registers manually a supplementary failing checker onto the registered HealthChecker container service - static::$container->get(HealthChecker::class)->registerChecker(new ErrorTestChecker()); + $this->getContainer()->get(HealthChecker::class)->registerChecker(new ErrorTestChecker()); $this->client->request(Request::METHOD_GET, '/health-check'); diff --git a/Tests/Functional/Command/HealthCheckCommandTest.php b/Tests/Functional/Command/HealthCheckCommandTest.php index 29f59fb..d6f44fb 100644 --- a/Tests/Functional/Command/HealthCheckCommandTest.php +++ b/Tests/Functional/Command/HealthCheckCommandTest.php @@ -45,7 +45,7 @@ protected function setUp(): void $this->commandTester = new CommandTester($application->find(HealthCheckCommand::NAME)); - $this->logger = static::$container->get(LoggerInterface::class); + $this->logger = $this->getContainer()->get(LoggerInterface::class); } public function testHealthCheckCommandWithRegisteredSuccessCheckers(): void @@ -65,7 +65,7 @@ public function testHealthCheckCommandWithRegisteredSuccessCheckers(): void public function testHealthCheckCommandWithAddedFailingChecker(): void { // registers manually a supplementary failing checker onto the registered HealthChecker container service - static::$container->get(HealthChecker::class)->registerChecker(new ErrorTestChecker()); + $this->getContainer()->get(HealthChecker::class)->registerChecker(new ErrorTestChecker()); $result = $this->commandTester->execute([]); diff --git a/Tests/Resources/Kernel/HealthCheckTestKernel.php b/Tests/Resources/Kernel/HealthCheckTestKernel.php index 11dda82..b175ed8 100644 --- a/Tests/Resources/Kernel/HealthCheckTestKernel.php +++ b/Tests/Resources/Kernel/HealthCheckTestKernel.php @@ -28,13 +28,13 @@ use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\Routing\RouteCollectionBuilder; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; class HealthCheckTestKernel extends Kernel { use MicroKernelTrait; - public function registerBundles() + public function registerBundles(): array { return [ new FrameworkBundle(), @@ -42,15 +42,15 @@ public function registerBundles() ]; } - protected function configureRoutes(RouteCollectionBuilder $routes): void + protected function configureRoutes(RoutingConfigurator $routes): void { - $routes->import(__DIR__ .'/../../../Resources/config/routing/health_check_ping.yaml'); - $routes->import(__DIR__ .'/../../../Resources/config/routing/health_check_check.yaml'); + $routes->import(__DIR__ . '/../../../Resources/config/routing/health_check_ping.yaml'); + $routes->import(__DIR__ . '/../../../Resources/config/routing/health_check_check.yaml'); } protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void { - $loader->load(__DIR__ .'/../../../Resources/config/services.yaml'); + $loader->load(__DIR__ . '/../../../Resources/config/services.yaml'); $loader->load(__DIR__ . '/services.yaml'); $loader->load(__DIR__ . '/config.yaml'); } From eceaeef852bf2146f0fe8db7f4afb5cdf23c7d5c Mon Sep 17 00:00:00 2001 From: Vitalii Shtykhno Date: Tue, 25 Feb 2025 18:54:53 +0100 Subject: [PATCH 5/6] chore: correct continuous integrations --- .github/workflows/continuous-integration.yaml | 49 +++++++++---------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 6cadd11..d8a0190 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -2,23 +2,26 @@ name: Continuous integration on: push: - branches: [ master, develop ] + branches: [ master ] pull_request: - branches: [ master, develop ] + branches: [ master ] + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true jobs: build: - runs-on: ${{ matrix.operating-system }} - if: "!contains(github.event.head_commit.message, 'ci: add updated coverage_badge.svg')" + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - operating-system: [ ubuntu-latest ] - php-version: [ '7.2', '7.4', '8.0', '8.1', '8.2', '8.3'] + php-version: [ '7.4', '8.0', '8.1', '8.2', '8.3' ] + coverage: [ false ] include: - - php-version: '7.2' + - php-version: '8.4' coverage: true steps: @@ -31,32 +34,26 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + + - name: Validate composer.json and composer.lock + run: composer validate --strict - name: Install dependencies run: composer install --prefer-dist --no-progress - name: Run test suite - run: php${{ matrix.coverage && ' -dxdebug.mode=coverage' }} vendor/bin/phpunit --coverage-clover clover.xml --log-junit junit.xml - continue-on-error: true + if: ${{ !matrix.coverage }} + run: vendor/bin/phpunit - - name: Publish a test report - uses: mikepenz/action-junit-report@v3 - with: - report_paths: 'junit.xml' - fail_on_failure: true - require_tests: true - summary: PHP ${{ matrix.php-version }} - - - name: Generate a coverage badge - uses: timkrase/phpunit-coverage-badge@v1.2.0 + - name: Run test suite with code coverage if: ${{ matrix.coverage }} - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} + run: php -dxdebug.mode=coverage vendor/bin/phpunit --coverage-clover coverage.xml - - name: Push a coverage badge - uses: EndBug/add-and-commit@v9 + - name: Push coverage report if: ${{ matrix.coverage }} + uses: codecov/codecov-action@v5 with: - add: coverage_badge.svg - commit: --signoff - message: 'ci: add updated coverage_badge.svg' + token: ${{ secrets.CODECOV_TOKEN }} + slug: oat-sa/bundle-health-check From f052d08d86ce6b0de3de4134f86acfac85de1f2b Mon Sep 17 00:00:00 2001 From: Vitalii Shtykhno Date: Tue, 25 Feb 2025 20:32:05 +0100 Subject: [PATCH 6/6] chore: correct composer lisence --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index be9b3a1..7bb8317 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Health Check Bundle", "keywords": ["symfony", "health", "check"], "type": "symfony-bundle", - "license": "LGPL-2.1", + "license": "LGPL-2.1-only", "require": { "php": ">=7.2.0", "ext-json": "*",