-
-
Notifications
You must be signed in to change notification settings - Fork 192
Expand file tree
/
Copy path.ahoy.yml
More file actions
253 lines (196 loc) · 9.05 KB
/
Copy path.ahoy.yml
File metadata and controls
253 lines (196 loc) · 9.05 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
ahoyapi: v2
commands:
build:
usage: Build or rebuild project.
cmd: |
ahoy reset
ahoy up -- --build --force-recreate
ahoy assemble
ahoy provision
ahoy info 1
assemble:
usage: Install Composer dependencies for the selected Drupal version.
cmd: |
ahoy composer self-update
ahoy composer require --no-interaction --dev --no-update drupal/core:^${DRUPAL_VERSION:-11} drupal/core-composer-scaffold:^${DRUPAL_VERSION:-11}
if [ "${DRUPAL_VERSION:-11}" != "11" ]; then ahoy composer remove --no-interaction --dev --no-update phpunit/phpunit; fi
ahoy composer install
info:
usage: Print information about this project.
cmd: |
echo " Drupal version : " ${DRUPAL_VERSION:-11}
echo " PHP version : " ${PHP_VERSION:-8.3}
echo " Site local URL : " ${LOCALDEV_URL:-http://${COMPOSE_PROJECT_NAME:-$(basename "$PWD")}.docker.amazee.io}
echo " Path to project : " /app
echo " Path to web root : " /app/build/web
echo " DB port on host : " $(docker compose port mariadb 3306 2>/dev/null | cut -d : -f 2)
echo " Selenium VNC URL on host : http://localhost:$(docker compose port chrome 7900 2>/dev/null | cut -d : -f 2)/?autoconnect=1&password=secret"
echo " Xdebug : " $(ahoy cli php -v 2>/dev/null | grep -q Xdebug && echo "enabled (disable with 'ahoy up')" || echo "disabled (enable with 'ahoy debug')")
if [ -n "$1" ]; then
echo " One-time login : " $(ahoy login -- --no-browser)
fi
db:
usage: Open DB in Sequel Ace.
cmd: |
uname -a | grep -i -q darwin && mdfind -name 'Sequel Ace'|grep -q "Ace" && \
HOST_DB_PORT="$(docker compose port mariadb 3306 2>/dev/null | cut -d : -f 2)" && \
open "mysql://drupal:drupal@127.0.0.1:${HOST_DB_PORT}/drupal" -a "Sequel Ace" \
|| echo "Not a supported OS or Sequel Ace is not installed."
# ----------------------------------------------------------------------------
# Docker commands.
# ----------------------------------------------------------------------------
up:
usage: Build and start Docker containers.
cmd: docker compose up -d "$@" && if docker compose logs | grep -q "\[Error\]"; then exit 1; fi
down:
usage: Stop Docker containers and remove container, images, volumes and networks.
cmd: if [ -f "docker-compose.yml" ]; then docker compose down --remove-orphans --volumes > /dev/null 2>&1; fi
start:
usage: Start existing Docker containers.
cmd: docker compose start "$@"
stop:
usage: Stop running Docker containers.
cmd: docker compose stop "$@"
restart:
usage: Restart all stopped and running Docker containers.
cmd: docker compose restart
logs:
usage: Show Docker logs.
cmd: docker compose logs "$@"
pull:
usage: Pull latest docker images.
cmd: if [ ! -z "$(docker image ls -q)" ]; then docker image ls --format \"{{.Repository}}:{{.Tag}}\" | grep uselagoon/ | grep -v none | xargs -n1 docker pull | cat; fi
cli:
usage: Start a shell inside CLI container or run a command.
cmd: if \[ "${#}" -ne 0 \]; then docker compose exec -e BEHAT_CLI_DEBUG=${BEHAT_CLI_DEBUG:-0} -T cli bash -c "$*"; else docker compose exec cli bash; fi
composer:
usage: Run Composer commands in the CLI container.
cmd: docker compose exec -T cli composer "$@"
drush:
usage: Run Drush commands in the CLI container.
cmd: docker compose exec -T cli /app/vendor/bin/drush --root=/app/build/web --uri=${LOCALDEV_URL:-http://${COMPOSE_PROJECT_NAME:-$(basename "$PWD")}.docker.amazee.io} "$@"
debug:
usage: Enable PHP Xdebug.
cmd: ahoy cli php -v | grep -q Xdebug || XDEBUG_ENABLE=true docker compose up -d --force-recreate cli php && ahoy cli php -v | grep -q Xdebug && echo "Enabled debug configuration. Use 'ahoy up -- --force-recreate' to disable."
# ----------------------------------------------------------------------------
# Application commands.
# ----------------------------------------------------------------------------
login:
usage: Login to a website.
cmd: ahoy drush uli "$@"
provision:
usage: Provision a fixture test site.
cmd: ahoy cli ./scripts/provision.sh
clean:
usage: Remove containers and all build files.
cmd: |
ahoy down || true
sleep 5
chmod -Rf 777 build 2>&1 > /dev/null || true
rm -rf \
./vendor \
./composer.lock \
./build \
2>&1 > /dev/null || true
reset:
usage: "Reset environment: remove containers, all build files, and logs."
cmd: ahoy clean && rm -rf ./.logs ./composer.lock ./patches.lock.json
# ----------------------------------------------------------------------------
# Documentation commands.
# ----------------------------------------------------------------------------
docs:
usage: Generate STEPS.md and README.md documentation.
cmd: php scripts/docs.php
docs-lint:
usage: Check that generated documentation is up to date.
aliases: [lint-docs]
cmd: php scripts/docs.php --fail-on-change
# ----------------------------------------------------------------------------
# Test commands.
# ----------------------------------------------------------------------------
lint:
usage: Lint code.
cmd: |
ahoy title "Running PHP Parallel Lint"
ahoy cli "vendor/bin/parallel-lint src scripts tests"
ahoy title "Running PHP Code Sniffer"
ahoy cli "vendor/bin/phpcs"
ahoy title "Running PHPStan"
ahoy cli vendor/bin/phpstan
ahoy title "Running Rector (dry-run)"
ahoy cli "vendor/bin/rector process --dry-run"
ahoy title "Running Gherkin Lint"
ahoy cli "vendor/bin/gherkinlint lint tests/behat/features"
ahoy title "Running Docs Lint"
ahoy docs-lint
lint-fix:
usage: Fix code.
cmd: |
ahoy title "Running Rector"
ahoy cli "vendor/bin/rector process"
ahoy title "Running PHP Code Beautifier"
ahoy cli "vendor/bin/phpcbf"
test:
usage: Run all tests without coverage.
cmd: |
ahoy title "Running PHPUnit"
ahoy test-unit
ahoy test-bdd
test-unit:
usage: Run PHPUnit tests.
cmd: ahoy cli "vendor/bin/phpunit -c phpunit.xml --no-coverage $@"
test-bdd:
usage: Run all Behat tests.
cmd: |
# If no arguments are passed, run in strict mode. If any arguments are passed, do not use strict mode to allow running specific tests.
STRICT=""; if [ -z "$1" ]; then STRICT="--strict"; fi
ahoy title "Running Behat: blackbox"
ahoy cli "vendor/bin/behat $STRICT --no-coverage --allow-no-tests $@"
ahoy title "Running Behat: drupal"
ahoy cli "vendor/bin/behat --profile=drupal $STRICT --no-coverage --allow-no-tests $@"
test-bdd-blackbox:
usage: Run blackbox Behat tests.
cmd: ahoy cli "vendor/bin/behat --strict --no-coverage $@"
test-bdd-drupal:
usage: Run Drupal API Behat tests.
cmd: ahoy cli "vendor/bin/behat --profile=drupal --strict --no-coverage $@"
test-coverage:
usage: Run all tests with coverage and merge reports.
cmd: |
ahoy cli "rm -rf .logs/coverage && mkdir -p .logs/coverage/phpunit .logs/coverage/behat .logs/coverage/behat_cli/phpcov"
ahoy title "Running PHPUnit with coverage"
ahoy cli "php -d pcov.enabled=1 -d pcov.directory=. vendor/bin/phpunit -c phpunit.xml"
ahoy title "Running Behat with coverage: blackbox"
ahoy cli "php -d pcov.enabled=1 -d pcov.directory=/app/src vendor/bin/behat --strict --allow-no-tests"
ahoy title "Running Behat with coverage: drupal"
ahoy cli "php -d pcov.enabled=1 -d pcov.directory=/app/src vendor/bin/behat --profile=drupal --strict --allow-no-tests"
ahoy cli "php scripts/merge-coverage.php"
test-unit-coverage:
usage: Run PHPUnit tests with coverage.
cmd: |
ahoy cli "rm -rf .logs/coverage && mkdir -p .logs/coverage/phpunit"
ahoy title "Running PHPUnit with coverage"
ahoy cli "php -d pcov.enabled=1 -d pcov.directory=. vendor/bin/phpunit -c phpunit.xml $@"
ahoy cli "php scripts/merge-coverage.php"
test-bdd-coverage:
usage: Run all Behat tests with coverage and merge reports.
cmd: |
ahoy cli "rm -rf .logs/coverage && mkdir -p .logs/coverage/behat .logs/coverage/behat_cli/phpcov"
# If no arguments are passed, run in strict mode. If any arguments are passed, do not use strict mode to allow running specific tests.
STRICT=""; if [ -z "$1" ]; then STRICT="--strict"; fi
ahoy title "Running Behat with coverage: blackbox"
ahoy cli "php -d pcov.enabled=1 -d pcov.directory=/app/src vendor/bin/behat $STRICT --allow-no-tests $@"
ahoy title "Running Behat with coverage: drupal"
ahoy cli "php -d pcov.enabled=1 -d pcov.directory=/app/src vendor/bin/behat --profile=drupal $STRICT --allow-no-tests $@"
ahoy cli "php scripts/merge-coverage.php"
title:
usage: Print a cyan header.
cmd: echo -e "\n\033[36m$@\033[0m"
hide: true
entrypoint:
- bash
- "-c"
- "-e"
- bash -e -c "$0" "$@"
- '{{cmd}}'
- '{{name}}'