[CI] Introduce a separate stage for unit tests

Created on 31 October 2024, 3 months ago

Problem/Motivation

After commit of 📌 [CI] Remove the 'with-database' requirement for unit tests Active , we do not need to run Unit tests for each db configuration anymore.

Steps to reproduce

Proposed resolution

A separate stage and child pipeline, accommodating also PHPStan rule unit tests?

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component

phpunit

Created by

🇮🇹Italy mondrake 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mondrake
  • Merge request !10020Closes #3484966 → (Open) created by mondrake
  • Pipeline finished with Failed
    3 months ago
    Total: 605s
    #326229
  • Pipeline finished with Failed
    3 months ago
    Total: 723s
    #326247
  • Pipeline finished with Failed
    3 months ago
    Total: 604s
    #326255
  • Pipeline finished with Failed
    3 months ago
    Total: 480s
    #326280
  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Success
    3 months ago
    Total: 527s
    #326288
  • 🇮🇹Italy mondrake 🇮🇹
  • 🇦🇺Australia mstrelan

    I like this in principle, but worry it will be harder to find the test results summary. Currently you need to go to the child job so see that, now you may need to go to two child jobs. I wonder if there's any way to bubble up the test results to the parent job.

  • Pipeline finished with Failed
    3 months ago
    Total: 650s
    #326324
  • Pipeline finished with Failed
    3 months ago
    Total: 107s
    #326342
  • 🇮🇹Italy mondrake 🇮🇹

    Added parallel:matrix to be able running unit test on multiple PHP versions.

    This is highligthing PHP 8.4 deprecations, for instance.

  • Pipeline finished with Failed
    3 months ago
    Total: 785s
    #326348
  • Pipeline finished with Failed
    3 months ago
    Total: 364s
    #326550
  • Pipeline finished with Failed
    3 months ago
    Total: 490s
    #326560
  • Pipeline finished with Success
    3 months ago
    Total: 2243s
    #326586
  • Pipeline finished with Success
    3 months ago
    Total: 1609s
    #326621
  • 🇮🇹Italy mondrake 🇮🇹

    Latest commit to the MR adds a job to run tests for Drupal components directly in PHPUnit, including code coverage report.

    Probably needs to be spun off to a follow up, just wanted to showcase it.

  • 🇮🇹Italy mondrake 🇮🇹

    Removed #7.

  • Pipeline finished with Success
    3 months ago
    Total: 564s
    #326727
  • 🇬🇧United Kingdom longwave UK

    @mstrelan yeah I kinda agree that finding test results is already quite tricky when you don't know where to look, and this makes it more complicated. There is no way to surface child pipeline results in a parent yet, see https://gitlab.com/gitlab-org/gitlab/-/issues/363019

  • 🇺🇸United States smustgrave

    Question how come phpunit had to be updated in composer?

  • 🇮🇹Italy mondrake 🇮🇹

    That one is the composer.json of the PHPStan rules testing, not core's. That is separate from the rest to allow independent testing from core. Being independent, it's also not bound to core's dependencies and it happens PHPUnit 11 can be used for this without any of the hurdles that core has: 📌 [PP-1] Make PHPStan rule testing use PHPUnit 11 Postponed . Here's is not strictly necessary, but I made that change to 'force' the PHPStan rule testing job to run as that job is based on changes in the PHPStan rules directory.

  • Pipeline finished with Success
    2 months ago
    Total: 1304s
    #335637
  • 🇺🇸United States smustgrave

    Think I see what @mstrelan and @longwave are talking about now. Anyway to get the results https://git.drupalcode.org/issue/drupal-3484966/-/pipelines/335642 to the rest of the tests?

  • 🇮🇹Italy mondrake 🇮🇹

    Not until upstream gets #9 done, I am afraid.

  • 🇺🇸United States smustgrave

    Should this be postponed or is there a larger gain to be add with moving it out?

  • 🇮🇹Italy mondrake 🇮🇹

    The gain I see is to be able to test future versions of PHP through matrix (and potentially PHPUnit, too) on unit tests only, earlier than the rest of the test suite, and highlight deprecations in advance without failing overall testing job.

    For example, PHP 8.4 is going to be delivered the day after tomorrow, and there is not yet a regular job testing with it AFAICS.

  • 🇺🇸United States smustgrave

    That does seem worth it, not 100% I can make the call but maybe @longwave?

    Also the current MR needs a manual rebase.

  • Pipeline finished with Success
    2 months ago
    Total: 547s
    #342561
  • 🇫🇷France andypost

    To have a proper matrix we need to unify image names too

  • 🇺🇸United States smustgrave

    Going to go on a limb here

  • 🇮🇹Italy mondrake 🇮🇹

    Per #17, adjusted after commit of Release ubuntu images for PHP 8.1 and 8.2 Active . Leaving at RTBC.

  • Pipeline finished with Success
    2 months ago
    Total: 525s
    #345690
  • Pipeline finished with Failed
    2 months ago
    Total: 755s
    #345959
  • 🇮🇹Italy mondrake 🇮🇹

    After 📌 upgrade prophecy to 1.20 Active , unit tests pass on PHP 8.4 so it's no longer necessary to let them fail in the job

  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Success
    2 months ago
    Total: 617s
    #346064
  • 🇮🇹Italy mondrake 🇮🇹

    Just found that instead of running all tests on both 8.3 and 8.4, actually the tests get spread across the two.

  • 🇫🇷France andypost

    added suggestion and asked why phpunit-11 is not follow-up?

  • Pipeline finished with Failed
    2 months ago
    Total: 839s
    #346399
  • Pipeline finished with Failed
    2 months ago
    #346452
  • 🇮🇹Italy mondrake 🇮🇹

    --ci-parallel-node-* args in run-tests.sh conflict with gitlab matrix. Since we do not need to break out unit tests in multiple jobs, removed the args.

  • Pipeline finished with Running
    2 months ago
    #346664
  • 🇮🇹Italy mondrake 🇮🇹

    @andyoost re #23 see #11.

  • 🇮🇹Italy mondrake 🇮🇹

    PHPUnit version for PHPStan testing is rather irrelevant, but I removed from the MR to make things more straightforward. Since a change in the PHPStan directory is needed to show how the test job would trigger, I changed a comment in a test class instead.

  • Pipeline finished with Success
    2 months ago
    Total: 917s
    #346760
  • 🇫🇷France andypost

    There's a list of deprecations for PHP 8.5 already https://wiki.php.net/rfc/deprecations_php_8_5

    So it makes sense to catch them in core or via https://github.com/php/php-src/pull/10050

  • 🇮🇹Italy mondrake 🇮🇹

    #27 when there will be a PHP 8,5 docker image available, we can easily add it to the job matrix here, allowing failures. That will help showing deprecations for 8.5 while keeping the entire pipeline green.

  • 🇫🇷France andypost

    The last PHP 8.4 fix been commited, so the only question is should we add a daily or on-commit run via 📌 [PP-2] Add core testing withPHP 8.4 Postponed

  • 🇫🇷France andypost

    I find it ready!

    PHPUnit 11 has own meta issue 🌱 [meta] Support PHPUnit 11 in Drupal 10 Postponed

  • Pipeline finished with Success
    about 2 months ago
    Total: 600s
    #356801
  • Pipeline finished with Success
    about 2 months ago
    Total: 377s
    #357558
  • Pipeline finished with Failed
    29 days ago
    Total: 529s
    #377990
  • Pipeline finished with Failed
    19 days ago
    Total: 541s
    #384116
  • Pipeline finished with Success
    19 days ago
    Total: 986s
    #384877
  • Status changed to Needs work 12 days ago
  • 🇬🇧United Kingdom alexpott 🇪🇺🌍

    It would be great if we can define the matrix in the root .gitlab-ci.yml file - means all the php version stuff is in one place.

  • 🇮🇹Italy mondrake 🇮🇹
Production build 0.71.5 2024