-
Notifications
You must be signed in to change notification settings - Fork 0
231 lines (180 loc) · 5.66 KB
/
Copy pathci.yml
File metadata and controls
231 lines (180 loc) · 5.66 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# Least-privilege default for GITHUB_TOKEN.
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
dependency-health:
name: Dependency metadata + audits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '20'
cache: npm
- name: Validate Composer metadata
run: composer validate --strict
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --no-interaction
- name: Composer security audit
run: composer audit
- name: Install npm dependencies
run: npm ci
- name: npm security audit with repo allowlist
run: npm run audit:npm
php-lint:
name: PHP syntax (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3']
steps:
- uses: actions/checkout@v7
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Lint PHP files
run: find maestro-menu-editor.php uninstall.php includes tests -name '*.php' -print0 | xargs -0 -n1 php -l
lint:
name: Coding standards (WPCS)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --no-interaction
- name: Run phpcs (WordPress standard + PHP compatibility)
run: composer lint
phpstan:
name: Static analysis (PHPStan)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer
coverage: none
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --no-interaction
- name: Run PHPStan
run: composer analyse:phpstan
unit:
name: Unit tests (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.3'] # supported floor + current
steps:
- uses: actions/checkout@v7
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --no-interaction
- name: Run pure unit tests
run: composer test:unit
node-quality:
name: JavaScript unit tests + docs links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '20'
cache: npm
- name: Install npm dependencies
run: npm ci
- name: JavaScript unit tests
run: npm run test:js
- name: Documentation link hygiene
run: npm run check:doc-links
integration-e2e:
name: Integration + E2E (wp-env, WP 7.0)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '20'
cache: npm
# vendor/ is mounted into the wp-env container, so the integration
# PHPUnit run (vendor/bin/phpunit inside tests-cli) needs it present.
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --no-interaction
- name: Install npm dependencies
run: npm ci
- name: Start wp-env (Docker)
run: npm run env:start
- name: Integration tests (PHPUnit in wp-env)
run: npm run test:php
- name: Install Playwright Chromium
run: npx playwright install --with-deps chromium
- name: E2E tests (Playwright)
run: npm run test:e2e
- name: Stop wp-env
if: always()
run: npm run env:stop
package-check:
name: Runtime package + Plugin Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '20'
cache: npm
- name: Install npm dependencies
run: npm ci
- name: Build runtime ZIP
run: bash bin/build.sh
- name: Upload runtime ZIP artifact
uses: actions/upload-artifact@v7
with:
name: maestro-menu-editor
path: build/maestro-menu-editor.zip
if-no-files-found: error
- name: Start wp-env (Docker)
run: npm run env:start
- name: Install Plugin Check
run: npx wp-env run cli wp plugin install plugin-check --activate
- name: Run Plugin Check on runtime tree
run: npx wp-env run cli wp plugin check /var/www/html/wp-content/plugins/maestro-menu-editor/build/maestro-menu-editor --format=json
- name: Stop wp-env
if: always()
run: npm run env:stop