-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (62 loc) · 2.03 KB
/
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
name: PHP Testing
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
provide_packages_json:
# Provides package paths in JSON format for
# use in the matrix strategy of other jobs.
#
# The paths will be passed as arguments
# to linting and testing tools.
#
# * https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson
# * https://stackoverflow.com/a/62953566/1348344
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Output list of packages as JSON
id: output_data
run: echo "matrix=$(vendor/bin/monorepo-builder packages-json)" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.output_data.outputs.matrix }}
test:
needs: provide_packages_json
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0']
package: ${{fromJson(needs.provide_packages_json.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json, mbstring, pdo, redis
coverage: xdebug
tools: composer, phpcs, phpstan, phpunit
- name: Validate composer.json and composer.lock
run: composer validate --no-check-all
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Start Redis
if: ${{ matrix.package == 'cache' }}
uses: supercharge/[email protected]
with:
redis-version: 6
- name: Run PHPCS for all packages
run: tests/script/phpcs --ci ${{ matrix.package }}
- name: Run PHPunit for all packages
run: tests/script/phpunit --ci ${{ matrix.package }}