Skip to content

Commit

Permalink
Test Application (with PostgreSQL)
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Oct 4, 2023
1 parent 9089aba commit 1fc7042
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/test-pgsql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Test Application (PostgreSQL)

on:
push:
branches:
- master
workflow_dispatch:

jobs:
test:
name: Test Application (with PostgreSQL)
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.3', '7.4', '8.0', '8.1', '8.2']

env:
DB_CONNECTION: testing_pgsql

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: freescout-test
POSTGRES_PASSWORD: freescout-test
POSTGRES_DB: freescout-test
ports:
- 5432/tcp
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3

steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: pgsql, mbstring, xml, imap, zip, gd, curl, intl, json

- name: Install composer dependencies
run: composer install --ignore-platform-reqs --no-interaction

- name: Migrate and seed the database
run: |
php${{ matrix.php }} artisan migrate --force -n --database=testing
php${{ matrix.php }} artisan db:seed --force -n --database=testing
env:
DB_PORT: ${{ job.services.postgres.ports[5432] }}

- name: Run PHP tests
run: php${{ matrix.php }} ./vendor/bin/phpunit
env:
DB_PORT: ${{ job.services.postgres.ports[5432] }}
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test Application
name: Test Application (MySQL)

on:
push:
Expand All @@ -8,7 +8,7 @@ on:

jobs:
test:
name: Test Application
name: Test Application (with MySQL)
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
13 changes: 13 additions & 0 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@
'engine' => null,
],

'testing_pgsql' => [
'driver' => 'pgsql',
'host' => '127.0.0.1',
'port' => '5432',
'database' => 'freescout-test',
'username' => env('DB_TEST_USERNAME', 'freescout-test'),
'password' => env('DB_TEST_PASSWORD', 'freescout-test'),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
'sslmode' => 'prefer',
],

'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
Expand Down

0 comments on commit 1fc7042

Please sign in to comment.