Repository navigation
72 lines (62 loc) · 2.29 KB
/
Copy pathcheck.php.yml
File metadata and controls
72 lines (62 loc) · 2.29 KB
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
64
65
66
67
68
69
70
71
72
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'
- '.github/workflows/check.php.yml'
permissions:
contents: read
jobs:
test-and-lint-php:
name: Test & lint PHP codebase
timeout-minutes: 10
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
env:
# renovate: datasource=github-releases depName=php packageName=containerbase/php-prebuild
PHP_VERSION: 8.4.24
services:
postgres:
image: postgres:16.3-alpine3.18@sha256:64e18e8fb3e9c9aac89ac590c5dd8306b862478404f76cd9b5f7720d012b4c47 # https://hub.docker.com/_/postgres
env:
POSTGRES_DB: website-test
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/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 # https://github.com/actions/checkout
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 # 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@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 # https://github.com/shivammathur/setup-php
with:
php-version: ${{ env.PHP_VERSION }}
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: |
cp .env.ci .env
php artisan test --colors=always