Skip to content

Fix PostgreSQL

Fix PostgreSQL #435

Workflow file for this run

name: Tests
on:
push:
branches:
- master
- release/*
pull_request:
workflow_dispatch:
env:
POSTGRES_IMAGE: postgres:17
POSTGRES_PORT: 5432
POSTGRES_DB_OPTIONS: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3"
MATRIX_EXCLUDE: "[{\"php\"=>\"8.3\", \"laravel\"=>\"9.*\"},{\"php\"=>\"8.1\", \"laravel\"=>\"11.*\"}]"
jobs:
# Environment variables are not available in the matrix context, so we have to define them as outputs.
prepare:
name: Prepare environment
runs-on: ubuntu-latest
outputs:
POSTGRES_IMAGE: postgres:17
POSTGRES_PORT: "5432"
POSTGRES_DB_OPTIONS: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3"
MATRIX_EXCLUDE: "[{\"php\"=>\"8.3\", \"laravel\"=>\"9.*\"},{\"php\"=>\"8.1\", \"laravel\"=>\"11.*\"}]"
steps:
# Placeholder because a job needs a step.
- run: echo "null"
mysql-tests:
name: MySQL
needs: prepare
uses: cybex-gmbh/github-workflows/.github/workflows/tests.yml@feature/pass-db-image
strategy:
fail-fast: true
matrix:
php: [ 8.1, 8.2, 8.3 ]
laravel: [ 9.*, 10.*, 11.* ]
dependency-version: [ prefer-stable ]
exclude: ${{ needs.prepare.outputs.MATRIX_EXCLUDE }}
with:
DATABASE_NAME: protector_test
PHP_VERSION: ${{ matrix.php }}
LARAVEL_VERSION: ${{ matrix.laravel }}
DEPENDENCY_VERSION: ${{ matrix.dependency-version }}
TEST_COMMANDS: vendor/bin/phpunit -c ${{ needs.prepare.outputs.MYSQL_PHPUNIT_CONFIG }}
postgres-tests:
name: PostgreSQL
needs: prepare
uses: cybex-gmbh/github-workflows/.github/workflows/tests.yml@feature/pass-db-image
strategy:
fail-fast: true
matrix:
php: [ 8.1, 8.2, 8.3 ]
laravel: [ 9.*, 10.*, 11.* ]
dependency-version: [ prefer-stable ]
exclude: ${{ needs.prepare.outputs.MATRIX_EXCLUDE }}
with:
DATABASE_IMAGE: ${{ needs.prepare.outputs.POSTGRES_IMAGE }}
DATABASE_NAME: protector_test
DATABASE_PORT: ${{ needs.prepare.outputs.POSTGRES_PORT }}
DATABASE_USERNAME: postgres
DATABASE_CONNECTION: pgsql
DATABASE_OPTIONS: ${{ needs.prepare.outputs.POSTGRES_DB_OPTIONS }}
PHP_VERSION: ${{ matrix.php }}
LARAVEL_VERSION: ${{ matrix.laravel }}
DEPENDENCY_VERSION: ${{ matrix.dependency-version }}
TEST_COMMANDS: vendor/bin/phpunit -c phpunit-ci.xml.dist