-
-
Notifications
You must be signed in to change notification settings - Fork 26
200 lines (164 loc) · 5.5 KB
/
ci.yml
File metadata and controls
200 lines (164 loc) · 5.5 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: CI
on:
push:
branches: [main, develop, 'feature/**', 'fix/**', 'refactor/**']
pull_request:
branches: [main, develop]
permissions:
contents: read
security-events: write
jobs:
changes:
runs-on: ubuntu-latest
outputs:
php: ${{ steps.changes.outputs.php }}
docs: ${{ steps.changes.outputs.docs }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
php:
- 'src/**'
- 'tests/**'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml.dist'
- 'phpstan.neon'
- 'pint.json'
docs:
- 'docs/**'
- 'README.md'
- '*.md'
lint:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.php == 'true'
name: Code Style & Static Analysis
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: curl, mbstring, json, openssl, gd, pcntl, xml, dom, simplexml, tokenizer, intl
coverage: none
tools: composer:v2
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader
- name: Run code style checks
run: composer lint
- name: Run static analysis
run: composer analyse
test:
runs-on: ${{ matrix.os }}
needs: changes
if: needs.changes.outputs.php == 'true'
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
php: ['8.3', '8.4']
stability: [prefer-stable]
include:
- os: ubuntu-latest
php: '8.3'
stability: prefer-lowest
name: PHP ${{ matrix.php }} on ${{ matrix.os }} - ${{ matrix.stability }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, json, openssl, gd, pcntl, xml, dom, simplexml, tokenizer, intl
coverage: none
tools: composer:v2
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-php${{ matrix.php }}-${{ matrix.stability }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php${{ matrix.php }}-${{ matrix.stability }}-composer-
${{ runner.os }}-php${{ matrix.php }}-composer-
- name: Install dependencies
if: matrix.stability != 'prefer-lowest'
run: composer install --no-interaction --prefer-dist --optimize-autoloader ${{ matrix.os == 'windows-latest' && '--ignore-platform-req=ext-pcntl --ignore-platform-req=ext-posix' || '' }}
- name: Install dependencies (prefer-lowest)
if: matrix.stability == 'prefer-lowest'
run: composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-lowest ${{ matrix.os == 'windows-latest' && '--ignore-platform-req=ext-pcntl --ignore-platform-req=ext-posix' || '' }}
- name: Execute tests
run: composer test
env:
NO_NETWORK: 1
coverage:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.php == 'true'
timeout-minutes: 10
name: Coverage Analysis
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: curl, mbstring, json, openssl, gd, pcntl, xml, dom, simplexml, tokenizer, intl
coverage: xdebug
tools: composer:v2
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-coverage-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-coverage-
- name: Install dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader
- name: Execute tests with coverage
run: composer test:coverage
env:
NO_NETWORK: 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
if: github.event_name != 'schedule'
with:
file: ./coverage.xml
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
docs:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.docs == 'true'
name: Documentation Check
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install Node dependencies
run: npm ci
- name: Build documentation
run: npm run build
- name: Check for broken links
run: npm run check-links || true
continue-on-error: true