-
Notifications
You must be signed in to change notification settings - Fork 12
Add DDEV Configuration #32
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
Open
bhanu951
wants to merge
7
commits into
joachim-n:main
Choose a base branch
from
bhanu951:feature/make-ddev-compatible
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
12db549
Make DDEV Compatible.
bhanu951 50349eb
DDEV Config updated.
bhanu951 5e4b846
Delete .ddev/commands/web/README.txt
bhanu951 157c444
Update .vscode/launch.json
bhanu951 4a9de55
Delete .ddev/docker-compose.override.yaml
bhanu951 baf799b
Update README.
bhanu951 36b6807
Updated DDEV Configuration.
bhanu951 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## Description: This script performs cspell checks. | ||
| ## Usage: cspell-check [flags] | ||
| ## Example: "ddev cspell-check" | ||
|
|
||
| # Installs dependencies if not already run. | ||
| if [ ! -d /var/www/html/repos/drupal/core/node_modules/.bin ]; then | ||
|
|
||
| corepack enable | ||
|
|
||
| yarn --cwd /var/www/html/repos/drupal/core install | ||
| fi | ||
|
|
||
| TOP_LEVEL="/var/www/html/repos/drupal/core" | ||
| cd $TOP_LEVEL | ||
|
|
||
| yarn run spellcheck:core --no-must-find-files --cache --cache-strategy content |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## Description: Performs a default drupal installation | ||
| ## Usage: install | ||
| ## Example: "ddev install" | ||
|
|
||
| drush site:install standard --account-name=admin --account-pass=admin --site-name="Drupal 11" -y | ||
| # drush en admin_toolbar admin_toolbar_tools devel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## Description: Run Nightwatch | ||
| ## Usage: nightwatch [flags] [args] | ||
| ## Example: "ddev nightwatch" or "ddev nightwatch --tag core" | ||
|
|
||
| # Installs dependencies if not already run. | ||
| if [ ! -d /var/www/html/repos/drupal/core/node_modules ]; then | ||
| yarn --cwd /var/www/html/repos/drupal/core install | ||
| fi | ||
|
|
||
| yarn --cwd /var/www/html/repos/drupal/core test:nightwatch $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## Description: Run phpcbf | ||
| ## Usage: phpcbf [flags] [args] | ||
| ## Example: "ddev phpcbf web/modules/contrib" | ||
|
|
||
| TOP_LEVEL="/var/www/html/repos/drupal" | ||
| cd $TOP_LEVEL | ||
|
|
||
| /var/www/html/vendor/bin/phpcbf --standard=Drupal,DrupalPractice $@ || \ | ||
| echo "Return code ignored" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## Description: Run phpcs | ||
| ## Usage: phpcs [flags] [args] | ||
| ## Example: "ddev phpcs web/modules/contrib" | ||
|
|
||
| TOP_LEVEL="/var/www/html/repos/drupal" | ||
| cd $TOP_LEVEL | ||
|
|
||
| /var/www/html/vendor/bin/phpcs --standard=Drupal,DrupalPractice $@ || \ | ||
| echo "Return code ignored" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## Description: Run phpstan | ||
| ## Usage: phpstan [flags] [args] | ||
| ## Example: "ddev phpstan core/modules/migrate_drupal_ui" | ||
|
|
||
| TOP_LEVEL="/var/www/html/repos/drupal" | ||
| cd $TOP_LEVEL | ||
|
|
||
| /var/www/html/vendor/bin/phpstan analyze --configuration="$TOP_LEVEL/core/phpstan.neon.dist" --xdebug --no-ansi --memory-limit=2G $@ || \ | ||
| echo "Return code ignored" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## Description: Run PHPUnit | ||
| ## Usage: phpunit [flags] [args] | ||
| ## Example: "ddev phpunit --group big_pipe" or "ddev phpunit web/core/modules/action" | ||
|
|
||
| TOP_LEVEL="/var/www/html/repos/drupal" | ||
| cd $TOP_LEVEL | ||
|
|
||
| /var/www/html/vendor/bin/phpunit -c /var/www/html/web/core/phpunit.xml.dist $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/bin/bash | ||
|
|
||
| ## Description: Clean up test results | ||
| ## Usage: tests-cleanup | ||
| ## Example: "ddev tests-cleanup" | ||
|
|
||
| TOP_LEVEL="/var/www/html" | ||
| cd $TOP_LEVEL | ||
|
|
||
| if [ ! -d "web/sites/simpletest/browser_output" ] | ||
| then | ||
| echo "The expected folder web/sites/simpletest/browser_output does not exist." | ||
| exit | ||
| fi | ||
|
|
||
| rm web/sites/simpletest/browser_output/*.counter | ||
| rm web/sites/simpletest/browser_output/*.html | ||
|
|
||
| echo "Test files removed." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| type: drupal | ||
| docroot: web | ||
| php_version: "8.3" | ||
| webserver_type: nginx-fpm | ||
| xdebug_enabled: false | ||
| additional_hostnames: | ||
| - drupal-core-testing | ||
| additional_fqdns: [] | ||
| database: | ||
| type: mariadb | ||
| version: "10.11" | ||
| hooks: | ||
| post-start: | ||
| - exec: mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS phpunit; GRANT ALL ON phpunit.* to 'db'@'%';" | ||
| service: db | ||
| project_tld: local | ||
| use_dns_when_possible: true | ||
| composer_version: "2" | ||
| web_environment: | ||
| - BROWSERTEST_OUTPUT_DIRECTORY=/var/www/html/web/sites/simpletest/browser_output | ||
| - BROWSERTEST_OUTPUT_BASE_URL=https://drupal-core-testing.local | ||
| - SIMPLETEST_BASE_URL=${DDEV_PRIMARY_URL} | ||
| - SIMPLETEST_DB=mysql://root:root@db/phpunit | ||
| corepack_enable: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| repos/.DS_Store | ||
| repos/drupal/ | ||
| vendor/ | ||
| .ddev/ | ||
| .DS_Store | ||
| databases | ||
| composer.lock | ||
| web/core | ||
| web/.csslintrc | ||
| web/.eslintignore | ||
| web/.eslintrc.json | ||
| web/.ht.router.php | ||
| web/.htaccess | ||
| web/INSTALL.txt | ||
| web/README.md | ||
| web/autoload.php | ||
| web/example.gitignore | ||
| web/index.php | ||
| web/modules/README.txt | ||
| web/profiles/README.txt | ||
| web/robots.txt | ||
| web/sites/README.txt | ||
| web/sites/development.services.yml | ||
| web/sites/example.settings.local.php | ||
| web/sites/example.sites.php | ||
| web/themes/README.txt | ||
| web/update.php | ||
| web/sites/ | ||
| web/modules/contrib/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "name": "Listen for Xdebug", | ||
| "type": "php", | ||
| "request": "launch", | ||
| "hostname": "0.0.0.0", | ||
| "port": 9003, | ||
| "pathMappings": { | ||
| "/var/www/html": "${workspaceRoot}", | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,8 +27,8 @@ https://www.drupal.org/project/drupal/issues/1792310. | |
|
|
||
| To install a Drupal project for working on Drupal core: | ||
|
|
||
| ``` | ||
| $ composer create-project joachim-n/drupal-core-development-project | ||
| ```bash | ||
| composer create-project joachim-n/drupal-core-development-project | ||
| ``` | ||
|
|
||
| Composer will clone Drupal core into a 'repos/drupal' directory within the | ||
|
|
@@ -47,12 +47,12 @@ either with `drush si` or with the web UI. | |
| First, make sure your DDEV version is at least 1.23.0. Next, create a new folder | ||
| for your project and `cd` into it. Then: | ||
|
|
||
| ``` | ||
| $ ddev config --project-type=drupal --php-version=8.3 | ||
| $ ddev start | ||
| $ ddev composer create joachim-n/drupal-core-development-project | ||
| $ ddev config --update | ||
| $ ddev restart | ||
| ``` bash | ||
| ddev config --project-type=drupal --php-version=8.3 | ||
| ddev start | ||
| ddev composer create joachim-n/drupal-core-development-project | ||
| ddev config --update | ||
| ddev restart | ||
| ``` | ||
|
|
||
| ### Installation on DDEV with the justafish/ddev-drupal-core-dev DDEV addon | ||
|
|
@@ -155,17 +155,17 @@ The following are required to run tests. | |
| The simplest way to run tests with this setup is to put the phpunit.xml file in | ||
| the project root and then run tests from there: | ||
|
|
||
| ``` | ||
| $ vendor/bin/phpunit web/core/PATH-TO-TEST-FILE/TestFile.php | ||
| ``` bash | ||
| vendor/bin/phpunit web/core/PATH-TO-TEST-FILE/TestFile.php | ||
| ``` | ||
|
|
||
| ##### On DDEV | ||
|
|
||
| 1. Copy the `phpunit-ddev.xml` file that this template provides and rename it to | ||
| `phpunit.xml`: | ||
|
|
||
| ``` | ||
| $ cp phpunit-ddev.xml phpunit.xml | ||
| ``` bash | ||
| cp phpunit-ddev.xml phpunit.xml | ||
| ``` | ||
|
|
||
| 2. Change the BROWSERTEST_OUTPUT_BASE_URL value to the host URL of the project. | ||
|
|
@@ -175,8 +175,8 @@ $ cp phpunit-ddev.xml phpunit.xml | |
| 1. Copy Drupal core's sample `phpunit.xml.dist`` file to the project root and | ||
| rename it to `phpunit.xml`: | ||
|
|
||
| ``` | ||
| $ cp web/core/phpunit.xml.dist phpunit.xml | ||
| ``` bash | ||
| cp web/core/phpunit.xml.dist phpunit.xml | ||
| ``` | ||
|
|
||
| 2. Change the `bootstrap` attribute so the path is correct: | ||
|
|
@@ -192,7 +192,7 @@ that it recognises the process being run from the project root. | |
|
|
||
| For example, in VSCode, this is done as follows in the debugger configuration: | ||
|
|
||
| ``` | ||
| ``` json | ||
| "pathMappings": { | ||
| // Make this work with the root project. | ||
| "/ABSOLUTE/PATH/TO/PROJECT/repos/drupal": "${workspaceRoot}" | ||
|
|
@@ -227,28 +227,28 @@ Composer script. | |
|
|
||
| Clone the repository for this template into, say, 'drupal-dev'. | ||
|
|
||
| ``` | ||
| $ cd drupal-dev | ||
| ``` bash | ||
| cd drupal-dev | ||
|
|
||
| # Create a folder in which to store git clones, which Composer will symlink in. | ||
| $ mkdir repos | ||
| $ cd repos | ||
| mkdir repos | ||
| cd repos | ||
|
|
||
| # Clone Drupal core, to whatever branch you like. | ||
| $ git clone --branch 9.2.x https://git.drupalcode.org/project/drupal.git | ||
| git clone --branch 11.x https://git.drupalcode.org/project/drupal.git | ||
|
|
||
| # Go back to the project root. | ||
| $ cd .. | ||
| cd .. | ||
|
|
||
| # Install packages with Composer. | ||
| $ composer install | ||
| composer install | ||
| ``` | ||
|
|
||
| The Drupal core git clone will be clean apart from: | ||
|
|
||
| ``` | ||
| sites/default/settings.php | ||
| vendor | ||
| ``` bash | ||
| sites/default/settings.php | ||
| vendor | ||
| ``` | ||
|
|
||
| Since it doesn't have a .gitignore at the top level, you can add one to ignore | ||
|
|
@@ -261,8 +261,8 @@ clone of the template repository. | |
|
|
||
| In a separate location, do: | ||
|
|
||
| ``` | ||
| $ composer create-project joachim-n/drupal-core-development-project NEW_PROJECT_DIRECTORY --stability=dev --repository='{"url":"/path/to/git/clone/of/project/template/","type":"vcs"}' | ||
| ``` bash | ||
| composer create-project joachim-n/drupal-core-development-project NEW_PROJECT_DIRECTORY --stability=dev --repository='{"url":"/path/to/git/clone/of/project/template/","type":"vcs"}' | ||
| ``` | ||
|
|
||
| ### Workarounds | ||
|
|
@@ -282,7 +282,7 @@ otherwise code in core that expects to find a Composer autoloader fails. | |
| This is done by a Composer script after initial installation. The manual command | ||
| is: | ||
|
|
||
| ``` | ||
| ``` bash | ||
| ln -s ../../vendor ./repos/drupal/vendor | ||
| ``` | ||
|
|
||
|
|
@@ -296,7 +296,7 @@ can't find the settings.php file. | |
| This is done by a Composer script after initial installation. The manual | ||
| commands are: | ||
|
|
||
| ``` | ||
| ``` bash | ||
| cd web && patch -p1 <../scaffold/scaffold-patch-index-php.patch | ||
| cd web && patch -p1 <../scaffold/scaffold-patch-update-php.patch | ||
| ``` | ||
|
|
@@ -329,7 +329,7 @@ root and symlink it into the Drupal core git clone. | |
| This is done by a Composer script after initial installation. The manual command | ||
| is: | ||
|
|
||
| ``` | ||
| ``` bash | ||
| mkdir -p web/sites/simpletest | ||
| ln -s ../../../web/sites/simpletest repos/drupal/sites | ||
| ``` | ||
|
|
@@ -339,3 +339,45 @@ ln -s ../../../web/sites/simpletest repos/drupal/sites | |
| Drupal's /composer folder is not symlinked and therefore isn't visible to | ||
| Composer. It's needed for some tests, and so is declared as an autoload | ||
| location. | ||
|
|
||
| ## Core Development Using DDEV | ||
|
|
||
| 1. Clone this repository by using `git clone --branch=master https://github.com/bhanu951/drupal-core-development-project.git` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line needs update based upon this PR. |
||
| 2. cd repos | ||
| 3. git clone --branch=11.x https://git.drupalcode.org/project/drupal.git drupal | ||
| 4. ddev get drud/ddev-selenium-standalone-chrome (downloads latest chrome driver) | ||
| 5. ddev composer install (from project root) | ||
| 6. ddev composer require drupal/admin_toolbar drupal/devel | ||
| 7. cd repos/drupal ; `git status` to track core changes | ||
|
|
||
| ### DDEV Commands Usage | ||
|
|
||
| 1. ddev phpcs core/modules/user/src/RegisterForm.php (from repos/drupal directory) | ||
| 2. ddev phpcbf core/modules/user/src/RegisterForm.php (from repos/drupal directory) | ||
| 3. ddev phpunit core/modules/user/tests/src/Functional/UserAdminTest.php (from repos/drupal directory) | ||
| 4. ddev code-check (ddev equivalent of running `sh core/scripts/dev/commit-code-check.sh`) | ||
| 5. ddev cspell-check (Checks for forbidden and new words which are not present in dictonary) | ||
| 6. ddev install (Installs new site) | ||
| 7. ddev drush [arguments] (from project root) | ||
|
|
||
| ### TODO | ||
|
|
||
| 1. Add DDEV Rector Commands | ||
| 2. Find workaround for ddev phpstan command failures | ||
|
|
||
| ### Tips | ||
|
|
||
| 1. ddev drush si --site-name=drupal-145353 | ||
|
|
||
| ### Known Issues | ||
|
|
||
| There is a known issue where PHPSTAN doesnt work when the | ||
| `ComponentTestDoesNotExtendCoreTest` is enabled in `core/phpstan.neon.dist` | ||
| hence it advised to comment the rule for local analysis. | ||
|
|
||
| ```yaml | ||
| rules: | ||
| # - Drupal\PHPStan\Rules\ComponentTestDoesNotExtendCoreTest | ||
| - PHPStan\Rules\Functions\MissingFunctionReturnTypehintRule | ||
| - PHPStan\Rules\Methods\MissingMethodReturnTypehintRule | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this here means you'll have trouble running more than one project at a time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but it makes easier to access phpunit tests output htmls.