Skip to content

Commit

Permalink
Use longitude-one/wkt-parser, remove php 7.4 & 8.0 support (#37)
Browse files Browse the repository at this point in the history
* Allows axi version

* Use longitude-one/wkt-parser

* Use longitude-one/wkt-parser

* Migrate tests from annotations to attributes, fixes for doctrine/annotation 2

* Remove php7.4 & 8.0 support

* Fix codeclimate error ?

Generating code coverage report in Clover XML format ... done [00:00.232]
Script phpunit --configuration phpunit.mysql5.7.xml handling the test event returned with error code 1
Error: The process '/usr/local/bin/composer' failed with exit code 1
(node:4044) UnhandledPromiseRejectionWarning: Error: The process '/usr/local/bin/composer' failed with exit code 1
    at ExecState._setResult (/home/runner/work/_actions/paambaati/codeclimate-action/v2.7.5/node_modules/@actions/exec/lib/toolrunner.js:574:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/paambaati/codeclimate-action/v2.7.5/node_modules/@actions/exec/lib/toolrunner.js:557:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/paambaati/codeclimate-action/v2.7.5/node_modules/@actions/exec/lib/toolrunner.js:451:27)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
(node:4044) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4044) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error: 🚨 Coverage run failed!

* Test: do not compare float strictly (see https://www.php.net/manual/en/language.types.float.php "Floating point precision") so tests will succeed on different linux / windows platforms

* Tests: fix 2 more tests

* Allows tests to be executed by GitHub Actions in forked repositories

* Apply php-cs-fixer command

---------

Co-authored-by: Alexis Urien <alexis@smiile.com>
  • Loading branch information
axi and Alexis Urien authored May 11, 2023
1 parent 5e08cc3 commit fbd0dbb
Show file tree
Hide file tree
Showing 279 changed files with 712 additions and 713 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ jobs:
environment: 'Test environment'
strategy:
matrix:
php: [ '7.4', '8.0' ]
php: [ '8.1' ]
name: PHP${{ matrix.php }}/MySQL5.7/MySQL8.0/PgSQL
env:
HAS_CC_SECRET: ${{secrets.CC_TEST_REPORTER_ID != '' }}
services:
mysql5:
image: mysql:5.7
Expand Down Expand Up @@ -72,12 +74,16 @@ jobs:
run: cp .github/phpunit.*.xml .
- name: Install libraries
run: composer update -vvv
- name: Run test suite and covergage
uses: paambaati/codeclimate-action@v2.7.5
- name: Run test suite and coverage
if: env.HAS_CC_SECRET == 'true'
uses: paambaati/codeclimate-action@v3.2.0
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
with:
coverageCommand: composer run-script test
coverageLocations: ${{github.workspace}}/.phpunit.cache/clover*.xml:clover
- name: Run test suite for forks
if: env.HAS_CC_SECRET != 'true'
run: composer run-script test
- name: Check quality code
run: composer run-script check-quality-code
50 changes: 32 additions & 18 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
<?php
/**
* This file is part of the doctrine spatial extension.
*
* PHP 8.1
*
* (c) Alexandre Tranchant <alexandre.tranchant@gmail.com> 2017 - 2022
* (c) Longitude One 2020 - 2022
* (c) 2015 Derek J. Lambert
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('var')
->exclude('vendor')
;

$header = <<<EOF
This file is part of the doctrine spatial extension.
$header = <<<'EOF'
This file is part of the doctrine spatial extension.
PHP 7.4 | 8.0 | 8.1
PHP 8.1
(c) Alexandre Tranchant <alexandre.tranchant@gmail.com> 2017 - 2022
(c) Longitude One 2020 - 2022
(c) 2015 Derek J. Lambert
(c) Alexandre Tranchant <alexandre.tranchant@gmail.com> 2017 - 2022
(c) Longitude One 2020 - 2022
(c) 2015 Derek J. Lambert
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

EOF;
EOF;

return (new PhpCsFixer\Config())
// ->setCacheFile(__DIR__.'/.php_cs.cache')
Expand All @@ -30,23 +43,23 @@
'@PHP70Migration' => true,
'@PHP71Migration' => true,
'@PHP73Migration' => true,
// 'strict_param' => true,
// 'strict_param' => true,
'array_syntax' => ['syntax' => 'short'],
'dir_constant' => true,
'ereg_to_preg' => true,
'header_comment' => [
'comment_type' => 'PHPDoc',
'header' => $header,
'location' => 'after_open',
'separate' => 'bottom'
'separate' => 'bottom',
],
// 'date_time_immutable' => true,
// 'declare_strict_types' => true,
// 'date_time_immutable' => true,
// 'declare_strict_types' => true,
'is_null' => true,
'mb_str_functions' => true,
'modernize_types_casting' => true,
'no_unneeded_final_method' => true,
// 'no_alias_functions' =>true,
// 'no_alias_functions' =>true,
'ordered_interfaces' => [
'direction' => 'ascend',
'order' => 'alpha',
Expand All @@ -60,12 +73,13 @@
'construct', 'destruct',
'phpunit',
'method_public_static', 'method_protected_static', 'method_private_static', 'method_static',
'method_public', 'method_protected', 'method_private', 'method', 'magic'
'method_public', 'method_protected', 'method_private', 'method', 'magic',
],
'sort_algorithm' => 'alpha'
'sort_algorithm' => 'alpha',
],
'php_unit_test_case_static_method_calls' => true,
'single_line_throw' => false
'single_line_throw' => false,
])
->setRiskyAllowed(true)
->setFinder($finder)
;
;
84 changes: 6 additions & 78 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,102 +34,30 @@ notifications:

jobs:
include:
#MySQL 5.7 PHP 7.4
- stage: PHP7.4
name: 'MySQL5.7'
php: 7.4
env: DB=mysql MYSQL_VERSION=5.7 COVERAGE=yes
services:
- mysql
#MySQL 8 PHP 7.4
- stage: PHP7.4
name: MySQL8
php: 7.4
env: DB=mysql.docker MYSQL_VERSION=8.0 COVERAGE=yes
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
#MySQLi5.7 PHP 7.4
- stage: PHP7.4
name: MySQLi5.7
php: 7.4
env: DB=mysqli MYSQL_VERSION=5.7 COVERAGE=yes
services:
- mysql
#MySQLi8 PHP 7.4
- stage: PHP7.4
name: MySQLi8.0
php: 7.4
env: DB=mysqli.docker MYSQL_VERSION=8.0 COVERAGE=yes
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
#PostgreSQL9.6 PHP7.4 Postgis 2.5
- stage: PHP7.4
name: PgSQL9.6 Postgis 2.5
php: 7.4
env: DB=pgsql POSTGRESQL_VERSION=9.6 COVERAGE=yes
addons:
postgresql: "9.6"
apt:
packages:
- postgis
- postgresql-9.6-postgis-2.5
#PostgreSQL10 PHP7.4 Postgis 2.5
- stage: PHP7.4
name: PgSQL10 Postgis 2.5
php: 7.4
env: DB=pgsql POSTGRESQL_VERSION=10.0 COVERAGE=yes
sudo: required
addons:
postgresql: "10"
apt:
packages:
- postgresql-10
- postgresql-client-10
- postgis
- postgresql-10-postgis-2.5
#PostgreSQL11 PHP7.4 Postgis 2.5
- stage: PHP7.4
name: PostgreSQL11 Postgis2.5
php: 7.4
env: DB=pgsql POSTGRESQL_VERSION=11.0 COVERAGE=yes
sudo: required
addons:
postgresql: "11"
apt:
packages:
- postgis
- postgresql-11-postgis-2.5

#MySQL 8 PHP 8.0
#MySQL 8 PHP 8.1
- stage: PHP8
name: MySQL8
php: 8.0
php: 8.1
env: DB=mysql.docker MYSQL_VERSION=8.0
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
#MySQLi 8 PHP 8.0
#MySQLi 8 PHP 8.1
- stage: PHP8
name: MySQLi8
php: 8.0
php: 8.1
env: DB=mysqli.docker MYSQL_VERSION=8.0
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
#PostgreSQL11 PHP 8.0 Postgis 2.5
#PostgreSQL11 PHP 8.1 Postgis 2.5
- stage: PHP8
name: PostgreSQL11 Postgis 2.5
php: 8.0
php: 8.1
env: DB=pgsql POSTGRESQL_VERSION=11.0
sudo: required
addons:
Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@
All notable changes to this project will be documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
This project adheres to [Semantic Versioning](https://semver.org/).

## LongitudeOne/doctrine-spatial [3.0.0-dev]
## LongitudeOne/doctrine-spatial [4.0.0-dev]

### Changed
- longitude-one/wkt-parser replaces creof/wkt-parser

### Removed
- Removing support of PHP7.4, PHP8.0

### TODO
- Support of CircleCI on Github actions (help is welcomed)
- Support for code coverage on Github Actions (help is welcomed)


## LongitudeOne/doctrine-spatial [3.0.2] - 2022-02-16

### Added
- longitude-one/doctrine-spatial replaces CrEOF/doctrine2-spatial
- Support of PHP8.0
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ because project seems to be non-active since 2017.
The `dev` branch can be used, but be careful backward compatibility aren't warrantied.
The `main` branch will be dedicated to fix issue.
The release 3.0 has been published during summer 2021.
The release 3.1 will published during spring 2022.
The release 4.0 will be published during winter 2022 and compatibility with PHP7.4 will be abandoned because of
The release 4.0 will be published during spring 2023 and compatibility with PHP7.4 and 8.0 will be abandoned because of
[PHP roadmap](https://www.php.net/supported-versions.php)

Compatibility
-------------
### PHP
This doctrine extension is compatible with PHP 7.4+ and PHP 8.0
This doctrine extension is compatible with PHP 8.1+
Security fixes will follow the [PHP Roadmap](https://www.php.net/supported-versions.php).

### MySQL 5.7 and 8.0
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"creof/doctrine2-spatial": "*"
},
"require": {
"php": "^7.4|^8.0",
"php": "^8.1",
"ext-json": "*",
"ext-mbstring": "*",
"creof/geo-parser": "~2.2",
"creof/wkt-parser": "~2.2",
"longitude-one/wkt-parser": "dev-main",
"creof/wkb-parser": "~2.3",
"doctrine/orm": "^2.8.0"
},
Expand Down Expand Up @@ -68,5 +68,7 @@
"LongitudeOne\\Spatial": "lib/",
"LongitudeOne\\Spatial\\Tests": "tests/"
}
}
},
"repositories" : [
]
}
10 changes: 5 additions & 5 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Docker
======

This directory is only used to help the contributing developers. It creates a docker environment with PHP 7.4,
This directory is only used to help the contributing developers. It creates a docker environment with PHP 8.1,
PostgreSQL/PostGis, MySQL5.7 and MySQL8.0. Feel free to use it or to use another solution.

How to start services?
Expand All @@ -15,7 +15,7 @@ docker exec spatial-php composer update
How to start test
-----------------
```bash
docker exec spatial-php cp docker/phpunit*.xml .
docker exec spatial-php composer test-mysql5
docker exec spatial-php composer test-mysql8
docker exec spatial-php composer test-pgsql
docker exec spatial-php8 cp docker/phpunit*.xml .
docker exec spatial-php8 composer test-mysql5
docker exec spatial-php8 composer test-mysql8
docker exec spatial-php8 composer test-pgsql
6 changes: 0 additions & 6 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ services:
context: ./php8
volumes:
- ${APP_FOLDER}:/var/www
php7:
container_name: "spatial-php7"
build:
context: ./php7
volumes:
- ${APP_FOLDER}:/var/www
database-pgsql:
container_name: "spatial-postgis"
image: postgis/postgis
Expand Down
19 changes: 0 additions & 19 deletions docker/php7/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion docker/php8/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8-fpm-alpine
FROM php:8.1-fpm-alpine

RUN apk --update --no-cache add bash git postgresql-dev mysql-dev \
&& docker-php-ext-install pdo_pgsql pdo_mysql \
Expand Down
2 changes: 1 addition & 1 deletion docs/Contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Don't forget to check your code respect our standard of quality:

.. code-block:: bash
docker exec spatial-php7 composer check-quality-code
docker exec spatial-php8 composer check-quality-code
How to test your new function?
------------------------------
Expand Down
Loading

0 comments on commit fbd0dbb

Please sign in to comment.