From 0630702ea7524e46c17b6afc0c8d91b363c23bbb Mon Sep 17 00:00:00 2001 From: Valentin Sickert <17144397+Lapotor@users.noreply.github.com> Date: Mon, 11 Dec 2023 19:09:31 +0100 Subject: [PATCH] add postgresql test Signed-off-by: Valentin Sickert <17144397+Lapotor@users.noreply.github.com> --- .github/workflows/laravel.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index 75664881..d5fb16b1 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -8,9 +8,10 @@ on: jobs: laravel-tests: - name: Laravel (PHP ${{ matrix.php-versions }}) Tests + name: Laravel (PHP ${{ matrix.php-versions }}) with ${{ matrix.db }} ${{ matrix.mariadb-versions }} runs-on: ubuntu-latest env: + DB_CONNECTION: ${{ matrix.db }} DB_DATABASE: radioroster DB_USERNAME: radioroster DB_PASSWORD: testPassword @@ -18,20 +19,38 @@ jobs: services: mariadb: - image: mariadb:lts + image: mariadb:${{ matrix.mariadb-versions }} env: MYSQL_ROOT_PASSWORD: rootPassword MYSQL_DATABASE: radioroster MYSQL_USER: radioroster MYSQL_PASSWORD: testPassword ports: - - 3306:3306 + - 3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + postgres: + image: postgres:${{ matrix.postgres-versions }} + env: + POSTGRES_DB: radioroster + POSTGRES_USER: radioroster + POSTGRES_PASSWORD: testPassword + ports: + - 5432 + options: --health-cmd="pg_isready -U postgres || exit 1" --health-interval=10s --health-timeout=5s --health-retries=3 strategy: fail-fast: false matrix: + db: [mysql, pgsql] php-versions: ["8.1", "8.2", "8.3"] + mariadb-versions: ["10", "11"] + postgres-versions: ["14", "15", "16"] + include: + - php-versions: ["8.1", "8.2", "8.3"] + - db: mysql + mariadb-versions: ["10", "11"] + - db: pgsql + postgres-versions: ["14", "15", "16"] steps: - name: Checkout @@ -69,7 +88,9 @@ jobs: - name: Run Migrations run: php artisan migrate -v env: + if: matrix.db == 'mysql' DB_PORT: ${{ job.services.mariadb.ports['3306'] }} + else: ${{ job.services.postgres.ports['5432'] }} - name: Execute tests (Unit and Feature tests) via PHPUnit run: vendor/bin/phpunit --coverage-text