Skip to content

Commit dc9ff3a

Browse files
authored
PHP 8+ only (#90)
1 parent db35271 commit dc9ff3a

File tree

4 files changed

+49
-53
lines changed

4 files changed

+49
-53
lines changed

.github/workflows/CI.yml

+38-42
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,11 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
env:
19-
# Cache params
20-
CACHE_VERSION: 2022061905 # To be able to create a new cache (YYYYMMDDXX)
2119
TEST_OUTPUT_STYLE: pretty
2220
COMPOSER_OPTIONS: --optimize-autoloader
2321
CODACY_CACHE_PATH: ~/.cache/codacy
2422
CODACY_BIN: ~/.cache/codacy/codacy.sh
2523

26-
27-
#permissions:
28-
# actions: write # Required to be able to trigger sub CI workflows
29-
3024
jobs:
3125
tests:
3226
name: UTs & FTs - Symfony ${{ matrix.symfony-version }}
@@ -37,26 +31,27 @@ jobs:
3731
fail-fast: true
3832
max-parallel: 4
3933
matrix:
40-
php-version:
41-
- '8.1' # Latest supported
42-
- '8.0' # First php 8 version
43-
- '7.4' # Latest php 7 version
44-
- '7.3' # Lowest supported
45-
symfony-version:
46-
- '4.4' # Lowest LTS
47-
- '5.4' # Latest LTS
48-
exclude:
49-
# Run all symfony version only on Lowest and Latest php versions, run it only one time for others
50-
- php-version: '8.0'
51-
symfony-version: '4.4'
52-
- php-version: '7.4'
53-
symfony-version: '5.4'
34+
include:
35+
# Bare minimum => Lowest versions allowed by composer config
36+
- symfony-version: '4.4'
37+
php-version: '8.0'
38+
composer-flag: --prefer-lowest
39+
# Up to date versions => Latest versions allowed by composer config
40+
- symfony-version: '5.4'
41+
php-version: '8.2'
42+
# Late symfony migration => Lowest symfony version with latest minor php version allowed by composer config
43+
- symfony-version: '4.4'
44+
php-version: '8.2'
45+
composer-flag: --prefer-lowest
46+
# Late php migration => Latest symfony version with lowest minor php version allowed by composer config
47+
- symfony-version: '5.4'
48+
php-version: '8.0'
5449
steps:
5550
- name: Check out code
5651
uses: actions/checkout@v3
5752

5853
- name: Enable coverage
59-
if: ${{ matrix.php-version == '8.1' }}
54+
if: ${{ matrix.php-version == '8.2' }}
6055
run: |
6156
echo "COVERAGE_OUTPUT_STYLE=clover" >> $GITHUB_ENV
6257
echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV
@@ -79,9 +74,8 @@ jobs:
7974
~/.composer
8075
./vendor
8176
${{ env.CODACY_CACHE_PATH }}
82-
build/behat-code-coverage-cache
8377
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
84-
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
78+
key: tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ matrix.composer-flag }}-${{ hashFiles('composer.json') }}
8579

8680
- name: Download codacy binary
8781
if: steps.cache.outputs.cache-hit != 'true'
@@ -93,13 +87,17 @@ jobs:
9387
9488
- name: Build
9589
run: |
96-
composer require -W \
97-
symfony/http-foundation:^${{ matrix.symfony-version }} \
98-
symfony/http-kernel:^${{ matrix.symfony-version }} \
99-
symfony/config:^${{ matrix.symfony-version }} \
100-
symfony/dependency-injection:^${{ matrix.symfony-version }} \
101-
symfony/event-dispatcher:^${{ matrix.symfony-version }} \
102-
symfony/routing:^${{ matrix.symfony-version }} \
90+
SF_VERSION=${{ matrix.symfony-version }}
91+
# Issue with ParamterBag below 4.4.30 => https://github.com/symfony/symfony/commit/3eca446b21607ea1c7a865ece2dd8254c33679cc
92+
test '${{ matrix.symfony-version }}' = '4.4' && test '${{ matrix.php-version }}' = '8.2' && SF_VERSION=4.4.30
93+
composer require -W ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \
94+
symfony/http-foundation:^$SF_VERSION \
95+
symfony/http-kernel:^$SF_VERSION \
96+
symfony/config:^$SF_VERSION \
97+
symfony/dependency-injection:^$SF_VERSION \
98+
symfony/event-dispatcher:^$SF_VERSION \
99+
symfony/routing:^$SF_VERSION \
100+
&& composer update ${{ env.COMPOSER_OPTIONS }} ${{ matrix.composer-flag }} \
103101
&& make build
104102
105103
- name: Tests
@@ -108,7 +106,7 @@ jobs:
108106
# Upload to codacy first as codecov action always remove coverage files despite move_coverage_to_trash at false
109107
# And only if it's not a PR from a fork => Can't work as codacy secret is not accessible in that context
110108
- name: Upload coverages to Codacy
111-
if: ${{ github.event.pull_request.head.repo.full_name == 'yoanm/symfony-jsonrpc-http-server' && env.COVERAGE_TYPE == 'xdebug' }}
109+
if: ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'yoanm/symfony-jsonrpc-http-server') && env.COVERAGE_TYPE == 'xdebug' }}
112110
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
113111

114112
# See the reports at https://codecov.io/gh/yoanm/symfony-jsonrpc-http-server
@@ -141,10 +139,10 @@ jobs:
141139
steps:
142140
- uses: actions/checkout@v3
143141

144-
- name: Setup PHP 8.1
142+
- name: Setup PHP 8.2
145143
uses: shivammathur/setup-php@v2
146144
with:
147-
php-version: 8.1 # Latest supported
145+
php-version: 8.2 # Latest supported
148146
tools: composer
149147
coverage: none
150148
env:
@@ -158,7 +156,7 @@ jobs:
158156
path: |
159157
~/.composer
160158
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
161-
key: ${{ env.CACHE_VERSION }}-tests-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json') }}
159+
key: tests-${{ env.PHP_VERSION }}-${{ hashFiles('composer.json') }}
162160

163161
- name: Build
164162
run: make build
@@ -173,7 +171,7 @@ jobs:
173171
finalize-codacy-coverage-report:
174172
runs-on: ubuntu-latest
175173
name: Finalize Codacy coverage report
176-
if: ${{ github.event.pull_request.head.repo.full_name == 'yoanm/symfony-jsonrpc-http-server' }}
174+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'yoanm/symfony-jsonrpc-http-server' }}
177175
needs: [ tests ]
178176
steps:
179177
- name: Setup cache
@@ -182,7 +180,7 @@ jobs:
182180
with:
183181
path: |
184182
${{ env.CODACY_CACHE_PATH }}
185-
key: ${{ env.CACHE_VERSION }}-codacy-final
183+
key: codacy-final
186184

187185
- name: Download codacy binary
188186
if: steps.cache.outputs.cache-hit != 'true'
@@ -205,18 +203,15 @@ jobs:
205203
strategy:
206204
fail-fast: false
207205
max-parallel: 4
208-
# Perform tests against:
209-
# - current php dev version with all supported symfony version
210-
# - next Symfony minor version to manage with latest supported php version
211206
matrix:
212207
php-version:
213-
- '8.2' # Current php dev version
208+
- '8.3' # Current php dev version
214209
symfony-version:
215210
- '4.4' # Lowest LTS
216211
- '5.4' # Latest LTS
217212
include:
218213
- symfony-version: '6.0' # Next symfony minor version to manage with latest supported PHP version
219-
php-version: '8.1'
214+
php-version: '8.2'
220215

221216
steps:
222217
- name: Check out code
@@ -240,7 +235,7 @@ jobs:
240235
~/.composer
241236
./vendor
242237
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
243-
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
238+
key: tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}
244239

245240
- name: Build
246241
run: |
@@ -251,6 +246,7 @@ jobs:
251246
symfony/dependency-injection:^${{ matrix.symfony-version }} \
252247
symfony/event-dispatcher:^${{ matrix.symfony-version }} \
253248
symfony/routing:^${{ matrix.symfony-version }} \
249+
&& composer update ${{ env.COMPOSER_OPTIONS }} \
254250
&& make build
255251
256252
- name: Test

.scrutinizer.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ build:
4545
COVERAGE_OUTPUT_STYLE: 'clover'
4646
COVERAGE_CLOVER_FILE_PATH: 'build/coverage/clover.xml'
4747
php:
48-
version: "8.1"
48+
version: "8.2"
4949
ini:
5050
memory_limit: "-1"
5151
timezone: UTC

behat.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
default:
22
extensions:
33
DVDoug\Behat\CodeCoverage\Extension:
4-
cache: build/behat-code-coverage-cache
54
filter:
65
include:
76
directories:

composer.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"yoanm/symfony-jsonrpc-http-server-doc": "JSON-RPC documentation Bundle"
3131
},
3232
"require": {
33-
"php": "^7.3 || ^8.0",
33+
"php": "^8.0",
3434
"psr/container": "^1.0",
3535
"symfony/config": "^4.4 || ^5.4",
3636
"symfony/dependency-injection": "^4.4 || ^5.4",
@@ -41,16 +41,17 @@
4141
"yoanm/jsonrpc-server-sdk": "^3.0"
4242
},
4343
"require-dev": {
44-
"behat/behat": "~3.0",
45-
"squizlabs/php_codesniffer": "3.*",
46-
"phpunit/phpunit": "^8.0 || ^9.0",
47-
"matthiasnoback/symfony-dependency-injection-test": "^3.0 || ^4.0",
48-
"matthiasnoback/symfony-config-test": "^3.0 || ^4.0",
44+
"behat/behat": "^3.9.0",
45+
"dvdoug/behat-code-coverage": "^5.0",
46+
"matthiasnoback/symfony-config-test": "^4.0",
47+
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
48+
"phpspec/prophecy-phpunit": "^2.0",
49+
"phpunit/php-code-coverage": "^9.2.4",
50+
"phpunit/phpunit": "^9.0",
51+
"squizlabs/php_codesniffer": "^3.5",
4952
"symfony/framework-bundle": "^4.4 || ^5.4",
5053
"symfony/routing": "^4.4 || ^5.4",
51-
"yoanm/php-unit-extended": "~1.0",
52-
"phpspec/prophecy-phpunit": "^2.0",
53-
"dvdoug/behat-code-coverage": "^5.0"
54+
"yoanm/php-unit-extended": "^2.0"
5455
},
5556
"config": {
5657
"sort-packages": true

0 commit comments

Comments
 (0)