Problem/Motivation
We moved unit tests to the 'lint' stage to allow immediate testing on multiple PHP versions without having to run the entire pipeline.
However someone in slack (can't remember who, it was a couple of weeks ago) suggested moving them to their own stage, this would help for two reasons:
1. We can set that stage to not block the other tests, this would allow functional/kernel tests to run even if unit tests fail and if/when unit tests are slower than the lint steps the overall pipeline would finish quicker.
2. The stage name would be more accurate.
3. It might look nicer in the gitlab UI, we'll find out.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|
Issue fork drupal-3515704
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3515704-move-unit-tests
changes, plain diff MR !12025
Comments
Comment #2
mondrakeRelated, #3485069: [CI] Spin off Drupal Components tests in a job of their own, add test coverage metrics.
We are talking about a job stage, not a child pipeline here, right?
Comment #3
catchYeah just a job stage. Also we should explicitly postpone this issue on that one.
Comment #4
mstrelan commentedThanks for opening this, I was the one who suggested this in Slack. I had a bit of a tinker but I couldn't figure out the relationship between the child pipeline and the initial stage(s). Will be following this issue.
Comment #5
mondrakeSomehow though, this will reopen the discussion from #3484966-6: Allow executing unit tests on multiple PHP images without having to duplicate unit tests across all environment combinations because then the tests results will be split in two places - the 'main' pipeline for unit tests and the children pipelines for kernel/functional/etc.
https://gitlab.com/gitlab-org/gitlab/-/issues/363019 is the upstream issue to keep watching - still no timeline there.
Comment #6
catchMy idea here was a separate stage without a child pipeline.
However I think what @mstrelan is referring to is that the child pipeline depends on the entire parent pipeline, not a stage, so yeah it's (inadvertently) re-opening that discussion because I forgot this is hard to do.
Comment #7
mondrakeBlocker went in.
Comment #8
mondrakeHere's another GitLab upstream issue to watch for child/parent pipeline relationship https://gitlab.com/groups/gitlab-org/-/epics/4019, looks like it's actively pursued.
Comment #9
andypostAfter last mess with parent child access in Gitlab I find it bad idea to bet on getting artifacts/results from child pipeline
Comment #11
bbralaAgree with Andy. Might even advocate stop using child pipelines all together.
Comment #12
mondrakeThe MR is now splitting the unit tests in a stage of its own - still the new stage's jobs are set to start without waiting for the 'Lint' stage to end.
Comment #13
bbralaNot sure why we would remove "Unit tests" from the title here, i understand it's now in a "Unit test" stage. But lets consider;
- Running locally would mean running "Core on PHP 8.3"
- If tests fail "Core on PHP 8.3" is the title of the job.
- All other jobs are things like "PHPUnit Functional"
I'd probably opt to call them something like:
"Core Unit tests on PHP 8.3"
"Component Unit tests on PHP 8.3"
Or maybe:
"PHPUnit Unit Core (PHP 8.3)"
"PHPUnit Unit Components (PHP 8.3)"
"Unit tests: Core (PHP 8.3)"
"Unit tests: Components (PHP 8.3)"
Know this is pretty nitpicky, but we are gonna look at those a lot :)
Edit:
Other than the naming i think these changes are all good.
Comment #14
bbralaComment #15
mondrakeLet’s have opinions on the best naming from #13 before making changes.
Meanwhile, better wait for #3521541: [CI] Components tests coverage metrics differ by PHP version to get in.
Comment #16
bbralaFor the record. I'd pick:
"Unit tests: Core (PHP 8.3)"
"Unit tests: Components (PHP 8.3)"
Comment #17
mondrakeComment #18
mondrakeComment #19
mondrakeThe MR is built on top of #3521541: [CI] Components tests coverage metrics differ by PHP version, but it's reviewable per se.
It splits the pipeline in three stages
'Lint' and 'Unit tests' starts independently from each other, while 'Tests' starts when both the former ones have completed.
'Unit tests' use a parallel matrix to run multiple PHP versions, instead of individual jobs.
Comment #20
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #21
mondrakeComment #22
smustgrave commentedChange looks great! Love that it's own thing and not mixed in with phpcs/phpstan stuff. Postponing on #3521541: [CI] Components tests coverage metrics differ by PHP version but can probably immediately RTBC after that lands.
Comment #23
mondrakeComment #24
mondrakeComment #25
mondrakeOn this.
Comment #26
mondrakeReady.
Comment #27
andypostIn just released Gitlab 18.6 https://docs.gitlab.com/ci/yaml/matrix_expressions/
I bet in a month or 2 it will be available for d-o or even GA
Comment #28
catchThis looks a lot nicer in the gitlab UI IMO.
Comment #29
smustgrave commentedGoing to go on a limb but I like this! Was never a fan of mixing the tests with phpcs/phpstan stuff.
Random unrelated to this but in the test stage is it possible to get the test group that has ran to appear at the top of the list vs bottom? Or even alphabetically so it would be grouped with the DEFAULT: Test-only and DEFAULT: Updated dependencies.
Comment #32
longwaveAgree this makes the UI much nicer. I am not sure we have any control over the ordering of the UI items like that unfortunately - probably needs an upstream issue.
Committed and pushed a4087df7327 to 11.x and 0107582db69 to 11.3.x. Thanks!
Comment #35
longwaveUgh, commit message went wrong with the quotes, reverting and recommitting.