-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (54 loc) · 1.82 KB
/
check.php.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: "Checking app: testing and linting PHP"
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.1-alpine3.18 # https://hub.docker.com/_/postgres
env:
POSTGRES_DB: website
POSTGRES_USER: website
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/[email protected] # https://github.com/actions/checkout
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache dependencies
uses: actions/[email protected] # 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/[email protected] # https://github.com/shivammathur/setup-php
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, intl
coverage: none
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-suggest
- name: Run PHP linter
run: composer cs
- name: Execute tests
run: php artisan test --env=ci