Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to scaffold 4.8.0 and Drupal 11 compatibility. #24

Merged
merged 12 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 74 additions & 14 deletions .ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,101 @@ commands:
build:
usage: Build or rebuild the project.
cmd: |
ahoy build-codebase
ahoy start-server
ahoy stop > /dev/null 2>&1 || true
ahoy assemble
ahoy start
ahoy provision

build-codebase:
usage: Build the codebase.
cmd: ./.devtools/build-codebase.sh
assemble:
usage: Assemble a codebase using project code and all required dependencies.
cmd: ./.devtools/assemble.sh

start-server:
usage: Start built-in PHP-server.
cmd: ./.devtools/start-server.sh
start:
usage: Start development environment.
cmd: ./.devtools/start.sh

stop:
usage: Stop development environment.
cmd: ./.devtools/stop.sh

provision:
usage: Provision a website.
usage: Provision application within assembled codebase.
cmd: ./.devtools/provision.sh

drush:
usage: Run Drush command.
cmd: build/vendor/bin/drush -l http://${WEBSERVER_HOST:-localhost}:${WEBSERVER_PORT:-8000} $*

login:
usage: Login to a website.
cmd: ahoy drush uli

lint:
usage: Lint code.
usage: Check coding standards for violations.
cmd: |
pushd "build" >/dev/null || exit 1
vendor/bin/phpcs
vendor/bin/phpstan
vendor/bin/rector --clear-cache --dry-run
vendor/bin/phpmd . text phpmd.xml
vendor/bin/twigcs
vendor/bin/twig-cs-fixer
popd >/dev/null || exit 1

lint-fix:
usage: Fix coding standards.
usage: Fix violations in coding standards.
cmd: |
pushd "build" >/dev/null || exit 1
vendor/bin/rector --clear-cache
vendor/bin/phpcbf
vendor/bin/twig-cs-fixer --no-cache --fix
popd >/dev/null || exit 1

test:
usage: Run all tests.
cmd: ./.devtools/test.sh
usage: Run tests.
cmd: |
pushd "build" >/dev/null || exit 1
vendor/bin/phpunit
popd >/dev/null || exit 1

test-unit:
usage: Run unit tests.
cmd: |
pushd "build" >/dev/null || exit 1
vendor/bin/phpunit --testsuite unit
popd >/dev/null || exit 1

test-kernel:
usage: Run kernel tests.
cmd: |
pushd "build" >/dev/null || exit 1
vendor/bin/phpunit --testsuite kernel
popd >/dev/null || exit 1

test-functional:
usage: Run functional tests.
cmd: |
pushd "build" >/dev/null || exit 1
vendor/bin/phpunit --testsuite functional
popd >/dev/null || exit 1

reset:
usage: Reset project to the default state.
cmd: |
killall -9 php >/dev/null 2>&1 || true
chmod -Rf 777 build > /dev/null
rm -Rf build > /dev/null || true
rm -Rf .logs > /dev/null || true

# Override entrypoint to alter default behaviour of Ahoy.
entrypoint:
- bash
- -c
- -e
- |
extension="$(basename -s .info.yml -- ./*.info.yml)"
export BROWSERTEST_OUTPUT_DIRECTORY="${TMPDIR:-/tmp}"
export SIMPLETEST_BASE_URL=http://${WEBSERVER_HOST:-localhost}:${WEBSERVER_PORT:-8000}
export SIMPLETEST_DB=sqlite://localhost/drupal_test_${extension}.sqlite
bash -e -c "$0" "$@"
- '{{cmd}}'
- '{{name}}'
138 changes: 88 additions & 50 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
version: 2

aliases:
# Default git branch name used for deploying tagged releases.
- &default_branch "2.x"

# SSH deployment key fingerprint from CircleCI App -> Project -> Settings -> SSH Permissions.
# Replace with the value used for your project.
- &deploy_ssh_fingerprint "2d:71:4d:aa:4d:34:38:b5:8f:af:ca:3b:d4:82:6a:21"
Expand All @@ -12,17 +15,35 @@ aliases:
docker:
- image: cimg/php:8.2-browsers

job-build: &job-build
job-test: &job-test
steps:
- checkout

- run:
name: Build the codebase
command: .devtools/build-codebase.sh
name: Upgrade sqlite3
command: |
wget https://www.sqlite.org/2024/sqlite-autoconf-3450300.tar.gz -O /tmp/sqlite.tar.gz
tar -xzf /tmp/sqlite.tar.gz -C /tmp
cd /tmp/sqlite-autoconf-3450300
./configure CFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA=1" --prefix=/usr/local
make && sudo make install
sudo ldconfig
echo "export LD_LIBRARY_PATH=/usr/local/lib" >> $BASH_ENV

- run:
name: Install PCOV
command: |
sudo pecl install pcov
echo "extension=pcov.so" | sudo tee -a /usr/local/etc/php/conf.d/pcov.ini
echo "pcov.enabled=1" | sudo tee -a /usr/local/etc/php/conf.d/pcov.ini

- run:
name: Assemble the codebase
command: .devtools/assemble.sh

- run:
name: Start built-in PHP server
command: .devtools/start-server.sh
command: .devtools/start.sh

- run:
name: Provision site
Expand All @@ -49,110 +70,127 @@ job-build: &job-build
working_directory: build

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

- run:
name: Run tests
command: .devtools/test.sh || [ "${CI_TEST_IGNORE_FAILURE:-0}" -eq 1 ]

- run:
name: Process artifacts
command: |
if [ -d "build/web/sites/simpletest/browser_output" ]; then
mkdir -p /tmp/artifacts/simpletest
cp -Rf "build/web/sites/simpletest/browser_output/." /tmp/artifacts/simpletest
fi
when: always
command: vendor/bin/phpunit || [ "${CI_TEST_IGNORE_FAILURE:-0}" -eq 1 ]
working_directory: build
environment:
BROWSERTEST_OUTPUT_DIRECTORY: /tmp

- store_test_results:
path: /tmp/test_results
path: .logs/test_results

- store_artifacts:
path: /tmp/artifacts
path: build/web/sites/simpletest/browser_output

- store_artifacts:
path: .logs/coverage

- run:
name: Upload code coverage reports to Codecov
command: |
if [ -z "${CIRCLE_TAG-}" ] && [ -n "${CODECOV_TOKEN-}" ] && [ -d .logs/coverage/phpunit ]; then
curl -Os https://cli.codecov.io/latest/linux/codecov && sudo chmod +x codecov
./codecov --verbose upload-process --fail-on-error -n "circleci-$CIRCLE_JOB" -s .logs/coverage
fi

jobs:
build-php-8.1:
test-php-8.2:
<<: *container_config
docker:
- image: cimg/php:8.1-browsers
<<: *job-build
- image: cimg/php:8.2-browsers
environment:
DRUPAL_VERSION: 10.1
DRUPAL_PROJECT_SHA: 10.x
<<: *job-test

build-php-8.2:
test-php-8.2-legacy:
<<: *container_config
docker:
- image: cimg/php:8.2-browsers
<<: *job-build
environment:
DRUPAL_VERSION: 10.1
DRUPAL_PROJECT_SHA: 10.x
<<: *job-test

build-php-8.1-legacy:
test-php-8.2-next:
<<: *container_config
docker:
- image: cimg/php:8.1-browsers
- image: cimg/php:8.2-browsers
environment:
DRUPAL_VERSION: 9.5
DRUPAL_PROJECT_SHA: 9.x
<<: *job-build
DRUPAL_VERSION: 10@beta
DRUPAL_PROJECT_SHA: 10.x
<<: *job-test

build-php-8.2-legacy:
test-php-8.3:
<<: *container_config
docker:
- image: cimg/php:8.2-browsers
- image: cimg/php:8.3-browsers
environment:
DRUPAL_VERSION: 9.5
DRUPAL_PROJECT_SHA: 9.x
<<: *job-build
DRUPAL_VERSION: stable
DRUPAL_PROJECT_SHA: 10.x
<<: *job-test

build-php-8.2-next:
test-php-8.3-next:
<<: *container_config
docker:
- image: cimg/php:8.2-browsers
- image: cimg/php:8.3-browsers
environment:
DRUPAL_VERSION: 10@beta
<<: *job-build
DRUPAL_VERSION: 11@alpha
DRUPAL_PROJECT_SHA: 11.x
<<: *job-test

deploy:
<<: *container_config
environment:
DEPLOY_SSH_FINGERPRINT: *deploy_ssh_fingerprint
DEPLOY_SSH_KEY_FINGERPRINT: *deploy_ssh_fingerprint
DEFAULT_BRANCH: *default_branch
steps:
- checkout

- add_ssh_keys:
fingerprints:
- *deploy_ssh_fingerprint
- run: DEPLOY_BRANCH=${DEPLOY_BRANCH:-${CIRCLE_BRANCH}} .devtools/deploy.sh

- run:
name: Deploy
command: DEPLOY_BRANCH=${DEPLOY_BRANCH:-${CIRCLE_BRANCH:-${DEFAULT_BRANCH}}} .devtools/deploy.sh

workflows:
version: 2
main:
commit:
jobs:
- build-php-8.1:
- test-php-8.2:
filters:
tags:
only: /.*/
- build-php-8.2:
- test-php-8.2-legacy:
filters:
tags:
only: /.*/
- build-php-8.1-legacy:
- test-php-8.2-next:
filters:
tags:
only: /.*/
- build-php-8.2-legacy:
- test-php-8.3:
filters:
tags:
only: /.*/
- build-php-8.2-next:
- test-php-8.3-next:
filters:
tags:
only: /.*/
- deploy:
requires:
- build-php-8.1
- build-php-8.2
- build-php-8.1-legacy
- build-php-8.2-legacy
- build-php-8.2-next
- test-php-8.2
- test-php-8.2-legacy
- test-php-8.2-next
- test-php-8.3
- test-php-8.3-next
filters:
tags:
only: /.*/
Expand Down
3 changes: 3 additions & 0 deletions .devtools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This directory contains scripts used for development.

These can be used locally and in the CI environment.
3 changes: 0 additions & 3 deletions .devtools/README.txt

This file was deleted.

Loading