-
Notifications
You must be signed in to change notification settings - Fork 27
142 lines (115 loc) · 5.71 KB
/
php-qa.yml
File metadata and controls
142 lines (115 loc) · 5.71 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: PHP Quality Assurance
on:
push:
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
phpcompatibility:
runs-on: ubuntu-latest
name: "PHPCompatibility"
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
with:
php-version: 'latest'
coverage: 'none'
tools: cs2pr
env:
fail-fast: true
- name: Install dependencies
uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Check cross-version PHP compatibility
id: phpcs
run: composer phpcompat -- --report-full --report-checkstyle=./phpcs-report.xml
- name: Show PHPCS results in PR
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
run: cs2pr ./phpcs-report.xml
lint:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.2', '7.4', '8.0', '8.5', 'nightly']
name: "Lint: PHP ${{ matrix.php }}"
continue-on-error: ${{ matrix.php == 'nightly' }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
with:
php-version: ${{ matrix.php }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On, display_startup_errors=On
coverage: 'none'
tools: parallel-lint, cs2pr
env:
fail-fast: true
- name: "Lint against parse and compile errors (push)"
if: ${{ github.event_name != 'pull_request' }}
run: parallel-lint ./src/ ./inc/ ./tests/ -e php --show-deprecated
- name: "Lint against parse and compile errors (PR)"
if: ${{ github.event_name == 'pull_request' }}
run: parallel-lint ./src/ ./inc/ ./tests/ -e php --show-deprecated --checkstyle | cs2pr
test:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6']
dependencies: ['lowest', 'highest']
continue-on-error: ${{ matrix.php == '8.6' }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
with:
php-version: ${{ matrix.php }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On, display_startup_errors=On
coverage: ${{ ( matrix.php == '7.4' && 'xdebug' ) || 'none' }}
env:
fail-fast: true
- name: Install dependencies
uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0
with:
dependency-versions: ${{ matrix.dependencies }}
# For PHP "nightly", we need to install with ignore platform reqs as not all dependencies may allow it yet.
composer-options: ${{ matrix.php == '8.6' && '--ignore-platform-req=php+' || '' }}
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
# Mockery is only compatible with PHP 8.4 as of Mockery 1.6.10, so we need to update what "lowest" means.
- name: Update Mockery lowest (PHP >= 8.4)
if: ${{ matrix.php >= '8.4' && matrix.dependencies == 'lowest' }}
run: composer require mockery/mockery:"1.6.10"
- name: Migrate test configuration (>= 7.3)
if: ${{ matrix.php >= 7.3 && matrix.dependencies == 'highest' }}
run: ./vendor/bin/phpunit --migrate-configuration
- name: Run unit tests (without code coverage)
if: ${{ matrix.php != '8.1' || matrix.dependencies != 'highest' || github.event.repository.fork == true }}
run: ./vendor/bin/phpunit
- name: Run unit tests with code coverage
if: ${{ matrix.php == '8.1' && matrix.dependencies == 'highest' && github.event.repository.fork == false }}
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Update codecov.io
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
if: ${{ matrix.php == '8.1' && matrix.dependencies == 'highest' && github.event.repository.fork == false }} # upload coverage once is enough
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage.xml