diff --git a/.github/workflows/test-pgsql.yml b/.github/workflows/test-pgsql.yml new file mode 100644 index 000000000..2ce366bb6 --- /dev/null +++ b/.github/workflows/test-pgsql.yml @@ -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] }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c50598bcc..3f1727c4e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Test Application +name: Test Application (MySQL) on: push: @@ -8,7 +8,7 @@ on: jobs: test: - name: Test Application + name: Test Application (with MySQL) runs-on: ubuntu-latest strategy: matrix: diff --git a/config/database.php b/config/database.php index fe6c84d3d..1f5fbe8e3 100644 --- a/config/database.php +++ b/config/database.php @@ -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'),