From e4e06bb9db45728a3a9f05499cb4295fd6f3bdba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Mon, 22 May 2023 17:00:21 +0200 Subject: [PATCH] Bump minimal PHP version to 8.0 (#204) * Bump minimal PHP version to 8.0 * Fixed ci when pushing on origin repo --- .github/workflows/tests.yml | 84 ++++----------------- composer.json | 15 ++-- tests/Gitonomy/Git/Tests/RepositoryTest.php | 5 +- 3 files changed, 24 insertions(+), 80 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 34cc660..79d8bf1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,42 +2,23 @@ name: Tests on: push: + branches: [ main ] pull_request: jobs: tests: - name: PHP ${{ matrix.php }}; Symfony ${{ matrix.symfony }} - runs-on: ubuntu-20.04 - + name: Test PHP ${{ matrix.php-version }} ${{ matrix.name }} + runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] - symfony: ['3', '4', '5', '6'] - exclude: - - php: '5.6' - symfony: '4' - - php: '5.6' - symfony: '5' - - php: '5.6' - symfony: '6' - - php: '7.0' - symfony: '4' - - php: '7.0' - symfony: '5' - - php: '7.0' - symfony: '6' - - php: '7.1' - symfony: '5' - - php: '7.1' - symfony: '6' - - php: '7.2' - symfony: '6' - - php: '7.3' - symfony: '6' - - php: '7.4' - symfony: '6' - - php: '8.1' - symfony: '3' + php-version: ['8.1', '8.2'] + composer-flags: [''] + name: [''] + include: + - php: 8.0 + composer-flags: '--prefer-lowest' + name: '(prefer lowest dependencies)' steps: - name: Checkout Code @@ -47,50 +28,13 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - tools: composer:v2 - coverage: none - name: Setup Problem Matchers run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - name: Select Symfony 3 - uses: nick-invision/retry@v1 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer require "symfony/process:^3.4" --no-update --no-interaction - if: "matrix.symfony == '3'" - - - name: Select Symfony 4 - uses: nick-invision/retry@v1 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer require "symfony/process:^4.4" --no-update --no-interaction - if: "matrix.symfony == '4'" - - - name: Select Symfony 5 - uses: nick-invision/retry@v1 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer require "symfony/process:^5.3" --no-update --no-interaction - if: "matrix.symfony == '5'" - - - name: Select Symfony 6 - uses: nick-invision/retry@v1 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer require "symfony/process:^6.0" --no-update --no-interaction - if: "matrix.symfony == '6'" - - - name: Install PHP Dependencies - uses: nick-invision/retry@v1 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer update --no-interaction --no-progress + - name: Install Composer dependencies + run: | + composer update --prefer-dist --no-interaction ${{ matrix.composer-flags }} - name: Execute PHPUnit run: vendor/bin/phpunit diff --git a/composer.json b/composer.json index 86735c1..fe0dd35 100644 --- a/composer.json +++ b/composer.json @@ -35,23 +35,20 @@ } }, "require": { - "php": "^5.6 || ^7.0 || ^8.0", + "php": "^8.0", "ext-pcre": "*", "symfony/polyfill-mbstring": "^1.7", - "symfony/process": "^3.4 || ^4.4 || ^5.0 || ^6.0" + "symfony/process": "^5.4 || ^6.0" }, "require-dev": { "ext-fileinfo": "*", - "phpspec/prophecy": "^1.10.2", - "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.20 || ^9.5.9", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^7.5.20 || ^8.5.20 || ^9.5.9", "psr/log": "^1.0" }, - "suggest": { - "ext-fileinfo": "Required to determine the mimetype of a blob", - "psr/log": "Required to use loggers for reporting of execution" - }, "config": { - "preferred-install": "dist" + "preferred-install": "dist", + "sort-packages": true }, "minimum-stability": "dev", "prefer-stable": true diff --git a/tests/Gitonomy/Git/Tests/RepositoryTest.php b/tests/Gitonomy/Git/Tests/RepositoryTest.php index 7ff6a19..de433df 100644 --- a/tests/Gitonomy/Git/Tests/RepositoryTest.php +++ b/tests/Gitonomy/Git/Tests/RepositoryTest.php @@ -15,9 +15,12 @@ use Gitonomy\Git\Blob; use Gitonomy\Git\Exception\RuntimeException; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; class RepositoryTest extends AbstractTest { + use ProphecyTrait; + /** * @dataProvider provideFoobar */ @@ -40,7 +43,7 @@ public function testGetBlobWithExistingWorks($repository) public function testGetSize($repository) { $size = $repository->getSize(); - $this->assertGreaterThanOrEqual(69, $size, 'Repository is at least 69KB'); + $this->assertGreaterThanOrEqual(53, $size, 'Repository is at least 53KB'); $this->assertLessThan(80, $size, 'Repository is less than 80KB'); }