-
Notifications
You must be signed in to change notification settings - Fork 1
254 lines (211 loc) · 6.93 KB
/
Copy pathci.yml
File metadata and controls
254 lines (211 loc) · 6.93 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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
name: CI
on:
push:
branches:
- main
- master
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
conventions:
name: Repository conventions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Enforce repository conventions
run: make conventions
quality:
name: Static and dependency analysis
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: '8.2'
tools: composer:v2
coverage: none
- name: Validate Composer metadata
working-directory: plugins/basicrum
run: composer validate --strict
- name: Audit locked dependencies
working-directory: plugins/basicrum
run: composer audit --locked
- name: Install dependencies
working-directory: plugins/basicrum
run: composer install --no-interaction --prefer-dist
- name: Static analysis
working-directory: plugins/basicrum
run: composer analyse
javascript:
name: JavaScript loader behavior
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: package-lock.json
- name: Install JavaScript dependencies
run: npm ci
- name: Install Chromium
run: npx playwright install --with-deps chromium
- name: Test JavaScript loaders
run: npm run test:js
woocommerce-e2e:
name: WooCommerce E2E page types
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Run WooCommerce E2E suite
run: make woocommerce-e2e
- name: Upload WooCommerce E2E diagnostics
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: woocommerce-e2e-diagnostics
path: test-results/woocommerce-e2e
if-no-files-found: ignore
unit:
name: Unit (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
- name: Install dependencies
working-directory: plugins/basicrum
run: composer install --no-interaction --prefer-dist
- name: PHP syntax lint
working-directory: plugins/basicrum
run: composer lint:php
- name: Coding standards
working-directory: plugins/basicrum
run: composer lint
- name: Unit tests
working-directory: plugins/basicrum
run: ./vendor/bin/phpunit --configuration phpunit.xml
integration:
name: Integration (PHP ${{ matrix.php }}, WP ${{ matrix.wp }})
runs-on: ubuntu-latest
needs: unit
continue-on-error: ${{ matrix.experimental }}
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_ROOT_HOST: '%'
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost -proot"
--health-interval=10s
--health-timeout=5s
--health-retries=5
strategy:
fail-fast: false
matrix:
include:
- php: '7.4'
wp: '6.0'
experimental: false
- php: '8.0'
wp: '6.0'
experimental: false
- php: '8.4'
wp: '7.0'
experimental: false
- php: '8.5'
wp: '7.0'
experimental: false
- php: '8.4'
wp: '7.1'
experimental: false
- php: '8.5'
wp: '7.1'
experimental: false
- php: '8.5'
wp: 'trunk'
experimental: true
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
- name: Install dependencies
working-directory: plugins/basicrum
run: composer install --no-interaction --prefer-dist
- name: Configure MySQL authentication
run: |
docker exec "${{ job.services.mysql.id }}" mysql --protocol=socket --user=root --password=root \
--execute="ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';"
- name: Install WordPress test library
run: |
set -e
sudo apt-get update
sudo apt-get install -y default-mysql-client subversion
bash tools/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp }}
- name: Integration tests
working-directory: plugins/basicrum
env:
WP_TESTS_DIR: /tmp/wordpress-tests-lib
run: ./vendor/bin/phpunit --configuration phpunit-with-integration.xml
release-artifact:
name: Release ZIP smoke test
runs-on: ubuntu-latest
needs:
- conventions
- quality
- javascript
- woocommerce-e2e
- unit
- integration
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup release PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: '7.4'
tools: composer:v2
coverage: none
- name: Install release tools
run: |
sudo apt-get update
sudo apt-get install -y rsync zip unzip
- name: Build and inspect release artifact
run: sh tools/build-release.sh
- name: Install and test packaged plugin
run: sh tools/smoke-test-release.sh release/basicrum.zip
- name: Upload release artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: basicrum-release
path: |
release/basicrum.zip
release/basicrum.zip.sha256
if-no-files-found: error