Skip to content

Commit d35ab22

Browse files
committed
Merge branch '1.x' into feature/add-bats-test-ahoy-operation
2 parents 74be735 + 9362429 commit d35ab22

18 files changed

+124
-132
lines changed

.ahoy.yml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,51 @@ commands:
88
build:
99
usage: Build or rebuild the project.
1010
cmd: |
11-
ahoy build-codebase
12-
ahoy start-server
11+
ahoy assemble
12+
ahoy start
1313
ahoy provision
1414
15-
build-codebase:
16-
usage: Build the codebase.
17-
cmd: ./.devtools/build-codebase.sh
15+
assemble:
16+
usage: Assemble a codebase using project code and all required dependencies.
17+
cmd: ./.devtools/assemble.sh
1818

19-
start-server:
20-
usage: Start built-in PHP-server.
21-
cmd: ./.devtools/start-server.sh
19+
start:
20+
usage: Start development environment.
21+
cmd: ./.devtools/start.sh
2222

2323
provision:
24-
usage: Provision a website.
24+
usage: Provision application within assembled codebase.
2525
cmd: ./.devtools/provision.sh
2626

27+
drush:
28+
usage: Run Drush command.
29+
cmd: build/vendor/bin/drush -l http://${WEBSERVER_HOST:-localhost}:${WEBSERVER_PORT:-8000} $*
30+
31+
login:
32+
usage: Login to a website.
33+
cmd: ahoy drush uli
34+
2735
lint:
28-
usage: Lint code.
36+
usage: Check coding standards for violations.
2937
cmd: |
3038
pushd "build" >/dev/null || exit 1
3139
vendor/bin/phpcs
3240
vendor/bin/phpstan
3341
vendor/bin/rector --clear-cache --dry-run
3442
vendor/bin/phpmd . text phpmd.xml
35-
vendor/bin/twigcs
43+
vendor/bin/twig-cs-fixer
3644
popd >/dev/null || exit 1
3745
3846
lint-fix:
39-
usage: Fix coding standards.
47+
usage: Fix violations in coding standards.
4048
cmd: |
4149
pushd "build" >/dev/null || exit 1
4250
vendor/bin/rector --clear-cache
4351
vendor/bin/phpcbf
4452
popd >/dev/null || exit 1
4553
4654
test:
47-
usage: Run all tests.
55+
usage: Run tests.
4856
cmd: |
4957
pushd "build" >/dev/null || exit 1
5058
vendor/bin/phpunit
@@ -71,6 +79,14 @@ commands:
7179
vendor/bin/phpunit --testsuite functional
7280
popd >/dev/null || exit 1
7381
82+
reset:
83+
usage: Reset project to the default state.
84+
cmd: |
85+
killall -9 php >/dev/null 2>&1 || true
86+
chmod -Rf 777 build > /dev/null
87+
rm -Rf build > /dev/null || true
88+
rm -Rf .logs > /dev/null || true
89+
7490
# Override entrypoint to alter default behaviour of Ahoy.
7591
entrypoint:
7692
- bash

.circleci/config.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ job-test: &job-test
2121

2222
- run:
2323
name: Build the codebase
24-
command: .devtools/build-codebase.sh
24+
command: .devtools/assemble.sh
2525

2626
- run:
2727
name: Start built-in PHP server
28-
command: .devtools/start-server.sh
28+
command: .devtools/start.sh
2929

3030
- run:
3131
name: Provision site
@@ -52,8 +52,8 @@ job-test: &job-test
5252
working_directory: build
5353

5454
- run:
55-
name: Lint code with Twigcs
56-
command: vendor/bin/twigcs || [ "${CI_TWIGCS_IGNORE_FAILURE:-0}" -eq 1 ]
55+
name: Lint code with Twig CS Fixer
56+
command: vendor/bin/twig-cs-fixer || [ "${CI_TWIGCSFIXER_IGNORE_FAILURE:-0}" -eq 1 ]
5757
working_directory: build
5858

5959
- run:
@@ -88,8 +88,7 @@ jobs:
8888
docker:
8989
- image: cimg/php:8.2-browsers
9090
environment:
91-
DRUPAL_VERSION: 9.5
92-
DRUPAL_PROJECT_SHA: 9.x
91+
DRUPAL_VERSION: 10.1
9392
<<: *job-test
9493

9594
test-php-8.2-next:

.devtools/README.nd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This directory contains scripts used for development.
2+
3+
These can be used locally and in the CI environment.

.devtools/README.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

.devtools/build-codebase.sh renamed to .devtools/assemble.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
##
3-
# Build the codebase.
3+
# Assemble a codebase using project code and all required dependencies.
44
#
55
# Allows to use the latest Drupal core as well as specified versions (for
66
# testing backward compatibility).
@@ -37,9 +37,10 @@ DRUPAL_PROJECT_REPO="${DRUPAL_PROJECT_REPO:-https://github.com/drupal-composer/d
3737

3838
#-------------------------------------------------------------------------------
3939

40-
echo "-------------------------------"
41-
echo " Build codebase "
42-
echo "-------------------------------"
40+
echo "==============================="
41+
echo " 🏗️ ASSEMBLE "
42+
echo "==============================="
43+
echo
4344

4445
# Make sure Composer doesn't run out of memory.
4546
export COMPOSER_MEMORY_LIMIT=-1
@@ -107,7 +108,7 @@ for composer_suggest in $composer_suggests; do
107108
done
108109

109110
echo "> Copy tools configuration files."
110-
cp phpcs.xml phpstan.neon phpmd.xml rector.php .twig_cs.php phpunit.xml "build/"
111+
cp phpcs.xml phpstan.neon phpmd.xml rector.php .twig-cs-fixer.php phpunit.xml "build/"
111112

112113
echo "> Symlink extension's code."
113114
rm -rf "build/web/${type}/custom" >/dev/null && mkdir -p "build/web/${type}/custom/${extension}"
@@ -126,11 +127,11 @@ if [ -f "build/web/${type}/custom/${extension}/package-lock.json" ]; then
126127
fi
127128

128129
echo
129-
echo "-------------------------------"
130-
echo " Codebase built 🚀 "
131-
echo "-------------------------------"
130+
echo "==============================="
131+
echo " 🏗 ASSEMBLE COMPLETE "
132+
echo "==============================="
132133
echo
133134
echo "> Next steps:"
134-
echo " .devtools/start-server.sh # Start the webserver"
135+
echo " .devtools/start.sh # Start the webserver"
135136
echo " .devtools/provision.sh # Provision the website"
136137
echo

.devtools/deploy.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ if [ -n "${DEPLOY_SSH_KEY_FINGERPRINT}" ]; then
7676
ssh-add -l
7777
fi
7878

79-
echo "-------------------------------"
80-
echo " Deploy code "
81-
echo "-------------------------------"
79+
echo "==============================="
80+
echo " 🚚 DEPLOY "
81+
echo "==============================="
82+
echo
8283

8384
[ -z "${DEPLOY_USER_NAME}" ] && echo "ERROR: Missing required value for DEPLOY_USER_NAME" && exit 1
8485
[ -z "${DEPLOY_USER_EMAIL}" ] && echo "ERROR: Missing required value for DEPLOY_USER_EMAIL" && exit 1
@@ -106,9 +107,9 @@ git push --force deployremote HEAD:"${DEPLOY_BRANCH}"
106107
echo "> Push tags."
107108
git push --force --tags deployremote || true
108109

109-
echo "-------------------------------"
110-
echo " Deployed code "
111-
echo "-------------------------------"
110+
echo "==============================="
111+
echo " 🚚 DEPLOY COMPLETE "
112+
echo "==============================="
112113
echo
113114
echo "Remote URL : ${DEPLOY_REMOTE}"
114115
echo "Remote branch : ${DEPLOY_BRANCH}"

.devtools/provision.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ DRUPAL_PROFILE="${DRUPAL_PROFILE:-standard}"
2626

2727
#-------------------------------------------------------------------------------
2828

29-
echo "----------------------------------"
30-
echo " Install Drupal and extensions "
31-
echo "----------------------------------"
29+
echo "==============================="
30+
echo " 🚀 PROVISION "
31+
echo "==============================="
32+
echo
3233

3334
drush() { "build/vendor/bin/drush" -r "$(pwd)/build/web" -y "$@"; }
3435

@@ -65,9 +66,9 @@ done
6566
curl -s "http://${WEBSERVER_HOST}:${WEBSERVER_PORT}" >/dev/null
6667

6768
echo
68-
echo "-------------------------------"
69-
echo " Install finished 🚀🚀🚀 "
70-
echo "-------------------------------"
69+
echo "==============================="
70+
echo " 🚀 PROVISION COMPLETE "
71+
echo "==============================="
7172
echo
7273
echo "Site URL: http://${WEBSERVER_HOST}:${WEBSERVER_PORT}"
7374
echo -n "One-time login link: "

.devtools/start-server.sh renamed to .devtools/start.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
##
3-
# Start built-in PHP-server.
3+
# Start development environment.
44
#
55
# shellcheck disable=SC2015,SC2094,SC2002
66

@@ -22,9 +22,10 @@ WEBSERVER_WAIT_TIMEOUT="${WEBSERVER_WAIT_TIMEOUT:-5}"
2222

2323
#-------------------------------------------------------------------------------
2424

25-
echo "-------------------------------"
26-
echo " Start built-in PHP server "
27-
echo "-------------------------------"
25+
echo "==============================="
26+
echo " 💻 START ENVIRONMENT "
27+
echo "==============================="
28+
echo
2829

2930
echo "> Stop previously started services, if any."
3031
killall -9 php >/dev/null 2>&1 || true
@@ -44,9 +45,9 @@ echo "> Check that the server can serve content."
4445
curl -s -o /dev/null -w "%{http_code}" -L -I "http://${WEBSERVER_HOST}:${WEBSERVER_PORT}" | grep -q 200 || (echo "ERROR: Server is started, but site cannot be served" && exit 1)
4546

4647
echo
47-
echo "-----------------------------------"
48-
echo " Started built-in PHP server 🚀🚀 "
49-
echo "-----------------------------------"
48+
echo "==============================="
49+
echo " 💻 ENVIRONMENT READY "
50+
echo "==============================="
5051
echo
5152
echo "Directory : $(pwd)/build/web"
5253
echo "URL : http://${WEBSERVER_HOST}:${WEBSERVER_PORT}"

.gitattributes

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Ignore files for distribution archives.
22

33
# Uncomment the lines below in your project.
4-
# .ahoy.yml export-ignore
5-
# .circleci export-ignore
6-
# .devtools export-ignore
7-
# .editorconfig export-ignore
8-
# .gitattributes export-ignore
9-
# .github export-ignore
10-
# .gitignore export-ignore
11-
# .twig_cs.php export-ignore
12-
# composer.dev.json export-ignore
13-
# phpcs.xml export-ignore
14-
# phpmd.xml export-ignore
15-
# phpstan.neon export-ignore
16-
# rector.php export-ignore
17-
# renovate.json export-ignore
18-
# tests export-ignore
4+
# .ahoy.yml export-ignore
5+
# .circleci export-ignore
6+
# .devtools export-ignore
7+
# .editorconfig export-ignore
8+
# .gitattributes export-ignore
9+
# .github export-ignore
10+
# .gitignore export-ignore
11+
# .twig-cs-fixer.php export-ignore
12+
# composer.dev.json export-ignore
13+
# phpcs.xml export-ignore
14+
# phpmd.xml export-ignore
15+
# phpstan.neon export-ignore
16+
# rector.php export-ignore
17+
# renovate.json export-ignore
18+
# tests export-ignore
1919

2020
# Remove the lines below in your project.
2121
.github/FUNDING.yml export-ignore

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424

2525
- name: test-php-8.2-legacy
2626
php-version: 8.2
27-
drupal-version: 9.5
28-
drupal-project-sha: 9.x
27+
drupal-version: 10.1
28+
drupal-project-sha: 10.x
2929
drupal-version-alias: legacy
3030

3131
- name: test-php-8.2-next
@@ -65,10 +65,10 @@ jobs:
6565
php-version: ${{ matrix.php-version }}
6666

6767
- name: Build the codebase
68-
run: .devtools/build-codebase.sh
68+
run: .devtools/assemble.sh
6969

7070
- name: Start built-in PHP server
71-
run: .devtools/start-server.sh
71+
run: .devtools/start.sh
7272

7373
- name: Provision site
7474
run: .devtools/provision.sh
@@ -89,9 +89,9 @@ jobs:
8989
working-directory: build
9090
run: vendor/bin/phpmd . text phpmd.xml || [ "${CI_PHPMD_IGNORE_FAILURE:-0}" -eq 1 ]
9191

92-
- name: Lint code with Twigcs
92+
- name: Lint code with Twig CS Fixer
9393
working-directory: build
94-
run: vendor/bin/twigcs || [ "${CI_TWIGCS_IGNORE_FAILURE:-0}" -eq 1 ]
94+
run: vendor/bin/twig-cs-fixer || [ "${CI_TWIGCSFIXER_IGNORE_FAILURE:-0}" -eq 1 ]
9595

9696
- name: Run tests
9797
working-directory: build

.scaffold/tests/bats/_assert_init.bash

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -120,29 +120,10 @@ assert_workflow() {
120120

121121
pushd "${dir}" >/dev/null || exit 1
122122

123-
./.devtools/build-codebase.sh
124-
./.devtools/start-server.sh
125-
./.devtools/provision.sh
126-
127-
# Lint.
128-
pushd "build" >/dev/null || exit 1
129-
130-
vendor/bin/phpcs
131-
vendor/bin/phpstan
132-
vendor/bin/rector --clear-cache --dry-run
133-
vendor/bin/phpmd . text phpmd.xml
134-
vendor/bin/twigcs
135-
136-
popd >/dev/null || exit 1
137-
138-
# Test.
139-
./.devtools/test.sh
140-
141-
# Change mode to make bats have enough permission to clean tmp test directory.
142-
chmod -R 777 "build/web/sites/default"
143-
144-
# Allow bats finish this assert, we need kill php process because it run in background in start server step.
145-
killall -9 php >/dev/null 2>&1 || true
123+
ahoy build
124+
ahoy lint
125+
ahoy test
126+
ahoy reset
146127

147128
popd >/dev/null || exit 1
148129
}

.twig-cs-fixer.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
$ruleset = new TwigCsFixer\Ruleset\Ruleset();
6+
$ruleset->addStandard(new TwigCsFixer\Standard\Twig());
7+
8+
$finder = new TwigCsFixer\File\Finder();
9+
$finder->in(__DIR__ . '/web/modules/custom');
10+
$finder->in(__DIR__ . '/web/themes/custom');
11+
12+
$config = new TwigCsFixer\Config\Config();
13+
$config->setRuleset($ruleset);
14+
$config->setFinder($finder);
15+
16+
return $config;

.twig_cs.php

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)