Skip to content

Commit ac89897

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

File tree

5 files changed

+193
-149
lines changed

5 files changed

+193
-149
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 55 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"
@@ -21,19 +21,64 @@ jobs:
2121
php-version: "8.3"
2222
ini-values: memory_limit=-1
2323
tools: composer:v2
24+
- name: "Determine Composer Cache Dir"
25+
id: composer-cache
26+
run: |
27+
echo "dir=$(composer -q config cache-files-dir)" >> $GITHUB_OUTPUT
2428
- name: "Cache Dependencies"
2529
uses: "actions/cache@v4"
2630
with:
27-
path: |
28-
~/.composer/cache
29-
key: "composer-cache"
30-
restore-keys: "composer-cache"
31+
path: ${{ steps.composer-cache.outputs.dir }}
32+
key: "composer-8.3-lock"
33+
restore-keys: "composer-8.3-lock"
3134
- name: "Install Dependencies"
32-
run: "composer install --ansi --no-interaction --no-progress --no-suggest"
33-
- name: "Run Continuous Integration"
34-
run: composer ci
35+
run: "composer install --ansi --no-interaction --no-progress"
36+
- name: "Check code style"
37+
run: composer fmt:check
38+
- name: "Check Types"
39+
run: composer psalm:gh
40+
41+
test:
42+
name: Test
43+
runs-on: ubuntu-latest
44+
needs: ["checks"]
45+
strategy:
46+
matrix:
47+
php-version: ["8.3", "8.4"]
48+
deps: ["lock", "highest", "lowest"]
49+
steps:
50+
- name: "Checkout Code"
51+
uses: "actions/checkout@v4"
52+
- name: "Install PHP"
53+
uses: "shivammathur/setup-php@v2"
54+
with:
55+
coverage: "xdebug"
56+
php-version: ${{ matrix.php-version }}
57+
ini-values: memory_limit=-1
58+
tools: composer:v2
59+
- name: "Determine Composer Cache Dir"
60+
id: composer-cache
61+
run: |
62+
echo "dir=$(composer -q config cache-files-dir)" >> $GITHUB_OUTPUT
63+
- name: "Cache Dependencies"
64+
uses: "actions/cache@v4"
65+
with:
66+
path: ${{ steps.composer-cache.outputs.dir }}
67+
key: "composer-${{ matrix.php-version }}-${{ matrix.deps }}"
68+
restore-keys: "composer-${{ matrix.php-version }}-${{ matrix.deps }}"
69+
- name: "Install Dependencies"
70+
if: ${{ matrix.deps == 'lock'}}
71+
run: "composer install --ignore-platform-reqs --ansi --no-interaction --no-progress"
72+
- name: "Install Highest Dependencies"
73+
if: ${{ matrix.deps == 'highest'}}
74+
run: "composer update --ignore-platform-reqs --ansi --no-interaction --no-progress"
75+
- name: "Install Lowest Dependencies"
76+
if: ${{ matrix.deps == 'lowest'}}
77+
run: "composer update --ignore-platform-reqs --prefer-lowest --ansi --no-interaction --no-progress"
78+
- name: "Run Test Suite"
79+
run: composer test
3580
- name: "Upload Coverage Report"
3681
uses: actions/upload-artifact@v4
3782
with:
38-
name: "coverage-report"
83+
name: "coverage-report-${{ matrix.php-version }}-${{ matrix.deps }}"
3984
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)