-
Notifications
You must be signed in to change notification settings - Fork 14
334 lines (318 loc) · 11.1 KB
/
ci-tests.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
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# These workflows takes care of various CI tests.
on: pull_request
name: CI Tests
env:
PHP_VERSION: 8.1
COMPOSER_VERSION: v2
# Detect if this action is already running, and cancel it.
# This most likely happened because a second push has been made to a branch.
concurrency:
group: ${{ github.repository_id }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ValidateComposer:
name: Validate Composer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
coverage: none
tools: composer:${{ env.COMPOSER_VERSION }}
- name: Validate composer.json
run: |
composer validate --no-check-all --no-check-publish
- name: Install Dependencies
run: |
composer install --no-interaction --no-progress
- name: Ensure install does not modify VCS
run: git diff --exit-code
Phpcs:
name: Check code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:${{ env.COMPOSER_VERSION }}, cs2pr
coverage: none
extensions: gd
- name: Install Dependencies
run: |
composer install --no-interaction --no-progress
- name: Run Twig CS Fixer
run: |
vendor/bin/phpcs -q --report=checkstyle | cs2pr
TwigCsFixer:
name: Check Twig code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:${{ env.COMPOSER_VERSION }}
coverage: none
extensions: gd
- name: Install Dependencies
run: |
composer install --no-interaction --no-progress
- name: Run Twig CS Fixer
run: |
vendor/bin/twig-cs-fixer lint --report=github
Phpstan:
name: Analyse code using PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
coverage: none
tools: composer:${{ env.COMPOSER_VERSION }}
- name: Install composer dependencies
run: |
composer install --no-interaction --no-progress
# Add vendor/bin to PATH for subsequent steps, see https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
composer config bin-dir --absolute >> "${GITHUB_PATH}"
- name: PHPStan analyse
run: |
phpstan
PhpUnit:
name: Run PHP unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
tools: composer:${{ env.COMPOSER_VERSION }}
coverage: xdebug
extensions: gd
- name: Install Dependencies
run: |
composer install --no-interaction --no-progress
- name: Run PhpUnit
run: ./vendor/bin/phpunit --coverage-text
LightHouse:
name: Test site performance using Lighthouse
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Our Taskfile requires a proper checkout to function because of
# certain vars.
fetch-depth: 0
- name: Install go-task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup site
run: task ci:reset
- name: Run Lighthouse test
run: task ci:lighthouse
- name: Archive logs
uses: actions/upload-artifact@v4
with:
name: lighthouse-results
path: .lighthouseci
Pa11y:
name: Test accessibility using Pa11y
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Our Taskfile requires a proper checkout to function because of
# certain vars.
fetch-depth: 0
- name: Install go-task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup site
run: task ci:reset
- name: Run Pa11y
run: task ci:pa11y
- name: Archive screenshots
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: pa11y-screenshots
path: pa11y/screenshots
Cypress:
name: Run Cypress functional tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Our Taskfile requires a proper checkout to function because of
# certain vars.
fetch-depth: 0
- name: Install go-task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup site
run: task ci:reset
- name: Run Cypress
run: task ci:cypress
- name: Archive videoes
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-videos
path: cypress/videos
- name: Archive screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-screenshots
path: cypress/screenshots
MarkdownLint:
name: Lint Markdown
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# git with HTTP authentication provides an easy way for us to install
# unreleased commits of NPM projects. Currently: Pa11yCI
- name: Reconfigure git to use HTTP authentication
run: git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf ssh://[email protected]/
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Install problem matcher
uses: xt0rted/markdownlint-problem-matcher@v3
- name: Lint Markdown
run: npx markdownlint-cli2
Shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: shellcheck
uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.github_token }}
fail_on_error: true
# Use the GitHub PullRequest review comment that reports findings
# as inlined comments in a PullRequest.
# Read more about reporters: https://github.com/reviewdog/reviewdog#reporters
reporter: github-pr-review
# We can exclude a single directory, so we go for .git.
path: dev-scripts
# Set the default filter-mode which only reports violations caused by
# added/modified lines.
# Read more about filter-mode: https://github.com/reviewdog/reviewdog#filter-mode
filter_mode: nofilter
EslintDrupal:
name: Lint Drupal assets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# git with HTTP authentication provides an easy way for us to install
# unreleased commits of NPM projects. Currently: Pa11yCI
- name: Reconfigure git to use HTTP authentication
run: git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf ssh://[email protected]/
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run ESLint
run: npx eslint web -c .eslintrc.json
EslintCypress:
name: Lint Cypress tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# git with HTTP authentication provides an easy way for us to install
# unreleased commits of NPM projects. Currently: Pa11yCI
- name: Reconfigure git to use HTTP authentication
run: git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf ssh://[email protected]/
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run ESLint
run: npx eslint cypress -c cypress/.eslintrc.json
CheckOpenApiSpec:
name: Check OpenAPI specification
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Our Taskfile requires a proper checkout to function because of
# certain vars.
fetch-depth: 0
- name: Install go-task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup site
run: task ci:reset
- name: Validate specification
run: task ci:openapi:validate
- name: Download current specification
run: task ci:openapi:download
- name: Ensure specification has not drifted
run: git diff --ignore-space-at-eol --exit-code openapi.json
- name: Generate package for CMS API specification
run: task dev:codegen:dpl-cms
- name: Ensure CMS API package code has not drifted
run: git diff --ignore-space-at-eol --exit-code packages/cms-api/*
CheckDrupalConfig:
name: Check Drupal Config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Our Taskfile requires a proper checkout to function because of
# certain vars.
fetch-depth: 0
- name: Install go-task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup site
run: task ci:reset
- name: Export configuration
run: task dev:cli -- drush config-export -y
- name: Check for uncommited configuration after install
run: git diff --ignore-space-at-eol --exit-code config/sync/*.yml
CheckPhpVersion:
name: Check PHP version
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check PHP version in composer.json
run: |
if ! jq .require.php composer.json | grep ${{ env.PHP_VERSION }}; then
echo "PHP version in composer.json does not match the version in the GitHub Actions."
exit 1
fi
- name: Check PHP version in PHP service
run: |
if ! docker compose run php -- php --version | grep ${{ env.PHP_VERSION }}; then
echo "PHP version for PHP service docker-compose.yml does not match the version in the GitHub Actions."
exit 1
fi
- name: Check PHP version in CLI service
run: |
if ! docker compose run php -- php --version | grep ${{ env.PHP_VERSION }}; then
echo "PHP version for CLI service docker-compose.yml does not match the version in the GitHub Actions."
exit 1
fi