Skip to content

Commit ebc04f7

Browse files
chore: improve test suite
1 parent 53b8b69 commit ebc04f7

File tree

5 files changed

+185
-149
lines changed

5 files changed

+185
-149
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88
branches: ["main"]
99

1010
jobs:
11-
php-checks:
12-
name: PHP Checks
11+
checks:
12+
name: Quality Checks
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: "Checkout Code"
@@ -24,16 +24,53 @@ jobs:
2424
- name: "Cache Dependencies"
2525
uses: "actions/cache@v4"
2626
with:
27-
path: |
28-
~/.composer/cache
29-
key: "composer-cache"
30-
restore-keys: "composer-cache"
27+
path: .composer/cache
28+
key: "composer-8.3-lock"
29+
restore-keys: "composer-8.3-lock"
3130
- name: "Install Dependencies"
32-
run: "composer install --ansi --no-interaction --no-progress --no-suggest"
33-
- name: "Run Continuous Integration"
34-
run: composer ci
31+
run: "composer install --ansi --no-interaction --no-progress"
32+
- name: "Check code style"
33+
run: composer fmt:check
34+
- name: "Check Types"
35+
run: composer psalm:gh
36+
37+
test:
38+
name: Test
39+
runs-on: ubuntu-latest
40+
needs: ["checks"]
41+
strategy:
42+
matrix:
43+
php-version: ["8.3", "8.4"]
44+
deps: ["lock", "highest", "lowest"]
45+
steps:
46+
- name: "Checkout Code"
47+
uses: "actions/checkout@v4"
48+
- name: "Install PHP"
49+
uses: "shivammathur/setup-php@v2"
50+
with:
51+
coverage: "xdebug"
52+
php-version: ${{ matrix.php-version }}
53+
ini-values: memory_limit=-1
54+
tools: composer:v2
55+
- name: "Cache Dependencies"
56+
uses: "actions/cache@v4"
57+
with:
58+
path: .composer/cache
59+
key: "composer-${{ matrix.php-version }}-${{ matrix.deps }}"
60+
restore-keys: "composer-${{ matrix.php-version }}-${{ matrix.deps }}"
61+
- name: "Install Dependencies"
62+
if: ${{ matrix.deps == 'lock'}}
63+
run: "composer install --ignore-platform-reqs --ansi --no-interaction --no-progress"
64+
- name: "Install Highest Dependencies"
65+
if: ${{ matrix.deps == 'highest'}}
66+
run: "composer update --ignore-platform-reqs --ansi --no-interaction --no-progress"
67+
- name: "Install Lowest Dependencies"
68+
if: ${{ matrix.deps == 'lowest'}}
69+
run: "composer update --ignore-platform-reqs --prefer-lowest --ansi --no-interaction --no-progress"
70+
- name: "Run Test Suite"
71+
run: composer test
3572
- name: "Upload Coverage Report"
3673
uses: actions/upload-artifact@v4
3774
with:
38-
name: "coverage-report"
75+
name: "coverage-report-${{ matrix.php-version }}-${{ matrix.deps }}"
3976
path: .dev/coverage

.php-cs-fixer.dist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use PhpCsFixer\Fixer\FunctionNotation\NativeFunctionInvocationFixer;
4+
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
45

56
$header = <<<EOF
67
@project Castor UUID
@@ -15,6 +16,7 @@
1516
EOF;
1617

1718
return (new PhpCsFixer\Config())
19+
->setParallelConfig(ParallelConfigFactory::detect())
1820
->setCacheFile('/tmp/php-cs-fixer')
1921
->setRiskyAllowed(true)
2022
->setRules([

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ echo $parsed instanceof Uuid\Version6; // Prints: false
3030
echo $parsed->equals($uuid); // Prints: true
3131
```
3232

33-
The same API is available for `Uuid\Version3` and `Uuid\Version5`.
33+
The same API is available for `Uuid\Version3`, `Uuid\Version5`, `Uuid\Version6` and `Uuid\Version7`.
3434

35-
`Uuid\Version1` and `Uuid\Version6` provides an extended API that can return the different components that form it.
35+
`Uuid\Version1`, `Uuid\Version6` and `Uuid\Version7` implement `Uuid\TimeBased` which provides an extended API that can
36+
return the time component that form it.
3637

3738
`Uuid\Version2` will not be implemented.

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
},
4747
"require-dev": {
4848
"phpunit/phpunit": "^10.5",
49-
"friendsofphp/php-cs-fixer": "^3.49",
50-
"vimeo/psalm": "^5.22",
49+
"friendsofphp/php-cs-fixer": "^3.68",
50+
"vimeo/psalm": "^5.26",
5151
"ergebnis/phpunit-slow-test-detector": "^2.10",
5252
"ramsey/uuid": "^4.7",
5353
"phpbench/phpbench": "^1.3"
@@ -64,7 +64,7 @@
6464
"@test"
6565
],
6666
"fmt": "php-cs-fixer fix --diff --ansi",
67-
"fmt:check": "php-cs-fixer fix --dry-run --diff --ansi",
67+
"fmt:check": "php-cs-fixer fix --dry-run --diff --show-progress=none --ansi",
6868
"test": [
6969
"phpunit --colors"
7070
],

0 commit comments

Comments
 (0)