generated from ddev/ddev-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: Allow installing and testing with all database types, including MariaDB #34
Draft
rfay
wants to merge
12
commits into
justafish:main
Choose a base branch
from
rfay:20240502_mariadb_support
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.
Draft
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
96e8fa1
fix: Install drush without affecting git index
rfay 3fac991
Fix merge conflict
rfay 8715755
Add required git user.name etc
rfay cdc627c
@penyaskito suggestions, thanks!
rfay 793c8b2
Remove omit_containers
rfay fbb532e
rerun tests
rfay 40db936
run tests
rfay 29de965
run tests
rfay 195eb35
Improve tests to use drush and check git index
rfay 66a2631
Add config.ddev-drupal-core-dev.yaml from waiting PR
rfay 90eeb91
feat: Allow installing and testing with all database types
rfay a963d3a
Fix broken CRLF line endings
rfay 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
This file contains 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 |
---|---|---|
@@ -1,73 +1,90 @@ | ||
# ddev-core-dev | ||
|
||
This is a DDEV addon for doing Drupal core development. | ||
|
||
We're in #ddev-for-core-dev on [Drupal Slack](https://www.drupal.org/community/contributor-guide/reference-information/talk/tools/slack) (but please try and keep work and feature requests in Issues where it's visible to all 🙏) | ||
|
||
``` | ||
git clone https://git.drupalcode.org/project/drupal.git drupal | ||
cd drupal | ||
ddev config --omit-containers=db --disable-settings-management | ||
ddev start | ||
ddev get justafish/ddev-drupal-core-dev | ||
ddev restart | ||
ddev composer install | ||
|
||
# See included commands | ||
ddev drupal list | ||
|
||
# Install drupal | ||
ddev drupal install | ||
|
||
# Run PHPUnit tests | ||
ddev phpunit core/modules/sdc | ||
|
||
# Run Nightwatch tests (currently only runs on Chrome) | ||
ddev nightwatch --tag core | ||
``` | ||
|
||
## Nightwatch Examples | ||
|
||
You can watch Nightwatch running in real time at https://drupal.ddev.site:7900 | ||
for Chrome and https://drupal.ddev.site:7901 for Firefox. The password is | ||
"secret". YMMV using Firefox as core tests don't currently run on it. | ||
|
||
Only core tests | ||
``` | ||
ddev nightwatch --tag core | ||
``` | ||
|
||
Skip running core tests | ||
``` | ||
ddev nightwatch --skiptags core | ||
``` | ||
|
||
Run a single test | ||
``` | ||
ddev nightwatch tests/Drupal/Nightwatch/Tests/exampleTest.js | ||
``` | ||
|
||
a11y tests for both the admin and default themes | ||
``` | ||
ddev nightwatch --tag a11y | ||
``` | ||
|
||
a11y tests for the admin theme only | ||
``` | ||
ddev nightwatch --tag a11y:admin | ||
``` | ||
|
||
a11y tests for the default theme only | ||
``` | ||
ddev nightwatch --tag a11y:default | ||
``` | ||
|
||
a11y test for a custom theme used as the default theme | ||
``` | ||
ddev nightwatch --tag a11y:default --defaultTheme bartik | ||
``` | ||
|
||
a11y test for a custom admin theme | ||
``` | ||
ddev nightwatch --tag a11y:admin --adminTheme seven | ||
``` | ||
# ddev-core-dev | ||
|
||
This is a DDEV addon for doing Drupal core development. | ||
|
||
We're in #ddev-for-core-dev on [Drupal Slack](https://www.drupal.org/community/contributor-guide/reference-information/talk/tools/slack) (but please try and keep work and feature requests in Issues where it's visible to all 🙏) | ||
|
||
`ddev drush` is fully supported, along with using or testing MariaDB, MySQL, and PostgreSQL databases (and Sqlite3) | ||
|
||
|
||
``` | ||
git clone https://git.drupalcode.org/project/drupal.git drupal | ||
cd drupal | ||
ddev config --project-type=drupal | ||
ddev get justafish/ddev-drupal-core-dev | ||
ddev restart | ||
ddev composer install | ||
ddev config --update | ||
|
||
|
||
# Install drupal | ||
ddev drush si -y --account-pass==admin | ||
|
||
# Run PHPUnit tests | ||
ddev phpunit core/modules/sdc | ||
|
||
# Run Nightwatch tests (currently only runs on Chrome) | ||
ddev nightwatch --tag core | ||
``` | ||
|
||
## Using various database types | ||
|
||
By default, the DDEV default database type is used (MariaDB). | ||
|
||
To use another supported database type, | ||
`ddev delete -Oy` and `ddev config --database=mysql:8.0` or `ddev config --database=postgres:16` for example. | ||
|
||
To use Sqlite, | ||
``` | ||
ddev stop | ||
ddev config --disable-settings-management --omit-containers=db | ||
rm -rf web/sites/default/settings*.php web/sites/default/files | ||
ddev start | ||
ddev drupal install | ||
``` | ||
|
||
## Nightwatch Examples | ||
|
||
You can watch Nightwatch running in real time at https://drupal.ddev.site:7900 | ||
for Chrome and https://drupal.ddev.site:7901 for Firefox. The password is | ||
"secret". YMMV using Firefox as core tests don't currently run on it. | ||
|
||
Only core tests | ||
``` | ||
ddev nightwatch --tag core | ||
``` | ||
|
||
Skip running core tests | ||
``` | ||
ddev nightwatch --skiptags core | ||
``` | ||
|
||
Run a single test | ||
``` | ||
ddev nightwatch tests/Drupal/Nightwatch/Tests/exampleTest.js | ||
``` | ||
|
||
a11y tests for both the admin and default themes | ||
``` | ||
ddev nightwatch --tag a11y | ||
``` | ||
|
||
a11y tests for the admin theme only | ||
``` | ||
ddev nightwatch --tag a11y:admin | ||
``` | ||
|
||
a11y tests for the default theme only | ||
``` | ||
ddev nightwatch --tag a11y:default | ||
``` | ||
|
||
a11y test for a custom theme used as the default theme | ||
``` | ||
ddev nightwatch --tag a11y:default --defaultTheme bartik | ||
``` | ||
|
||
a11y test for a custom admin theme | ||
``` | ||
ddev nightwatch --tag a11y:admin --adminTheme seven | ||
``` |
This file contains 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,31 @@ | ||
# #ddev-generated | ||
# This file is placed by the justafish/ddev-drupal-core-dev addon. | ||
|
||
webimage_extra_packages: ["chromium-driver"] | ||
ddev_version_constraint: '>=v1.23.0' | ||
hooks: | ||
post-start: | ||
- exec: | | ||
dburl='sqlite://localhost/sites/default/files/db.sqlite' | ||
cp .ddev/core-dev/phpunit-chrome.xml core/phpunit.xml | ||
cp .ddev/core-dev/.env core/.env | ||
if ping -c 1 db >/dev/null 2>&1; then | ||
case ${DDEV_DATABASE_FAMILY:-} in | ||
mysql) | ||
# the backslash here is to prevent perl from eating the @ | ||
dburl='mysql://db:db\@db/db' | ||
;; | ||
postgres) | ||
dburl='pgsql://db:db\@db/db' | ||
;; | ||
esac | ||
fi | ||
perl -pi -e "s|SIMPLETEST_DB_VALUE|${dburl}|g" core/phpunit.xml | ||
perl -pi -e "s|DRUPAL_TEST_DB_URL_VALUE|${dburl}|g" core/.env | ||
perl -pi -e "s|DRUPAL_CORE_DDEV_URL|${DDEV_PRIMARY_URL}|g" core/phpunit.xml | ||
|
||
upload_dirs: | ||
# The install technique tries to remove all of sites/default/files | ||
# but with DDEV + mutagen that isn't possible. | ||
# so just redirect the upload_dirs. | ||
- .ddev/tmp |
This file contains 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.
@rfay is it intentional that this is still using the sqlite DB for running PHPUnit tests?
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.
Actually, this was using mariaDB by accident until a recent PR. But IMO it should use mariaDB by default and allow using any supported database. That's actually why I started working on this PR a bit, because I wanted to see "real" performance comparisons on Drupal, comparing DB types. I think it's possible that the use of sqlite3 "for performance reasons" may be obsolete.