From 3e3d7063b4bc16465cb863da1cc481576f4ca507 Mon Sep 17 00:00:00 2001 From: Yoanm Date: Sat, 1 Apr 2023 16:58:08 +0200 Subject: [PATCH 1/7] Only PHP supported versions --- .github/workflows/CI.yml | 21 ++++++++++----------- .scrutinizer.yml | 2 +- composer.json | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 48b3906..13c33a8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -38,25 +38,24 @@ jobs: max-parallel: 4 matrix: php-version: - - '8.1' # Latest supported - - '8.0' # First php 8 version - - '7.4' # Latest php 7 version - - '7.3' # Lowest supported + - '8.2' # Latest supported + - '8.1' + - '8.0' # Lowest supported symfony-version: - '4.4' # Lowest LTS - '5.4' # Latest LTS exclude: # Run all symfony version only on Lowest and Latest php versions, run it only one time for others - - php-version: '8.0' + - php-version: '8.1' symfony-version: '4.4' - - php-version: '7.4' + - php-version: '8.1' symfony-version: '5.4' steps: - name: Check out code uses: actions/checkout@v3 - name: Enable coverage - if: ${{ matrix.php-version == '8.1' }} + if: ${{ matrix.php-version == '8.2' }} run: | echo "COVERAGE_OUTPUT_STYLE=clover" >> $GITHUB_ENV echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV @@ -141,10 +140,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Setup PHP 8.1 + - name: Setup PHP 8.2 uses: shivammathur/setup-php@v2 with: - php-version: 8.1 # Latest supported + php-version: 8.2 # Latest supported tools: composer coverage: none env: @@ -210,13 +209,13 @@ jobs: # - next Symfony minor version to manage with latest supported php version matrix: php-version: - - '8.2' # Current php dev version + - '8.3' # Current php dev version symfony-version: - '4.4' # Lowest LTS - '5.4' # Latest LTS include: - symfony-version: '6.0' # Next symfony minor version to manage with latest supported PHP version - php-version: '8.1' + php-version: '8.2' steps: - name: Check out code diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 6e1a81c..5e6d01b 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -45,7 +45,7 @@ build: COVERAGE_OUTPUT_STYLE: 'clover' COVERAGE_CLOVER_FILE_PATH: 'build/coverage/clover.xml' php: - version: "8.1" + version: "8.2" ini: memory_limit: "-1" timezone: UTC diff --git a/composer.json b/composer.json index e9852d3..0a884b4 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "yoanm/symfony-jsonrpc-http-server-doc": "JSON-RPC documentation Bundle" }, "require": { - "php": "^7.3 || ^8.0", + "php": "^8.0", "psr/container": "^1.0", "symfony/config": "^4.4 || ^5.4", "symfony/dependency-injection": "^4.4 || ^5.4", From fce6a18ac709701dcf23548e313b65c535a11ac5 Mon Sep 17 00:00:00 2001 From: Yoanm Date: Sat, 1 Apr 2023 17:15:24 +0200 Subject: [PATCH 2/7] Improve CI matrix --- .github/workflows/CI.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 13c33a8..253e247 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -37,19 +37,21 @@ jobs: fail-fast: true max-parallel: 4 matrix: - php-version: - - '8.2' # Latest supported - - '8.1' - - '8.0' # Lowest supported - symfony-version: - - '4.4' # Lowest LTS - - '5.4' # Latest LTS - exclude: - # Run all symfony version only on Lowest and Latest php versions, run it only one time for others - - php-version: '8.1' - symfony-version: '4.4' - - php-version: '8.1' - symfony-version: '5.4' + include: + # Bare minimum => Lowest versions allowed by composer config + - symfony-version: '4.4' + php-version: '8.0' + composer-flag: --prefer-lowest + # Up to date versions => Latest versions allowed by composer config + - symfony-version: '5.4' + php-version: '8.2' + # Late symfony migration => Lowest symfony version with latest minor php version allowed by composer config + - symfony-version: '4.4' + php-version: '8.2' + composer-flag: --prefer-lowest + # Late php migration => Latest symfony version with lowest minor php version allowed by composer config + - symfony-version: '5.4' + php-version: '8.0' steps: - name: Check out code uses: actions/checkout@v3 @@ -92,13 +94,14 @@ jobs: - name: Build run: | - composer require -W \ + composer require -W ${{ env.COMPOSER_OPTIONS }} \ symfony/http-foundation:^${{ matrix.symfony-version }} \ symfony/http-kernel:^${{ matrix.symfony-version }} \ symfony/config:^${{ matrix.symfony-version }} \ symfony/dependency-injection:^${{ matrix.symfony-version }} \ symfony/event-dispatcher:^${{ matrix.symfony-version }} \ symfony/routing:^${{ matrix.symfony-version }} \ + && composer update ${{ matrix.composer-flag }} \ && make build - name: Tests From d7c8cc567f548383ce54ddd754cc4cbc73035d1b Mon Sep 17 00:00:00 2001 From: Yoanm Date: Sat, 1 Apr 2023 17:48:22 +0200 Subject: [PATCH 3/7] Fix CI for sf 4.4 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 253e247..e3d74be 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -46,7 +46,7 @@ jobs: - symfony-version: '5.4' php-version: '8.2' # Late symfony migration => Lowest symfony version with latest minor php version allowed by composer config - - symfony-version: '4.4' + - symfony-version: '4.4.30' # Issue with ParamterBag below 4.4.30 => https://github.com/symfony/symfony/commit/3eca446b21607ea1c7a865ece2dd8254c33679cc php-version: '8.2' composer-flag: --prefer-lowest # Late php migration => Latest symfony version with lowest minor php version allowed by composer config From 7ace6655539f1e401c0080c68ae811de19b218b6 Mon Sep 17 00:00:00 2001 From: Yoanm Date: Sat, 1 Apr 2023 18:29:44 +0200 Subject: [PATCH 4/7] Fix various deprecations/errors --- .github/workflows/CI.yml | 11 ++++++----- behat.yml | 1 - composer.json | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e3d74be..90e8d52 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -82,7 +82,7 @@ jobs: ${{ env.CODACY_CACHE_PATH }} build/behat-code-coverage-cache # Clear the cache if composer json (as composer.lock is in the repo) has been updated - key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }} + key: tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ matrix.composer-flag }}-${{ hashFiles('composer.json') }} - name: Download codacy binary if: steps.cache.outputs.cache-hit != 'true' @@ -94,7 +94,7 @@ jobs: - name: Build run: | - composer require -W ${{ env.COMPOSER_OPTIONS }} \ + composer require -W ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \ symfony/http-foundation:^${{ matrix.symfony-version }} \ symfony/http-kernel:^${{ matrix.symfony-version }} \ symfony/config:^${{ matrix.symfony-version }} \ @@ -160,7 +160,7 @@ jobs: path: | ~/.composer # Clear the cache if composer json (as composer.lock is in the repo) has been updated - key: ${{ env.CACHE_VERSION }}-tests-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json') }} + key: tests-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json') }} - name: Build run: make build @@ -184,7 +184,7 @@ jobs: with: path: | ${{ env.CODACY_CACHE_PATH }} - key: ${{ env.CACHE_VERSION }}-codacy-final + key: codacy-final - name: Download codacy binary if: steps.cache.outputs.cache-hit != 'true' @@ -242,7 +242,7 @@ jobs: ~/.composer ./vendor # Clear the cache if composer json (as composer.lock is in the repo) has been updated - key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }} + key: tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }} - name: Build run: | @@ -253,6 +253,7 @@ jobs: symfony/dependency-injection:^${{ matrix.symfony-version }} \ symfony/event-dispatcher:^${{ matrix.symfony-version }} \ symfony/routing:^${{ matrix.symfony-version }} \ + && composer update \ && make build - name: Test diff --git a/behat.yml b/behat.yml index 25d85f1..4244bfa 100644 --- a/behat.yml +++ b/behat.yml @@ -1,7 +1,6 @@ default: extensions: DVDoug\Behat\CodeCoverage\Extension: - cache: build/behat-code-coverage-cache filter: include: directories: diff --git a/composer.json b/composer.json index 0a884b4..25ee50c 100644 --- a/composer.json +++ b/composer.json @@ -41,14 +41,14 @@ "yoanm/jsonrpc-server-sdk": "^3.0" }, "require-dev": { - "behat/behat": "~3.0", - "squizlabs/php_codesniffer": "3.*", + "behat/behat": "^3.9.0", + "squizlabs/php_codesniffer": "^3.5", "phpunit/phpunit": "^8.0 || ^9.0", + "phpunit/php-code-coverage": "^9.2.4", "matthiasnoback/symfony-dependency-injection-test": "^3.0 || ^4.0", "matthiasnoback/symfony-config-test": "^3.0 || ^4.0", "symfony/framework-bundle": "^4.4 || ^5.4", - "symfony/routing": "^4.4 || ^5.4", - "yoanm/php-unit-extended": "~1.0", + "yoanm/php-unit-extended": "^1.1", "phpspec/prophecy-phpunit": "^2.0", "dvdoug/behat-code-coverage": "^5.0" }, From 96ac7ceae29e3ae2395ddc6bebbdc392825ac517 Mon Sep 17 00:00:00 2001 From: Yoanm Date: Sat, 1 Apr 2023 22:46:15 +0200 Subject: [PATCH 5/7] Fix CI config --- .github/workflows/CI.yml | 19 +++++-------------- composer.json | 2 +- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 90e8d52..200bcfc 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -16,17 +16,11 @@ concurrency: cancel-in-progress: true env: - # Cache params - CACHE_VERSION: 2022061905 # To be able to create a new cache (YYYYMMDDXX) TEST_OUTPUT_STYLE: pretty COMPOSER_OPTIONS: --optimize-autoloader CODACY_CACHE_PATH: ~/.cache/codacy CODACY_BIN: ~/.cache/codacy/codacy.sh - -#permissions: -# actions: write # Required to be able to trigger sub CI workflows - jobs: tests: name: UTs & FTs - Symfony ${{ matrix.symfony-version }} @@ -94,14 +88,14 @@ jobs: - name: Build run: | - composer require -W ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \ + composer require -W ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \ symfony/http-foundation:^${{ matrix.symfony-version }} \ symfony/http-kernel:^${{ matrix.symfony-version }} \ symfony/config:^${{ matrix.symfony-version }} \ symfony/dependency-injection:^${{ matrix.symfony-version }} \ symfony/event-dispatcher:^${{ matrix.symfony-version }} \ symfony/routing:^${{ matrix.symfony-version }} \ - && composer update ${{ matrix.composer-flag }} \ + && composer update ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \ && make build - name: Tests @@ -110,7 +104,7 @@ jobs: # Upload to codacy first as codecov action always remove coverage files despite move_coverage_to_trash at false # And only if it's not a PR from a fork => Can't work as codacy secret is not accessible in that context - name: Upload coverages to Codacy - if: ${{ github.event.pull_request.head.repo.full_name == 'yoanm/symfony-jsonrpc-http-server' && env.COVERAGE_TYPE == 'xdebug' }} + if: ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'yoanm/symfony-jsonrpc-http-server') && env.COVERAGE_TYPE == 'xdebug' }} run: ${{ env.CODACY_BIN }} report -r build/coverage-phpunit/unit.clover -r build/coverage-behat/clover.xml -r build/coverage-phpunit/functional.clover -t ${{ secrets.CODACY_PROJECT_TOKEN }} --partial # See the reports at https://codecov.io/gh/yoanm/symfony-jsonrpc-http-server @@ -175,7 +169,7 @@ jobs: finalize-codacy-coverage-report: runs-on: ubuntu-latest name: Finalize Codacy coverage report - if: ${{ github.event.pull_request.head.repo.full_name == 'yoanm/symfony-jsonrpc-http-server' }} + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'yoanm/symfony-jsonrpc-http-server' }} needs: [ tests ] steps: - name: Setup cache @@ -207,9 +201,6 @@ jobs: strategy: fail-fast: false max-parallel: 4 - # Perform tests against: - # - current php dev version with all supported symfony version - # - next Symfony minor version to manage with latest supported php version matrix: php-version: - '8.3' # Current php dev version @@ -253,7 +244,7 @@ jobs: symfony/dependency-injection:^${{ matrix.symfony-version }} \ symfony/event-dispatcher:^${{ matrix.symfony-version }} \ symfony/routing:^${{ matrix.symfony-version }} \ - && composer update \ + && composer update ${{ env.COMPOSER_OPTIONS }} \ && make build - name: Test diff --git a/composer.json b/composer.json index 25ee50c..457e3e4 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ "matthiasnoback/symfony-dependency-injection-test": "^3.0 || ^4.0", "matthiasnoback/symfony-config-test": "^3.0 || ^4.0", "symfony/framework-bundle": "^4.4 || ^5.4", - "yoanm/php-unit-extended": "^1.1", + "yoanm/php-unit-extended": "^2.0", "phpspec/prophecy-phpunit": "^2.0", "dvdoug/behat-code-coverage": "^5.0" }, From 3de7009c250493e8c0a18e60f9c5e67a6efc78ed Mon Sep 17 00:00:00 2001 From: Yoanm Date: Sat, 1 Apr 2023 23:00:01 +0200 Subject: [PATCH 6/7] Specific CI case --- .github/workflows/CI.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 200bcfc..e9941c7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -40,7 +40,7 @@ jobs: - symfony-version: '5.4' php-version: '8.2' # Late symfony migration => Lowest symfony version with latest minor php version allowed by composer config - - symfony-version: '4.4.30' # Issue with ParamterBag below 4.4.30 => https://github.com/symfony/symfony/commit/3eca446b21607ea1c7a865ece2dd8254c33679cc + - symfony-version: '4.4' php-version: '8.2' composer-flag: --prefer-lowest # Late php migration => Latest symfony version with lowest minor php version allowed by composer config @@ -88,13 +88,16 @@ jobs: - name: Build run: | + SF_VERSION=${{ matrix.symfony-version }} + # Issue with ParamterBag below 4.4.30 => https://github.com/symfony/symfony/commit/3eca446b21607ea1c7a865ece2dd8254c33679cc + test '${{ matrix.symfony-version }}' = '4.4' && test '${{ matrix.php-version }}' = '8.2' && SF_VERSION=4.4.30 composer require -W ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \ - symfony/http-foundation:^${{ matrix.symfony-version }} \ - symfony/http-kernel:^${{ matrix.symfony-version }} \ - symfony/config:^${{ matrix.symfony-version }} \ - symfony/dependency-injection:^${{ matrix.symfony-version }} \ - symfony/event-dispatcher:^${{ matrix.symfony-version }} \ - symfony/routing:^${{ matrix.symfony-version }} \ + symfony/http-foundation:^$SF_VERSION \ + symfony/http-kernel:^$SF_VERSION \ + symfony/config:^$SF_VERSION \ + symfony/dependency-injection:^$SF_VERSION \ + symfony/event-dispatcher:^$SF_VERSION \ + symfony/routing:^$SF_VERSION \ && composer update ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \ && make build From a5b76c8864aeab2c42189181538110d591d59fec Mon Sep 17 00:00:00 2001 From: Yoanm Date: Sat, 1 Apr 2023 23:08:47 +0200 Subject: [PATCH 7/7] Fix --- .github/workflows/CI.yml | 1 - composer.json | 15 ++++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e9941c7..da78f14 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -74,7 +74,6 @@ jobs: ~/.composer ./vendor ${{ env.CODACY_CACHE_PATH }} - build/behat-code-coverage-cache # Clear the cache if composer json (as composer.lock is in the repo) has been updated key: tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ matrix.composer-flag }}-${{ hashFiles('composer.json') }} diff --git a/composer.json b/composer.json index 457e3e4..f3dab11 100644 --- a/composer.json +++ b/composer.json @@ -42,15 +42,16 @@ }, "require-dev": { "behat/behat": "^3.9.0", - "squizlabs/php_codesniffer": "^3.5", - "phpunit/phpunit": "^8.0 || ^9.0", + "dvdoug/behat-code-coverage": "^5.0", + "matthiasnoback/symfony-config-test": "^4.0", + "matthiasnoback/symfony-dependency-injection-test": "^4.0", + "phpspec/prophecy-phpunit": "^2.0", "phpunit/php-code-coverage": "^9.2.4", - "matthiasnoback/symfony-dependency-injection-test": "^3.0 || ^4.0", - "matthiasnoback/symfony-config-test": "^3.0 || ^4.0", + "phpunit/phpunit": "^9.0", + "squizlabs/php_codesniffer": "^3.5", "symfony/framework-bundle": "^4.4 || ^5.4", - "yoanm/php-unit-extended": "^2.0", - "phpspec/prophecy-phpunit": "^2.0", - "dvdoug/behat-code-coverage": "^5.0" + "symfony/routing": "^4.4 || ^5.4", + "yoanm/php-unit-extended": "^2.0" }, "config": { "sort-packages": true