Skip to content

Commit d3a3430

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

3 files changed

Lines changed: 55 additions & 39 deletions

File tree

.github/workflows/build.yml

Lines changed: 43 additions & 27 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,53 @@ 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: ~/.composer/cache
40+
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
4341
restore-keys: |
44-
${{ runner.os }}-composer-${{ matrix.stability }}-${{ matrix.flags }}-
45-
${{ runner.os }}-composer-
42+
${{ runner.os }}-vendor-
43+
44+
- name: Clean vendor
45+
run: rm -rf vendor
46+
47+
# INSTALL logic
48+
# 1. STABLE php + STABLE deps → composer install (NO updates)
49+
- name: Install dependencies (install)
50+
if: ${{ matrix.stability == 'prefer-stable' && matrix.php != '8.6' }}
51+
run: composer install --prefer-dist --no-interaction --no-progress
52+
53+
# 2. prefer-lowest → must use composer update
54+
- name: Install dependencies (prefer-lowest)
55+
if: ${{ matrix.stability == 'prefer-lowest' }}
56+
run: composer update --prefer-lowest --prefer-dist --no-interaction --no-progress
4657

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

5063
- name: Run Unit tests with coverage
51-
run: composer phpunit -- ${{ matrix.phpunit-flags }}
52-
if: ${{ matrix.php != '8.5' }}
64+
if: ${{ matrix.php != '8.5' && matrix.php != '8.6' }}
65+
run: composer phpunit
5366

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

72+
# STATIC ANALYSIS (only once)
5873
- name: Run static analysis
74+
if: ${{ matrix.php == '8.5' && matrix.stability == 'prefer-stable' }}
5975
run: composer phpstan-build
60-
if: ${{ matrix.php == '8.4' && matrix.stability == 'prefer-stable'}}
6176

77+
# CODING STYLE (only once)
6278
- name: Run Coding style rules
79+
if: ${{ matrix.php == '8.5' && matrix.stability == 'prefer-stable' }}
6380
run: composer phpcs:fix
64-
if: ${{ matrix.php == '8.4' && matrix.stability == 'prefer-stable'}}

composer.json

Lines changed: 10 additions & 9 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.63 || ^11.5.55 || ^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": {
@@ -65,10 +65,10 @@
6565
"scripts": {
6666
"phpcs": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --dry-run --diff -vvv --allow-risky=yes --ansi",
6767
"phpcs:fix": "php-cs-fixer fix -vvv --allow-risky=yes --ansi",
68-
"phpstan": "phpstan analyse -c phpstan.neon --ansi --memory-limit 192M",
69-
"phpstan-build": "phpstan analyse -c phpstan-build.neon --ansi --memory-limit 192M",
68+
"phpstan": "phpstan analyse -c phpstan.neon --ansi --memory-limit=256M",
69+
"phpstan-build": "phpstan analyse -c phpstan-build.neon --ansi --memory-limit=256M",
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"

src/PeriodRelationTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use DateTimeImmutable;
2828
use DateTimeInterface;
2929
use PHPUnit\Framework\Attributes\DataProvider;
30+
use function count;
3031

3132
final class PeriodRelationTest extends PeriodTestCase
3233
{
@@ -1081,9 +1082,7 @@ public function testSubtractWithEqualPeriodObjec(): void
10811082
self::assertEquals($diff, $periodA->subtract($periodA));
10821083
}
10831084

1084-
/**
1085-
* @dataProvider meetsProvider
1086-
*/
1085+
#[DataProvider('meetsProvider')]
10871086
public function testMeets(Period $period1, Period $period2, bool $meets, bool $meetsOnStart, bool $meetsOnEnd): void
10881087
{
10891088
self::assertSame($meets, $period1->meets($period2));

0 commit comments

Comments
 (0)