Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ name: PHP CI
on:
schedule:
- cron: '5 16 * * 3'
push:
paths-ignore:
- '**.md'
- LICENSE
pull_request:
paths-ignore:
- '**.md'
Expand All @@ -17,6 +13,47 @@ permissions:
pull-requests: read

jobs:
validator-compatibility:
name: Symfony Validator ${{ matrix.validator }} / PHP 8.4
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
validator: ['5.4', '6.4', '7.4']
env:
SYMFONY_VALIDATOR_VERSION: ${{ matrix.validator }}
steps:
- name: Checkout code
uses: actions/checkout@v7

- name: Set up PHP 8.4
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: pcov
tools: composer:v2
extensions: mbstring

- name: Install the selected Symfony Validator version
run: composer update --with "symfony/validator:${SYMFONY_VALIDATOR_VERSION}.*" --prefer-dist --no-interaction

- name: Verify the installed Symfony Validator version
run: |
composer show symfony/validator
php <<'PHP'
<?php
require 'vendor/autoload.php';
$version = Composer\InstalledVersions::getPrettyVersion('symfony/validator');
$expected = getenv('SYMFONY_VALIDATOR_VERSION');
if (1 !== preg_match('/^v?'.preg_quote($expected, '/').'\./', $version ?? '')) {
fwrite(STDERR, "Expected Symfony Validator $expected.x, installed $version\n");
exit(1);
}
PHP

- name: Run the complete test suite
run: composer test

stable-build:
name: PHP 8.4
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"longitude-one/geo-parser": "^4.1",
"longitude-one/spatial-core": "^1.3",
"doctrine/deprecations": "^1.1.3",
"symfony/validator": "^8.1"
"symfony/validator": "^5.4 || ^6.0 || ^7.0 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^13",
Expand Down
6 changes: 6 additions & 0 deletions docs/validators.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Spatial validators

Symfony Validator `^5.4 || ^6.0 || ^7.0 || ^8.0` is supported. Versions below
5.4 and future major versions such as 9.x are not accepted. The library still
requires PHP 8.4 or later within PHP 8.x, independently of Symfony's requirements.
CI explicitly installs and verifies Validator 5.4.x, 6.4.x, 7.4.x and 8.1.x,
then runs the complete test suite for each version.

This library exposes Symfony Validator constraints for checking spatial values.
They are useful in two complementary situations:

Expand Down
22 changes: 17 additions & 5 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Tests
# Tests

The `Unit` directory contains the unit tests of the spatial types extension.
The `Functional` directory contains functional tests.

### Running the tests
## Running the tests

To run the tests, you need to install the dependencies using composer:

Expand All @@ -17,9 +17,21 @@ Then, run the following command:
$ composer test
```

If you use the docker environment, you can run the following commands:
### Symfony Validator compatibility

CI runs the complete `composer test` suite with Symfony Validator 5.4.x,
6.4.x, 7.4.x and 8.1.x on PHP 8.4, in addition to the existing PHP 8.4 and
8.5 jobs. Each compatibility job forces its selected minor version and verifies
the installed version before running the tests.

To reproduce a compatibility run locally, use a temporary Composer constraint
(replace `5.4.*` with `6.4.*`, `7.4.*` or `8.1.*` for the other versions):

```bash
$ docker compose exec si-php8 composer install
$ docker compose exec si-php8 composer test
composer update --with 'symfony/validator:5.4.*' --prefer-dist --no-interaction
composer show symfony/validator
composer test
```

This does not change the supported range in `composer.json`. Run `composer update`
without the temporary constraint to return to the default dependency resolution.
Loading