Skip to content

Commit e4e06bb

Browse files
authored
Bump minimal PHP version to 8.0 (#204)
* Bump minimal PHP version to 8.0 * Fixed ci when pushing on origin repo
1 parent 9fea656 commit e4e06bb

File tree

3 files changed

+24
-80
lines changed

3 files changed

+24
-80
lines changed

.github/workflows/tests.yml

+14-70
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,23 @@ name: Tests
22

33
on:
44
push:
5+
branches: [ main ]
56
pull_request:
67

78
jobs:
89
tests:
9-
name: PHP ${{ matrix.php }}; Symfony ${{ matrix.symfony }}
10-
runs-on: ubuntu-20.04
11-
10+
name: Test PHP ${{ matrix.php-version }} ${{ matrix.name }}
11+
runs-on: ubuntu-latest
1212
strategy:
13+
fail-fast: false
1314
matrix:
14-
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
15-
symfony: ['3', '4', '5', '6']
16-
exclude:
17-
- php: '5.6'
18-
symfony: '4'
19-
- php: '5.6'
20-
symfony: '5'
21-
- php: '5.6'
22-
symfony: '6'
23-
- php: '7.0'
24-
symfony: '4'
25-
- php: '7.0'
26-
symfony: '5'
27-
- php: '7.0'
28-
symfony: '6'
29-
- php: '7.1'
30-
symfony: '5'
31-
- php: '7.1'
32-
symfony: '6'
33-
- php: '7.2'
34-
symfony: '6'
35-
- php: '7.3'
36-
symfony: '6'
37-
- php: '7.4'
38-
symfony: '6'
39-
- php: '8.1'
40-
symfony: '3'
15+
php-version: ['8.1', '8.2']
16+
composer-flags: ['']
17+
name: ['']
18+
include:
19+
- php: 8.0
20+
composer-flags: '--prefer-lowest'
21+
name: '(prefer lowest dependencies)'
4122

4223
steps:
4324
- name: Checkout Code
@@ -47,50 +28,13 @@ jobs:
4728
uses: shivammathur/setup-php@v2
4829
with:
4930
php-version: ${{ matrix.php }}
50-
tools: composer:v2
51-
coverage: none
5231

5332
- name: Setup Problem Matchers
5433
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
5534

56-
- name: Select Symfony 3
57-
uses: nick-invision/retry@v1
58-
with:
59-
timeout_minutes: 5
60-
max_attempts: 5
61-
command: composer require "symfony/process:^3.4" --no-update --no-interaction
62-
if: "matrix.symfony == '3'"
63-
64-
- name: Select Symfony 4
65-
uses: nick-invision/retry@v1
66-
with:
67-
timeout_minutes: 5
68-
max_attempts: 5
69-
command: composer require "symfony/process:^4.4" --no-update --no-interaction
70-
if: "matrix.symfony == '4'"
71-
72-
- name: Select Symfony 5
73-
uses: nick-invision/retry@v1
74-
with:
75-
timeout_minutes: 5
76-
max_attempts: 5
77-
command: composer require "symfony/process:^5.3" --no-update --no-interaction
78-
if: "matrix.symfony == '5'"
79-
80-
- name: Select Symfony 6
81-
uses: nick-invision/retry@v1
82-
with:
83-
timeout_minutes: 5
84-
max_attempts: 5
85-
command: composer require "symfony/process:^6.0" --no-update --no-interaction
86-
if: "matrix.symfony == '6'"
87-
88-
- name: Install PHP Dependencies
89-
uses: nick-invision/retry@v1
90-
with:
91-
timeout_minutes: 5
92-
max_attempts: 5
93-
command: composer update --no-interaction --no-progress
35+
- name: Install Composer dependencies
36+
run: |
37+
composer update --prefer-dist --no-interaction ${{ matrix.composer-flags }}
9438
9539
- name: Execute PHPUnit
9640
run: vendor/bin/phpunit

composer.json

+6-9
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,20 @@
3535
}
3636
},
3737
"require": {
38-
"php": "^5.6 || ^7.0 || ^8.0",
38+
"php": "^8.0",
3939
"ext-pcre": "*",
4040
"symfony/polyfill-mbstring": "^1.7",
41-
"symfony/process": "^3.4 || ^4.4 || ^5.0 || ^6.0"
41+
"symfony/process": "^5.4 || ^6.0"
4242
},
4343
"require-dev": {
4444
"ext-fileinfo": "*",
45-
"phpspec/prophecy": "^1.10.2",
46-
"phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.20 || ^9.5.9",
45+
"phpspec/prophecy-phpunit": "^2.0",
46+
"phpunit/phpunit": "^7.5.20 || ^8.5.20 || ^9.5.9",
4747
"psr/log": "^1.0"
4848
},
49-
"suggest": {
50-
"ext-fileinfo": "Required to determine the mimetype of a blob",
51-
"psr/log": "Required to use loggers for reporting of execution"
52-
},
5349
"config": {
54-
"preferred-install": "dist"
50+
"preferred-install": "dist",
51+
"sort-packages": true
5552
},
5653
"minimum-stability": "dev",
5754
"prefer-stable": true

tests/Gitonomy/Git/Tests/RepositoryTest.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
use Gitonomy\Git\Blob;
1616
use Gitonomy\Git\Exception\RuntimeException;
1717
use Prophecy\Argument;
18+
use Prophecy\PhpUnit\ProphecyTrait;
1819

1920
class RepositoryTest extends AbstractTest
2021
{
22+
use ProphecyTrait;
23+
2124
/**
2225
* @dataProvider provideFoobar
2326
*/
@@ -40,7 +43,7 @@ public function testGetBlobWithExistingWorks($repository)
4043
public function testGetSize($repository)
4144
{
4245
$size = $repository->getSize();
43-
$this->assertGreaterThanOrEqual(69, $size, 'Repository is at least 69KB');
46+
$this->assertGreaterThanOrEqual(53, $size, 'Repository is at least 53KB');
4447
$this->assertLessThan(80, $size, 'Repository is less than 80KB');
4548
}
4649

0 commit comments

Comments
 (0)