Problem/Motivation
The Drupal core test suite takes ~60 minutes to test Drupal 10.
This:
- slows down and hence discourages contributions
- costs a lot to the Drupal Association
We did this a lot while working to get the CKEditor 5 module stable. It saved countless hours, allowed for faster iterations and saved many DA dollars. It required applying this patch:
diff --git a/core/drupalci.yml b/core/drupalci.yml
index 94aa2ad22f..6b4e9a767b 100644
--- a/core/drupalci.yml
+++ b/core/drupalci.yml
@@ -15,30 +15,30 @@ build:
# deprecated code.
run_tests.phpunit:
types: 'PHPUnit-Unit'
- testgroups: '--all'
+ testgroups: '--module ckeditor5'
suppress-deprecations: false
halt-on-fail: false
run_tests.kernel:
types: 'PHPUnit-Kernel'
- testgroups: '--all'
+ testgroups: '--module ckeditor5'
suppress-deprecations: false
halt-on-fail: false
run_tests.build:
# Limit concurrency due to disk space concerns.
concurrency: 15
types: 'PHPUnit-Build'
- testgroups: '--all'
+ testgroups: '--module ckeditor5'
suppress-deprecations: false
halt-on-fail: false
run_tests.functional:
types: 'PHPUnit-Functional'
- testgroups: '--all'
+ testgroups: '--module ckeditor5'
suppress-deprecations: false
halt-on-fail: false
run_tests.javascript:
concurrency: 15
types: 'PHPUnit-FunctionalJavascript'
- testgroups: '--all'
+ testgroups: '--module ckeditor5'
suppress-deprecations: false
halt-on-fail: false
# Run nightwatch testing.
diff --git a/core/package.json b/core/package.json
index c14f58a08c..cc55f438eb 100644
--- a/core/package.json
+++ b/core/package.json
@@ -18,7 +18,7 @@
"lint:css": "stylelint \"**/*.css\"",
"lint:css-checkstyle": "stylelint \"**/*.css\" --custom-formatter ./node_modules/stylelint-checkstyle-formatter/index.js",
"lint:yaml": "node ./node_modules/eslint/bin/eslint.js --ext .yml .",
- "test:nightwatch": "node -r dotenv-safe/config ./node_modules/.bin/nightwatch --config ./tests/Drupal/Nightwatch/nightwatch.conf.js",
+ "test:nightwatch": "node -r dotenv-safe/config ./node_modules/.bin/nightwatch --config ./tests/Drupal/Nightwatch/nightwatch.conf.js --tag ckeditor5",
"prettier": "prettier --write \"./**/*.js\"",
"spellcheck": "cspell",
"spellcheck:make-drupal-dict": "rm -f misc/cspell/dictionary.txt && touch misc/cspell/dictionary.txt && yarn -s spellcheck:core --unique --wordsOnly | tr '[:upper:]' '[:lower:]' | tr -d \\\\\\\\ | LC_ALL=C sort -u -o misc/cspell/dictionary.txt",
But it's not reasonable to expect all Drupal core contributors to figure this out.
Steps to reproduce
Post a patch or an MR.
Proposed resolution
Many (most?) changes to Drupal core actually apply only to a single module.
So … why not make it as simple as possible to run only the tests for a particular Drupal core module? Yes, soonish we'll transition from Drupal CI to GitLab CI. But even before then, there's a very low-cost, low-effort way to make it easie. What if you'd only have to change this in core/drupalci.yml:
_phpunit_testgroups_to_execute: &testgroups
# Default: all of Drupal core's test suite runs.
testgroups: '--all'
# Alternative: run only the tests for one particular module.
# testgroups: '--module ckeditor5'
to this:
_phpunit_testgroups_to_execute: &testgroups
# Default: all of Drupal core's test suite runs.
#testgroups: '--all'
# Alternative: run only the tests for one particular module.
testgroups: '--module ckeditor5'
(comment one line, uncomment another)
Note: this will not eliminate all nightwatch tests from running (because that does not use PHPUnit and requires tweaking core/package.json), which takes ~6.5 minutes, but tweaking that can be a follow-up improvement. This alone cuts ~66% off the test run time.
This alone would cut makes a huge difference.
Remaining tasks
Review
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 3313833-11.patch | 1.76 KB | wim leers |
| #11 | interdiff.txt | 586 bytes | wim leers |
| #3 | what_core_contributors_would_do.txt | 628 bytes | wim leers |
| #3 | 3313833-2-comment_one_line_uncomment_another_to_only_run_cke5_tests.patch | 1.87 KB | wim leers |
| #2 | 3313833-2.patch | 1.87 KB | wim leers |
Comments
Comment #2
wim leersComment #3
wim leersComment #4
wim leersVoila: #3 took exactly 20 minutes, or exactly 33% of the usual build duration! #2 is still going…
Comment #5
alexpott+1 this is a good idea. It's not a feature though :)
Comment #6
alexpottShould be the Yaml anchor link
Comment #7
mstrelan commentedI suspect we'll see an even greater time reduction for modules that are not so js heavy, perhaps down to 15 minutes, or 10 if we can skip nightwatch tests too!
Comment #8
tedbowGreat addition!
re #6 didn't know about "Yaml anchor link", that makes this much easier to use!
Comment #9
tedbowComment #10
longwaveNW for #6, build tests are currently hardcoded to CKEditor 5 only.
Should we consider putting these in the shared group as well? I guess if you want to change one setting, you usually want to change them for all groups?
Comment #11
wim leers#6: HAH! I forgot to update that one clearly 😄
#10: that's a bikeshed discussion I don't want to bother with at this time 😇
Comment #12
longwaveOK, let's just make this part easier for now :)
Comment #13
alexpottCommitted and pushed 13c1ec1085 to 10.1.x and 79cbf8a2d2 to 10.0.x and 71fd615e28 to 9.5.x and 3a05ba49aa to 9.4.x. Thanks!
Backported to 9.4.x because there is no reason not to.