-
Notifications
You must be signed in to change notification settings - Fork 97
89 lines (74 loc) · 2.61 KB
/
ci.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: CI
on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
php: ['8.1', '8.2', '8.3']
name: Tests (PHP ${{ matrix.php }})
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php }}
ini-values: xdebug.max_nesting_level=3000
- name: Load Composer package cache
uses: actions/cache@v4
with:
path: "~/.cache/composer"
key: "php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php }}-composer-"
- name: Install dependencies
run: composer install --prefer-dist --no-interaction
- name: Run PHPStan
run: ./vendor/bin/phpstan analyze --no-progress
- name: Run PHPUnit tests
run: ./vendor/bin/phpunit --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit
codegen:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
needs: codestyle #to avoid false positives
name: Generated Code consistency checks
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/[email protected]
with:
php-version: 8.1
ini-values: xdebug.max_nesting_level=3000
tools: php-cs-fixer:3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Load Composer package cache
uses: actions/cache@v4
with:
path: "~/.cache/composer"
key: "php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php }}-composer-"
- name: Install dependencies
run: composer install --prefer-dist --no-interaction
- name: Verify ::create() methods are up to date
run: |
php tools/generate-create-static-methods.php
php-cs-fixer fix
git diff
git diff --quiet #to set the exit code
codestyle:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
name: Code Style checks
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/[email protected]
with:
php-version: 8.2
ini-values: xdebug.max_nesting_level=3000
tools: php-cs-fixer:3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --diff