-
-
Notifications
You must be signed in to change notification settings - Fork 14
235 lines (200 loc) · 8.75 KB
/
Copy pathtest.yml
File metadata and controls
235 lines (200 loc) · 8.75 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
name: Test
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main
defaults:
run:
shell: bash
env:
CI: "1"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
container:
image: drevops/ci-runner:26.6.0@sha256:190027056cac7b7ce28c29a1e5494779ebadc4ee8e95d468b75bc56e7be5aabd
env:
TERM: xterm-256color
PHP_VERSION: '8.3'
DRUPAL_VERSION: '11'
DEPS: 'normal'
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
steps:
- name: Check out code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Process the codebase to run in CI
run: |
sed -i -e "/###/d" docker-compose.yml
sed -i -e "s/##//" docker-compose.yml
- name: Build stack
run: |
docker compose up -d --build
docker cp -L . "$(docker compose ps -q cli)":/app/
timeout-minutes: 30
- name: Install development dependencies
run: |
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c " \
if [ -n \"${PACKAGE_TOKEN:-}\" ]; then export COMPOSER_AUTH='{\"github-oauth\": {\"github.com\": \"${PACKAGE_TOKEN-}\"}}'; fi && \
COMPOSER_MEMORY_LIMIT=-1 composer --ansi install --prefer-dist"
- name: Provision application
run: docker compose exec -e DRUPAL_VERSION=${DRUPAL_VERSION} -e DEPS=${DEPS} -T cli bash scripts/provision.sh
- name: Validate Composer configuration is normalized
run: docker compose exec -T cli composer normalize --dry-run
continue-on-error: ${{ vars.CI_COMPOSER_NORMALIZE_IGNORE_FAILURE == '1' }}
- name: Install Ahoy CLI
run: |
version=2.4.0 && \
set -x && curl -L -o "/usr/local/bin/ahoy" "https://github.com/ahoy-cli/ahoy/releases/download/v${version}/ahoy-bin-$(uname -s)-amd64" && \
chmod +x /usr/local/bin/ahoy && \
ahoy --version
- name: Lint code
run: ahoy lint
continue-on-error: ${{ vars.CI_LINT_IGNORE_FAILURE == '1' }}
- name: Lint documentation
run: ahoy lint-docs
continue-on-error: ${{ vars.CI_LINT_DOCS_IGNORE_FAILURE == '1' }}
test:
name: Test PHP ${{ matrix.php_version }}, Drupal ${{ matrix.drupal_version }}, Deps ${{ matrix.deps }}${{ matrix.driver && format(', Driver {0}', matrix.driver) || '' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- php_version: '8.2'
drupal_version: '10'
deps: 'normal'
- php_version: '8.2'
drupal_version: '10'
deps: 'lowest'
- php_version: '8.3'
drupal_version: '10'
deps: 'normal'
- php_version: '8.3'
drupal_version: '10'
deps: 'lowest'
- php_version: '8.3'
drupal_version: '11'
deps: 'normal'
- php_version: '8.3'
drupal_version: '11'
deps: 'lowest'
- php_version: '8.4'
drupal_version: '10'
deps: 'normal'
- php_version: '8.4'
drupal_version: '10'
deps: 'lowest'
- php_version: '8.4'
drupal_version: '11'
deps: 'normal'
- php_version: '8.4'
drupal_version: '11'
deps: 'lowest'
# Selenium-less driver legs: run the same suite through headless
# Chrome over the DevTools Protocol to prove the steps are driver
# portable. The browser driver is Drupal-version independent, so a
# single normal-deps leg per Drupal version is enough.
- php_version: '8.3'
drupal_version: '10'
deps: 'normal'
driver: 'chrome_headless'
- php_version: '8.3'
drupal_version: '11'
deps: 'normal'
driver: 'chrome_headless'
container:
image: drevops/ci-runner:26.6.0@sha256:190027056cac7b7ce28c29a1e5494779ebadc4ee8e95d468b75bc56e7be5aabd
env:
TERM: xterm-256color
PHP_VERSION: ${{ matrix.php_version }}
DRUPAL_VERSION: ${{ matrix.drupal_version }}
DEPS: ${{ matrix.deps }}
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
steps:
- name: Check out code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Process the codebase to run in CI
run: |
sed -i -e "/###/d" docker-compose.yml
sed -i -e "s/##//" docker-compose.yml
cat docker-compose.yml
- name: Build stack
run: |
docker compose up -d --build
docker cp -L . "$(docker compose ps -q cli)":/app/
timeout-minutes: 30
- name: Install development dependencies
run: |
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c " \
if [ -n \"${PACKAGE_TOKEN:-}\" ]; then export COMPOSER_AUTH='{\"github-oauth\": {\"github.com\": \"${PACKAGE_TOKEN-}\"}}'; fi && \
COMPOSER_MEMORY_LIMIT=-1 composer --ansi install --prefer-dist"
- name: Provision application
run: docker compose exec -e DRUPAL_VERSION=${DRUPAL_VERSION} -e DEPS=${DEPS} -T cli bash scripts/provision.sh
- name: Install Ahoy CLI
run: |
version=2.4.0 && \
set -x && curl -L -o "/usr/local/bin/ahoy" "https://github.com/ahoy-cli/ahoy/releases/download/v${version}/ahoy-bin-$(uname -s)-amd64" && \
chmod +x /usr/local/bin/ahoy && \
ahoy --version
- name: Run Unit tests with coverage
if: "matrix.driver != 'chrome_headless' && matrix.php_version == '8.3' && matrix.drupal_version == '11' && matrix.deps == 'normal'"
run: ahoy test-unit-coverage
continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }}
- name: Run Unit tests
if: "matrix.driver != 'chrome_headless' && !(matrix.php_version == '8.3' && matrix.drupal_version == '11' && matrix.deps == 'normal')"
run: ahoy test-unit
continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }}
- name: Run BDD tests with coverage
if: "matrix.driver != 'chrome_headless' && matrix.php_version == '8.3' && matrix.drupal_version == '11' && matrix.deps == 'normal'"
run: ahoy test-bdd-coverage
continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }}
- name: Run BDD tests
if: "matrix.driver != 'chrome_headless' && !(matrix.php_version == '8.3' && matrix.drupal_version == '11' && matrix.deps == 'normal')"
run: ahoy test-bdd
continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }}
# Selenium-less leg: the same BDD suite driven through headless Chrome
# over the DevTools Protocol, proving the steps work without Selenium.
# The Drupal 11 leg runs with coverage so the driver-specific branches
# (reachable only through chrome-mink) are measured and merged into the
# Codecov report alongside the Selenium2 coverage.
- name: Run BDD tests with coverage with the chrome_headless driver
if: "matrix.driver == 'chrome_headless' && matrix.drupal_version == '11'"
run: ahoy test-bdd-coverage -- -p chrome_headless
continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }}
- name: Run BDD tests with the chrome_headless driver
if: "matrix.driver == 'chrome_headless' && matrix.drupal_version != '11'"
run: ahoy test-bdd -- -p chrome_headless
continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }}
- name: Process test logs and artifacts
if: always()
run: |
mkdir -p .logs
if docker compose ps --services --filter "status=running" | \
grep -q cli && docker compose exec -T cli test -d /app/.logs; then
docker compose cp cli:/app/.logs/. ".logs/"
fi
- name: Upload test artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
if: always()
with:
name: test-artifacts-php${{ matrix.php_version }}-drupal${{ matrix.drupal_version }}-${{ matrix.deps }}${{ matrix.driver && format('-{0}', matrix.driver) || '' }}
path: .logs
include-hidden-files: true
retention-days: 30
- name: Upload code coverage reports to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
if: matrix.php_version == '8.3' && matrix.drupal_version == '11' && matrix.deps == 'normal' && env.CODECOV_TOKEN != '' && !startsWith(github.head_ref, 'deps/')
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: .logs/coverage
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}