Skip to content

#2 - homepage frontend #5

#2 - homepage frontend

#2 - homepage frontend #5

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-latest
services:
pgsql:
image: postgres:16.2-alpine3.18 # https://hub.docker.com/_/postgres
env:
POSTGRES_DB: interns2024b
POSTGRES_USER: interns2024b
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@v4.1.4 # https://github.com/actions/checkout
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache dependencies
uses: actions/cache@v4.0.2 # https://github.com/actions/cache
with:
path: vendor
key: ${{ runner.os }}-composer-dependencies-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-dependencies
- name: Setup PHP
uses: shivammathur/setup-php@2.30.4 # https://github.com/shivammathur/setup-php
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