From 5ef7179aec69ad7ecd43262144712974089c2a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20H=C3=A9lias?= Date: Mon, 8 Apr 2024 17:24:53 +0200 Subject: [PATCH] Allow Sf 7 --- .github/workflows/phpunit.yml | 157 ++++++++++++++++++---------------- composer.json | 27 +++--- 2 files changed, 95 insertions(+), 89 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 3461a81..ccdb89d 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -1,93 +1,98 @@ name: PHPUnit on: - push: - pull_request: + push: + pull_request: concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true jobs: - test: - name: "PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }}" - runs-on: ubuntu-latest - continue-on-error: ${{ matrix.can-fail }} + test: + name: "PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }}" + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.can-fail }} - strategy: - fail-fast: false - matrix: - include: - # Lowest Deps - - php: 8.1 - symfony: 6.2.* - coverage: 'none' - composer-flags: '--prefer-stable --prefer-lowest' - can-fail: false - # LTS with latest stable PHP - - php: latest - symfony: 6.3.* - coverage: 'none' - composer-flags: '--prefer-stable' - can-fail: false - # Active release - - php: latest - symfony: 6.3.* - coverage: pcov - composer-flags: '--prefer-stable' - can-fail: false - # Development release - - php: nightly - symfony: 7.0.*@dev - coverage: 'none' - composer-flags: '' - can-fail: true + strategy: + fail-fast: false + matrix: + include: + # Lowest Deps + - php: lowest + symfony: 6.4.* + coverage: 'none' + composer-flags: '--prefer-stable --prefer-lowest' + can-fail: false + # LTS with latest stable PHP + - php: latest + symfony: 6.4.* + coverage: 'none' + composer-flags: '--prefer-stable' + can-fail: false + # Active release + - php: latest + symfony: 7.0.* + coverage: pcov + composer-flags: '--prefer-stable' + can-fail: false + # Development release + - php: nightly + symfony: 7.1.*@dev + coverage: 'none' + composer-flags: '' + can-fail: true - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 2 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: composer:v2, flex - coverage: ${{ matrix.coverage }} - ini-values: date.timezone=UTC,memory_limit=-1,session.gc_probability=0,apc.enable_cli=1,zend.assertions=1 - env: - fail-fast: true + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2, flex + coverage: ${{ matrix.coverage }} + ini-values: date.timezone=UTC,memory_limit=-1,session.gc_probability=0,apc.enable_cli=1,zend.assertions=1 + env: + fail-fast: true - - name: Set Composer stability - if: matrix.symfony == '7.0.*@dev' - run: "composer config minimum-stability dev" + - name: Set Composer stability + if: matrix.php == 'nightly' + run: "composer config minimum-stability dev" - - name: Get composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - name: Cache composer dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- + - name: Cache composer dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- - - name: Install Composer dependencies - run: composer update ${{ matrix.composer-flags }} --no-interaction --no-progress --optimize-autoloader - env: - SYMFONY_REQUIRE: ${{ matrix.symfony }} + - name: Install Composer dependencies + run: composer update ${{ matrix.composer-flags }} --no-interaction --no-progress --optimize-autoloader + env: + SYMFONY_REQUIRE: ${{ matrix.symfony }} - - name: Run tests - run: composer test + - name: Run tests + run: | + if [[ "${{ matrix.coverage }}" == 'pcov' ]]; then + composer test-coverage + else + composer test + fi - - name: Monitor coverage - if: matrix.coverage != 'none' - uses: slavcodev/coverage-monitor-action@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - coverage_path: coverage-report.xml - threshold_alert: 60 - threshold_warning: 80 + - name: Monitor coverage + if: matrix.coverage != 'none' + uses: slavcodev/coverage-monitor-action@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + coverage_path: coverage-report.xml + threshold_alert: 60 + threshold_warning: 80 diff --git a/composer.json b/composer.json index ae3410a..d29497b 100644 --- a/composer.json +++ b/composer.json @@ -27,23 +27,23 @@ "doctrine/doctrine-bundle": "^2.7.1", "doctrine/orm": "^2.14", "paragonie/ciphersweet": "^3.0 || ^4.0", - "symfony/config": "^5.4 || ^6.2", - "symfony/console": "^5.4 || ^6.2", - "symfony/dependency-injection": "^5.4 || ^6.2", + "symfony/config": "^5.4 || ^6.4 || ^7.0", + "symfony/console": "^5.4 || ^6.4 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.4 || ^7.0", "symfony/deprecation-contracts": "^2.5 || ^3.2", - "symfony/framework-bundle": "^5.4 || ^6.2", - "symfony/http-kernel": "^5.4 || ^6.2", - "symfony/process": "^5.4 || ^6.2", - "symfony/property-access": "^5.4 || ^6.2", - "symfony/property-info": "^5.4 || ^6.2", + "symfony/framework-bundle": "^5.4 || ^6.4 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.4 || ^7.0", + "symfony/process": "^5.4 || ^6.4 || ^7.0", + "symfony/property-access": "^5.4 || ^6.4 || ^7.0", + "symfony/property-info": "^5.4 || ^6.4 || ^7.0", "symfony/service-contracts": "^2.2 || ^3.2" }, "require-dev": { "phpunit/phpunit": "^9.5", - "symfony/browser-kit": "^5.4 || ^6.2", - "symfony/doctrine-bridge": "^6.2", - "symfony/phpunit-bridge": "^6.2.3", - "symfony/yaml": "^5.4 || ^6.2" + "symfony/browser-kit": "^5.4 || ^6.4 || ^7.0", + "symfony/doctrine-bridge": "^6.4", + "symfony/phpunit-bridge": "^6.4", + "symfony/yaml": "^5.4 || ^6.4 || ^7.0" }, "suggest": { "phpdocumentor/reflection-docblock": "To use the PHPDoc" @@ -62,6 +62,7 @@ "sort-packages": true }, "scripts": { - "test": "vendor/bin/phpunit --coverage-clover=coverage-report.xml" + "test": "vendor/bin/phpunit", + "test-coverage": "vendor/bin/phpunit --coverage-clover=coverage-report.xml" } }