-
Notifications
You must be signed in to change notification settings - Fork 14
205 lines (195 loc) · 7.13 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
# These workflows takes care of various CI tests.
on: pull_request
name: CI Tests
env:
PHP_VERSION: 8.1
COMPOSER_VERSION: v2
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
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
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