Tests | Postgres #475
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | Postgres | |
on: | |
push: | |
branches: | |
- master | |
- "*" | |
pull_request: | |
schedule: | |
- cron: "0 0 * * *" | |
permissions: | |
contents: read | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [8.2, 8.3] | |
name: PHP ${{ matrix.php }} | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
# Provide the password for postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
steps: | |
- name: Activate postgres | |
run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_mysql | |
coverage: none | |
- name: Install Composer dependencies | |
run: composer install --prefer-dist --no-interaction --no-progress | |
- name: Execute tests | |
env: | |
APP_ENV: testing | |
DB_CONNECTION: pgsql | |
DB_HOST: 127.0.0.1 | |
DB_PORT: 5432 | |
DB_DATABASE: postgres | |
DB_USERNAME: postgres | |
DB_PASSWORD: postgres | |
run: php artisan test |