Skip to content

Commit 84d03f4

Browse files
committed
Update composer json and github workflow
1 parent d1d83ad commit 84d03f4

2 files changed

Lines changed: 49 additions & 35 deletions

File tree

.github/workflows/build.yml

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
---
21
name: build
32
on:
43
push: ~
54
pull_request: ~
6-
75
jobs:
86
linux_tests:
9-
name: PHP on ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.composer-flags }}
7+
name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.flags }}
108
runs-on: ubuntu-22.04
9+
1110
strategy:
1211
matrix:
13-
php: ['8.1', '8.2', '8.3', '8.4']
12+
php: ['8.1', '8.2', '8.3', '8.4', '8.5']
1413
stability: [prefer-lowest, prefer-stable]
14+
1515
include:
16-
- php: '8.5'
17-
flags: "--ignore-platform-req=php"
18-
stability: prefer-stable
16+
- php: '8.6'
17+
stability: prefer-stable
18+
flags: "--ignore-platform-req=php"
19+
fail-fast: false
20+
1921
steps:
2022
- name: Checkout code
2123
uses: actions/checkout@v4
@@ -26,39 +28,50 @@ jobs:
2628
php-version: ${{ matrix.php }}
2729
coverage: xdebug
2830
tools: composer:v2
29-
- name: Check PHP Version
30-
run: php -v
3131

3232
- name: Validate composer files
3333
run: composer validate --strict
3434

35-
- name: Get Composer Cache Directory
36-
id: composer-cache
37-
run: |
38-
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
39-
- uses: actions/cache@v3
35+
# Cache "vendor" so stable builds skip installation entirely
36+
- name: Cache vendor
37+
uses: actions/cache@v3
4038
with:
41-
path: ${{ steps.composer-cache.outputs.dir }}
42-
key: ${{ runner.os }}-composer-${{ matrix.stability }}-${{ matrix.flags }}-${{ hashFiles('**/composer.lock') }}
39+
path: vendor
40+
key: ${{ runner.os }}-vendor-${{ hashFiles('composer.lock') }}
4341
restore-keys: |
44-
${{ runner.os }}-composer-${{ matrix.stability }}-${{ matrix.flags }}-
45-
${{ runner.os }}-composer-
42+
${{ runner.os }}-vendor-
43+
44+
# INSTALL logic
45+
# 1. STABLE php + STABLE deps → composer install (NO updates)
46+
- name: Install dependencies (install)
47+
if: ${{ matrix.stability == 'prefer-stable' && matrix.php != '8.6' }}
48+
run: composer install --prefer-dist --no-interaction --no-progress
49+
50+
# 2. prefer-lowest → must use composer update
51+
- name: Install dependencies (prefer-lowest)
52+
if: ${{ matrix.stability == 'prefer-lowest' }}
53+
run: composer update --prefer-lowest --prefer-dist --no-interaction --no-progress
4654

47-
- name: Install dependencies
48-
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}
55+
# 3. PHP 8.6 dev → always update
56+
- name: Install dependencies (nightly)
57+
if: ${{ matrix.php == '8.6' }}
58+
run: composer update --prefer-stable --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}
4959

5060
- name: Run Unit tests with coverage
51-
run: composer phpunit -- ${{ matrix.phpunit-flags }}
52-
if: ${{ matrix.php != '8.5' }}
61+
if: ${{ matrix.php != '8.5' && matrix.php != '8.6' }}
62+
run: composer phpunit
5363

54-
- name: Run Unit tests without coverage
55-
run: vendor/bin/phpunit --no-coverage
56-
if: ${{ matrix.php == '8.5' }}
64+
- name: Run Unit tests without coverage (nightly)
65+
if: ${{ matrix.php == '8.6' }}
66+
run: composer phpunit:no-coverage
67+
continue-on-error: true
5768

69+
# STATIC ANALYSIS (only once)
5870
- name: Run static analysis
59-
run: composer phpstan-build
60-
if: ${{ matrix.php == '8.4' && matrix.stability == 'prefer-stable'}}
71+
if: ${{ matrix.php == '8.4' && matrix.stability == 'prefer-stable' }}
72+
run: composer phpstan:stable
6173

74+
# CODING STYLE (only once)
6275
- name: Run Coding style rules
76+
if: ${{ matrix.php == '8.4' && matrix.stability == 'prefer-stable' }}
6377
run: composer phpcs:fix
64-
if: ${{ matrix.php == '8.4' && matrix.stability == 'prefer-stable'}}

composer.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
"php" : "^8.1"
4747
},
4848
"require-dev": {
49-
"friendsofphp/php-cs-fixer": "^3.65.0",
50-
"phpstan/phpstan": "^1.12.12",
49+
"friendsofphp/php-cs-fixer": "^3.95.1",
50+
"phpstan/phpstan": "^1.12.33",
5151
"phpstan/phpstan-deprecation-rules": "^1.2.1",
52-
"phpstan/phpstan-phpunit": "^1.4.1",
53-
"phpstan/phpstan-strict-rules": "^1.6.1",
54-
"phpunit/phpunit": "^10.5.15 || ^11.5.0",
55-
"symfony/var-dumper": "^6.4.15"
52+
"phpstan/phpstan-phpunit": "^1.4.2",
53+
"phpstan/phpstan-strict-rules": "^1.6.2",
54+
"phpunit/phpunit": "^10.5.15 || ^11.5.0 || ^12.5.23 || ^13.1.7",
55+
"symfony/var-dumper": "^6.4.15 || ^v7.4.8 || ^v8.0.8"
5656
},
5757
"autoload": {
5858
"psr-4": {
@@ -68,7 +68,7 @@
6868
"phpstan": "phpstan analyse -c phpstan.neon --ansi --memory-limit 192M",
6969
"phpstan-build": "phpstan analyse -c phpstan-build.neon --ansi --memory-limit 192M",
7070
"phpunit": "XDEBUG_MODE=coverage phpunit --coverage-text",
71-
"phpunit:min": "phpunit --no-coverage",
71+
"phpunit:no-coverage": "phpunit --no-coverage",
7272
"test": [
7373
"@phpunit",
7474
"@phpstan",
@@ -78,6 +78,7 @@
7878
"scripts-descriptions": {
7979
"phpstan": "Runs complete codebase static analysis",
8080
"phpunit": "Runs unit and functional testing",
81+
"phpunit:no-coverage": "Runs unit and functional testing without code-coverage",
8182
"phpcs": "Runs coding style testing",
8283
"phpcs:fix": "Fix coding style issues",
8384
"test": "Runs all tests"

0 commit comments

Comments
 (0)