-
Notifications
You must be signed in to change notification settings - Fork 222
181 lines (158 loc) · 6.09 KB
/
php.yml
File metadata and controls
181 lines (158 loc) · 6.09 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: PHP QA
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
php:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2', '8.3']
experimental: [false]
composer_args: [""]
include:
- php-version: 8.4
experimental: false
composer_args: "--ignore-platform-reqs"
- php-version: 8.5
experimental: true
composer_args: "--ignore-platform-reqs"
env:
extensions: ast, grpc, opentelemetry, protobuf
steps:
- name: Set cache key
id: key
run: |
echo "key=$(date +'%Y-%U')" >> $GITHUB_ENV
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: gacts/run-and-post-run@81b6ce503cde93862cec047c54652e45c5dca991 # v1.4.3
id: post-run-command
with:
post: |
echo "::group::Steps"
echo "composer=${{steps.composer.outcome}}"
echo "style=${{steps.style.outcome}}"
echo "deps=${{steps.deps.outcome}}"
echo "phan=${{steps.phan.outcome}}"
echo "psalm=${{steps.psalm.outcome}}"
echo "phpstan=${{steps.phpstan.outcome}}"
echo "unit=${{steps.unit.outcome}}"
echo "integration=${{steps.integration.outcome}}"
echo "spi=${{steps.spi.outcome}}"
echo "::endgroup::"
if [ ${{ steps.composer.outcome == 'failure' || steps.style.outcome == 'failure' || steps.deps.outcome == 'failure' || steps.phan.outcome == 'failure' || steps.psalm.outcome == 'failure' || steps.phpstan.outcome == 'failure' || steps.unit.outcome == 'failure' || steps.integration.outcome == 'failure' || steps.spi.outcome == 'failure' }} == true ]; then \
echo "::error::One or more steps failed"; \
fi
- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@4595bea7d6630821b0a3a4894f816402faaf324c # 1.13.0
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}
- name: Cache extensions
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
tools: php-cs-fixer
extensions: ${{ env.extensions }}
- name: Validate composer.json
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: vendor
key: ${{ runner.os }}-${{ matrix.php-version }}-vendor-${{ hashFiles('composer.json') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php-version }}-vendor-
- name: Cache test tools
id: test-tools-cache
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: vendor-bin
key: ${{ runner.os }}-${{ matrix.php-version }}-vendor-bin-${{ hashFiles('vendor-bin/*/composer.json') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php-version }}-vendor-bin-
- name: Install dependencies
id: composer
if: steps.composer-cache.outputs.cache-hit != 'true'
run: |
composer --version
composer install --prefer-dist --no-progress ${{ matrix.composer_args }}
- name: Check Style
id: style
continue-on-error: ${{ matrix.experimental }}
env:
PHP_CS_FIXER_IGNORE_ENV: 1
run: |
vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer --version
vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --stop-on-violation --using-cache=no -vvv
- name: Check Dependencies
id: deps
continue-on-error: ${{ matrix.experimental }}
run: |
vendor-bin/deptrac/vendor/bin/deptrac --version
vendor-bin/deptrac/vendor/bin/deptrac --formatter=github-actions --report-uncovered
- name: Run Phan
id: phan
continue-on-error: ${{ matrix.experimental }}
env:
XDEBUG_MODE: off
PHAN_DISABLE_XDEBUG_WARN: 1
run: |
vendor-bin/phan/vendor/bin/phan --version
vendor-bin/phan/vendor/bin/phan
- name: Run Psalm
id: psalm
continue-on-error: ${{ matrix.experimental }}
run: |
vendor-bin/psalm/vendor/bin/psalm --version
vendor-bin/psalm/vendor/bin/psalm --output-format=github
- name: Run Phpstan
id: phpstan
continue-on-error: ${{ matrix.experimental }}
run: |
vendor/bin/phpstan --version
vendor/bin/phpstan analyse --error-format=github
- name: Run PHPUnit (unit tests)
id: unit
continue-on-error: ${{ matrix.experimental }}
run: |
vendor/bin/phpunit --version
php -dzend.assertions=1 vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover --testsuite unit
- name: Run PHPUnit (integration tests)
id: integration
continue-on-error: ${{ matrix.experimental }}
run: vendor/bin/phpunit --testsuite integration
- name: Check for outdated SPI package dependencies
id: spi
continue-on-error: ${{ matrix.experimental }}
run: composer spi:show-outdated-package-dependencies
- name: Code Coverage
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.clover
flags: ${{ matrix.php-version }}
verbose: false
packages:
uses: opentelemetry-php/gh-workflows/.github/workflows/validate-packages.yml@main
needs: php
with:
matrix_extension: '["ast, json, grpc"]'
matrix_php_version: '["8.1", "8.2", "8.3"]'
install_directory: '~/.test/.packages'