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
164 changes: 102 additions & 62 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,99 @@ name: CI
on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: Tests (PHP ${{ matrix.php }}, PostgreSQL ${{ matrix.postgres }}, PostGIS ${{ matrix.postgis }}, ORM ${{ matrix.orm || 'default' }}, DBAL ${{ matrix.dbal || 'default' }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Lowest deps
- php: '8.0'
postgres: '11'
postgis: '3.0'
phpunit-flags: '--exclude-group=postgis-3.1'
- php: '8.1'
postgres: '14'
postgis: '3.2'
phpunit-flags: '--exclude-group=versioned'
composer-flags: '--prefer-stable --prefer-lowest'
- php: '8.1'
postgres: '14'
postgis: '3.2'
phpunit-flags: '--group=postgis-3.2'
composer-flags: '--prefer-stable --prefer-lowest'

# PostgresSQL / PostGIS matrix with ORM
# PHP 8.1, Postgres 15, ORM 2.19
- php: '8.1'
postgres: '11'
postgis: '3.0'
orm: '2.9'
phpunit-flags: '--exclude-group=postgis-3.1'
postgres: '15'
postgis: '3.4'
orm: '2.19'
phpunit-flags: '--exclude-group=versioned'
- php: '8.1'
postgres: '11'
postgis: '3.1'
orm: '2.9'
phpunit-flags: '--exclude-group=postgis-3.0'
postgres: '15'
postgis: '3.4'
orm: '2.19'
phpunit-flags: '--group=postgis-3.4'

# PHP 8.1, Postgres 16, ORM 2.19
- php: '8.1'
postgres: '12'
postgis: '3.0'
orm: '2.9'
phpunit-flags: '--exclude-group=postgis-3.1'
postgres: '16'
postgis: '3.4'
orm: '2.19'
phpunit-flags: '--exclude-group=versioned'
- php: '8.1'
postgres: '12'
postgis: '3.1'
orm: '2.9'
phpunit-flags: '--exclude-group=postgis-3.0'
postgres: '16'
postgis: '3.4'
orm: '2.19'
phpunit-flags: '--group=postgis-3.4'

# PHP 8.1, Postgres 17, ORM 3.5
- php: '8.1'
postgres: '13'
postgis: '3.0'
orm: '2.9'
phpunit-flags: '--exclude-group=postgis-3.1'
postgres: '17'
postgis: '3.6'
orm: '3.5'
phpunit-flags: '--exclude-group=versioned'
- php: '8.1'
postgres: '13'
postgis: '3.1'
orm: '2.9'
phpunit-flags: '--exclude-group=postgis-3.0'
code-coverage: 'yes'
postgres: '17'
postgis: '3.6'
orm: '3.5'
phpunit-flags: '--group=postgis-3.6'

# DBAL only
# PHP 8.1, Postgres 18, ORM 3.5
- php: '8.1'
postgres: '11'
postgis: '3.0'
dbal: '2.13'
phpunit-flags: '--exclude-group=postgis-3.1 --exclude-group=orm'
postgres: '18'
postgis: '3.6'
orm: '3.5'
phpunit-flags: '--exclude-group=versioned'
- php: '8.1'
postgres: '13'
postgis: '3.1'
dbal: '3.1'
phpunit-flags: '--exclude-group=postgis-3.0 --exclude-group=orm'
postgres: '18'
postgis: '3.6'
orm: '3.5'
phpunit-flags: '--group=postgis-3.6'
code-coverage: 'yes'

# DBAL only v3 & v4
- php: '8.1'
postgres: '18'
postgis: '3.6'
dbal: '3.7'
phpunit-flags: '--group=postgis-3.6 --exclude-group=orm'
- php: '8.4'
postgres: '18'
postgis: '3.6'
dbal: '4.3'
phpunit-flags: '--group=postgis-3.6 --exclude-group=orm'

# Next PHP version
- php: '8.2'
postgres: '13'
postgis: '3.1'
phpunit-flags: '--exclude-group=postgis-3.0'
composer-flags: '--ignore-platform-reqs'
experimental: true
- php: 'latest'
postgres: '18'
postgis: '3.6'
phpunit-flags: '--exclude-group=versioned'

services:
postgis:
image: postgis/postgis:${{ matrix.postgres }}-${{ matrix.postgis }}-alpine
Expand All @@ -87,14 +111,25 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: pdo_pgsql
coverage: pcov
extensions: pdo_pgsql, pgsql
coverage: ${{ matrix.code-coverage == 'yes' && 'xdebug' || 'none' }}

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Doctrine ORM
if: matrix.orm != ''
Expand All @@ -109,20 +144,25 @@ jobs:
- name: Install dependencies
run: |
composer update --no-interaction --no-progress --prefer-dist ${{ matrix.composer-flags }}
composer info -D

- name: Run tests
if: matrix.code-coverage != 'yes'
run: vendor/bin/phpunit ${{ matrix.phpunit-flags }}
composer show -D

- name: Run tests with code coverage
- name: Create coverage directory
if: matrix.code-coverage == 'yes'
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml ${{ matrix.phpunit-flags }}
run: mkdir -p build/logs

- name: Upload coverage results to Coveralls
if: matrix.code-coverage == 'yes'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: |
composer global require php-coveralls/php-coveralls
php-coveralls -v --coverage_clover=build/logs/clover.xml
if [ "${{ matrix.code-coverage }}" == "yes" ]; then
vendor/bin/phpunit --coverage-clover build/logs/clover.xml ${{ matrix.phpunit-flags }}
else
vendor/bin/phpunit ${{ matrix.phpunit-flags }}
fi

- name: Upload coverage to Coveralls
if: matrix.code-coverage == 'yes' && success()
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: build/logs/clover.xml
flag-name: php-${{ matrix.php }}-pg${{ matrix.postgres }}-postgis${{ matrix.postgis }}
parallel: true
4 changes: 4 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
push:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
php-cs-fixer:
name: PHP-CS-Fixer
Expand Down
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ library.

| Dependency | Supported Versions |
|:--------------|:-------------------|
| PostGIS | 3.0 and 3.1 |
| PostgreSQL | 11, 12 and 13 |
| PostGIS | >= 3.2 |
| PostgreSQL | >= 14 |
| Doctrine ORM | ^2.19 and ^3.0 |
| Doctrine DBAL | ^3.7 and ^4.0 |

Expand Down Expand Up @@ -328,18 +328,24 @@ PHP container connected to specific database containers.
The script names follow the pattern
`run-<POSTGRESQL_VERSION>-<POSTGIS_VERSION>.sh`.

To run the test suite against PostgreSQL 13 with PostGIS 3.1, use the script
`./docker/run-13-31.sh`.
To run the test suite against PostgreSQL 18 with PostGIS 3.6, use the script
`./docker/run-18-36.sh`.

Tests are either PostGIS version specific (versioned) or agnostic, and are run
separately using PHPUnit groups.

e.g. for PostGIS 3.6 and PostgreSQL 18

```bash
./docker/run-13-31.sh vendor/bin/phpunit --exclude-group=postgis-3.0
./docker/run-18-36.sh vendor/bin/phpunit --exclude-group=versioned
./docker/run-18-36.sh vendor/bin/phpunit --group=postgis-3.6
```

Note, that we exclude tests targeted at PostGIS 3.0 here. When running tests
against PostGIS 3.0, exclude the tests for 3.1.
e.g. for PostGIS 3.2 and PostgreSQL 14

```bash
./docker/run-13-30.sh vendor/bin/phpunit --exclude-group=postgis-3.1
./docker/run-14-32.sh vendor/bin/phpunit --exclude-group=versioned
./docker/run-14-32.sh vendor/bin/phpunit --group=postgis-3.2
```

License
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"doctrine/orm": "^2.19 || ^3.0",
"friendsofphp/php-cs-fixer": "^3.13",
"phpunit/phpunit": "^9.6",
"vimeo/psalm": "^5.9",
"vimeo/psalm": "^6.13",
"symfony/doctrine-bridge": "^6.4",
"symfony/doctrine-messenger": "^6.4"
},
Expand Down
64 changes: 27 additions & 37 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,54 @@
version: '3.7'

services:
db-11-30:
image: postgis/postgis:11-3.0-alpine
environment:
POSTGRES_PASSWORD: postgres
networks:
- db-11-30

db-11-31:
image: postgis/postgis:11-3.1-alpine
db-14-32:
image: postgis/postgis:14-3.2-alpine
environment:
POSTGRES_PASSWORD: postgres
networks:
- db-11-31
- db-14-32

db-12-30:
image: postgis/postgis:12-3.0-alpine
db-15-34:
image: postgis/postgis:15-3.4-alpine
environment:
POSTGRES_PASSWORD: postgres
networks:
- db-12-30
- db-15-34

db-12-31:
image: postgis/postgis:12-3.1-alpine
db-16-34:
image: postgis/postgis:16-3.4-alpine
environment:
POSTGRES_PASSWORD: postgres
networks:
- db-12-31
- db-16-34

db-13-30:
image: postgis/postgis:13-3.0-alpine
db-17-36:
image: postgis/postgis:17-3.6-alpine
platform: linux/amd64
environment:
POSTGRES_PASSWORD: postgres
networks:
- db-13-30
- db-17-36

db-13-31:
image: postgis/postgis:13-3.1-alpine
db-18-36:
image: postgis/postgis:18-3.6-alpine
platform: linux/amd64
environment:
POSTGRES_PASSWORD: postgres
networks:
- db-13-31
- db-18-36

networks:
db-11-30:
name: doctrine-postgis-11-30
driver: bridge
db-11-31:
name: doctrine-postgis-11-31
db-14-32:
name: doctrine-postgis-14-32
driver: bridge
db-12-30:
name: doctrine-postgis-12-30
db-15-34:
name: doctrine-postgis-15-34
driver: bridge
db-12-31:
name: doctrine-postgis-12-31
db-16-34:
name: doctrine-postgis-16-34
driver: bridge
db-13-30:
name: doctrine-postgis-13-30
db-17-36:
name: doctrine-postgis-17-36
driver: bridge
db-13-31:
name: doctrine-postgis-13-31
db-18-36:
name: doctrine-postgis-18-36
driver: bridge
11 changes: 0 additions & 11 deletions docker/run-11-30.sh

This file was deleted.

11 changes: 0 additions & 11 deletions docker/run-11-31.sh

This file was deleted.

Loading