-
Notifications
You must be signed in to change notification settings - Fork 5
89 lines (81 loc) · 2.51 KB
/
tests-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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: PHP Tests
on:
pull_request:
workflow_run:
workflows: ["Update WP Deps"]
types:
- completed
env:
fail-fast: true
permissions:
contents: read
statuses: write
jobs:
test:
name: PHP Tests ${{ matrix.php }}
runs-on: ubuntu-latest
services:
database:
image: mariadb:10.11.9
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: wordpress
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
include:
- php: 8.2
required: 'required'
- php: 8.3
required: 'required'
steps:
- name: Checkout
uses: actions/checkout@v4
if: github.event_name != 'workflow_run'
- name: Checkout
uses: boxuk/checkout-pr@main
id: checkout-deps
if: github.event_name == 'workflow_run'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
job-name: PHP Tests ${{ matrix.php }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl, zip, pcov
coverage: pcov
- name: Setup dependencies
run: composer install
continue-on-error: ${{ matrix.required == 'optional' }}
- name: Run PHPCS
run: composer phpcs
continue-on-error: ${{ matrix.required == 'optional' }}
- name: Run PHPStan
run: composer phpstan
continue-on-error: ${{ matrix.required == 'optional' }}
- name: Run Security Checks
uses: symfonycorp/security-checker-action@v5
continue-on-error: ${{ matrix.required == 'optional' }}
- name: Run PHPUnit
run: composer phpunit
continue-on-error: ${{ matrix.required == 'optional' }}
- name: Run PHP Integration Tests
run: composer phpintegration
continue-on-error: ${{ matrix.required == 'optional' }}
env:
DB_NAME: wordpress
DB_USER: root
DB_PASSWORD: root
DB_HOST: database
- name: Mark Check Outcome
if: github.event_name == 'workflow_run' && always()
uses: boxuk/mark-check-status@main
with:
status: ${{ job.status }}
pr-head-sha: ${{ steps.checkout-deps.outputs.pr-head-sha }}
github-token: ${{ secrets.GITHUB_TOKEN }}
job-name: PHP Tests ${{ matrix.php }}