Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@ jobs:
name: PHP ${{ matrix.php }} / Laravel ${{ matrix.laravel }}
runs-on: ubuntu-latest

services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: resource_cleanup_testing
POSTGRES_USER: testing
POSTGRES_PASSWORD: testing
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U testing -d resource_cleanup_testing"
--health-interval 3s
--health-timeout 5s
--health-retries 10

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -69,7 +84,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, pdo, pdo_sqlite, sqlite3
extensions: mbstring, pdo, pdo_pgsql
coverage: none

- name: Allow insecure packages
Expand All @@ -88,3 +103,9 @@ jobs:

- name: Run tests
run: vendor/bin/phpunit
env:
DB_HOST: 127.0.0.1
DB_PORT: 5432
DB_DATABASE: resource_cleanup_testing
DB_USERNAME: testing
DB_PASSWORD: testing
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ RUN apk add --no-cache \
git \
unzip \
curl \
sqlite-dev \
&& docker-php-ext-install pdo pdo_sqlite
libpq-dev \
&& docker-php-ext-install pdo pdo_pgsql

# Install Composer
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,24 @@ services:
# Mount the source so edits are reflected instantly without rebuilding
- .:/app
command: vendor/bin/phpunit
depends_on:
postgres:
condition: service_healthy
environment:
DB_HOST: postgres
DB_PORT: 5432
DB_DATABASE: resource_cleanup_testing
DB_USERNAME: testing
DB_PASSWORD: testing

postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: resource_cleanup_testing
POSTGRES_USER: testing
POSTGRES_PASSWORD: testing
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U testing -d resource_cleanup_testing" ]
interval: 3s
timeout: 5s
retries: 10
8 changes: 6 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ protected function getEnvironmentSetUp($app): void
{
$app['config']->set('database.default', 'testing');
$app['config']->set('database.connections.testing', [
'driver' => 'sqlite',
'database' => ':memory:',
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', 5432),
'database' => env('DB_DATABASE', 'resource_cleanup_testing'),
'username' => env('DB_USERNAME', 'testing'),
'password' => env('DB_PASSWORD', 'testing'),
'prefix' => '',
]);
}
Expand Down
Loading