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

Issue fork drupal-3515704

Command icon 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:

Comments

catch created an issue. See original summary.

mondrake’s picture

catch’s picture

Title: Move unit tests to a 'unit tests' stage » [PP-1] Move unit tests to a 'unit tests' stage
Status: Active » Postponed

Yeah just a job stage. Also we should explicitly postpone this issue on that one.

mstrelan’s picture

Thanks 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.

mondrake’s picture

Somehow 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.

catch’s picture

My 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.

mondrake’s picture

Title: [PP-1] Move unit tests to a 'unit tests' stage » Move unit tests to a 'unit tests' stage
Status: Postponed » Active

Blocker went in.

mondrake’s picture

Here'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.

andypost’s picture

After last mess with parent child access in Gitlab I find it bad idea to bet on getting artifacts/results from child pipeline

bbrala’s picture

Agree with Andy. Might even advocate stop using child pipelines all together.

mondrake’s picture

Status: Active » Needs review

The 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.

bbrala’s picture

Not 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.

bbrala’s picture

Status: Needs review » Needs work
mondrake’s picture

Status: Needs work » Postponed
Related issues: +#3521541: [CI] Components tests coverage metrics differ by PHP version

Let’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.

bbrala’s picture

For the record. I'd pick:

"Unit tests: Core (PHP 8.3)"
"Unit tests: Components (PHP 8.3)"

mondrake’s picture

Title: Move unit tests to a 'unit tests' stage » [CI] Move unit tests to a 'unit tests' stage
mondrake’s picture

Issue tags: +PHPUnit 11
mondrake’s picture

Status: Postponed » Needs review

The 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
  • Unit tests
  • Tests (i.e. Build+Kernel+Functional that all require a db)

'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.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.08 KB

The 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.

mondrake’s picture

Status: Needs work » Needs review
Issue tags: +no-needs-review-bot
smustgrave’s picture

Status: Needs review » Postponed

Change 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.

mondrake’s picture

Issue tags: -no-needs-review-bot
mondrake’s picture

Status: Postponed » Active
mondrake’s picture

Assigned: Unassigned » mondrake
Status: Active » Needs work

On this.

mondrake’s picture

Assigned: mondrake » Unassigned
Status: Needs work » Needs review

Ready.

andypost’s picture

In 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

catch’s picture

This looks a lot nicer in the gitlab UI IMO.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Going 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.

  • longwave committed 0107582d on 11.3.x
    ci: #3515704 [CI] Move unit tests to a unit
    
    (cherry picked from commit...

  • longwave committed a4087df7 on 11.x
    ci: #3515704 [CI] Move unit tests to a unit
    
longwave’s picture

Status: Reviewed & tested by the community » Fixed

Agree 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!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

longwave’s picture

Ugh, commit message went wrong with the quotes, reverting and recommitting.

  • longwave committed c706b9ab on 11.3.x
    ci: #3515704 [CI] Move unit tests to a 'unit tests' stage
    
    By: catch
    By...

  • longwave committed 69e4f684 on 11.3.x
    Revert "ci: #3515704 [CI] Move unit tests to a unit"
    
    This reverts...

  • longwave committed 1eeb90df on 11.x
    ci: #3515704 [CI] Move unit tests to a 'unit tests' stage
    
    By: catch
    By...

  • longwave committed 2c1d1cbb on 11.x
    Revert "ci: #3515704 [CI] Move unit tests to a unit"
    
    This reverts...

  • alexpott committed fd6dd469 on 11.3.x
    Revert "ci: #3515704 [CI] Move unit tests to a 'unit tests' stage"
    
    This...

  • alexpott committed 88c04072 on 11.x
    Revert "ci: #3515704 [CI] Move unit tests to a 'unit tests' stage"
    
    This...

  • alexpott committed f8809517 on 11.3.x
    Reapply "ci: #3515704 [CI] Move unit tests to a 'unit tests' stage"...

  • alexpott committed fa0eeea2 on 11.x
    Reapply "ci: #3515704 [CI] Move unit tests to a 'unit tests' stage"...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.