Skip to content

#145 - production deployment #265

#145 - production deployment

#145 - production deployment #265

name: Test & lint PHP codebase
on:
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- '**.php'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml'
- 'env.ci'
jobs:
test-and-lint-php:
name: Test & lint PHP codebase
timeout-minutes: 10
if: github.event.pull_request.draft == false
runs-on: ubuntu-22.04
services:
pgsql:
image: postgres:15.5-alpine3.17@sha256:1961f9d61a86948fb3c02ef87a6616f74f3530d10a1cd299b84abba7ed6db791
env:
POSTGRES_DB: keating
POSTGRES_USER: keating
POSTGRES_PASSWORD: password
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 3s
--health-timeout 3s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: vendor
key: ${{ runner.os }}-composer-dependencies-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-dependencies
- name: Setup PHP
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # 2.31.1
with:
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, intl
coverage: none
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction
- name: Run PHP linter
run: composer cs
- name: Execute tests
run: php artisan test --env=ci