Skip to content

feat(#305): add support for PostGIS's types of GEOGRAPHY, `GEOMETRY… #1

feat(#305): add support for PostGIS's types of GEOGRAPHY, `GEOMETRY…

feat(#305): add support for PostGIS's types of GEOGRAPHY, `GEOMETRY… #1

name: Integration Tests
on:
push:
branches:
- main
paths-ignore:
- '.github/actions/release-please/**'
pull_request:
branches:
- main
permissions:
contents: read
jobs:
should-run:
runs-on: ubuntu-latest
outputs:
run: ${{ steps.check.outputs.run }}
steps:
- name: Skip for release-please
id: check
run: |
if [ "${{ github.event.pull_request.user.id }}" = "41898282" ]; then
echo "run=false" >> $GITHUB_OUTPUT
echo "::notice::Skipping integration tests - this a release-please bot's interaction"
else
echo "run=true" >> $GITHUB_OUTPUT
echo "::notice::integration tests will execute - the actor is not the release-please bot"
fi
integration-tests:
needs: should-run
if: needs.should-run.outputs.run == 'true'
runs-on: ubuntu-latest
name: "PostgreSQL ${{ matrix.postgres }} + PostGIS ${{ matrix.postgis }} + PHP ${{ matrix.php }}"
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.4']
postgis: ['3.4', '3.5']
postgres: ['16', '17']
include:
- php: '8.4'
postgis: '3.5'
postgres: '17'
calculate-code-coverage: true
services:
postgres:
image: postgis/postgis:${{ matrix.postgres }}-${{ matrix.postgis }}
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: postgres_doctrine_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
--mount type=tmpfs,destination=/var/lib/postgresql/data
-e POSTGRES_INITDB_ARGS="--data-checksums"
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- name: Set up PHP
uses: shivammathur/setup-php@20529878ed81ef8e78ddf08b480401e6101a850f # v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
extensions: ctype, json, mbstring, pdo_pgsql
tools: composer
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress
- name: Install PostgreSQL client tools
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Verify PostgreSQL connection and setup
run: |
echo "Checking PostgreSQL version:"
PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SELECT version();"
echo "\nChecking PostgreSQL configuration:"
PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SHOW server_version;"
PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SHOW max_connections;"
PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SHOW shared_buffers;"
echo "\nCreating test schema:"
PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "CREATE SCHEMA IF NOT EXISTS test;"
echo "\nListing available PostgreSQL extensions:"
PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SELECT * FROM pg_available_extensions;"
echo "\nVerifying PostGIS installation:"
PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SELECT PostGIS_Version();"
- name: Run integration test suite
run: composer run-integration-tests
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: postgres_doctrine_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
- name: Upload coverage results to Coveralls
if: matrix.calculate-code-coverage == true
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./var/logs/test-coverage/integration/clover.xml
parallel: true
flag-name: "Integration"
fail-on-error: false