[PP-1][CI] Spin off Drupal Components tests in a job of their own

Created on 1 November 2024, 6 months ago

Problem/Motivation

Follow-up of ๐Ÿ“Œ [CI] Introduce a separate stage for unit tests Active .

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

๐Ÿ“Œ Task
Status

Postponed

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 !10027Closes #3485069 โ†’ (Closed) created by mondrake
  • Pipeline finished with Canceled
    6 months ago
    Total: 446s
    #326752
  • Pipeline finished with Failed
    6 months ago
    Total: 495s
    #326756
  • Pipeline finished with Failed
    5 months ago
    Total: 670s
    #346186
  • Pipeline finished with Failed
    5 months ago
    Total: 616s
    #346206
  • Pipeline finished with Failed
    5 months ago
    Total: 803s
    #346277
  • Pipeline finished with Failed
    5 months ago
    Total: 1098s
    #346303
  • Pipeline finished with Failed
    5 months ago
    Total: 682s
    #346318
  • Status changed to Active about 2 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น
  • Pipeline finished with Failed
    about 2 months ago
    Total: 768s
    #445016
  • Pipeline finished with Failed
    about 2 months ago
    Total: 553s
    #445026
  • Pipeline finished with Success
    about 2 months ago
    Total: 702s
    #445036
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น
  • Pipeline finished with Success
    about 2 months ago
    Total: 405s
    #445860
  • Pipeline finished with Failed
    about 2 months ago
    Total: 1121s
    #446357
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Unit tests are falling under linting stage now though?

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

    #5 yes, but not introduced here. See ๐Ÿ“Œ [CI] Introduce a separate stage for unit tests Active .

  • Pipeline finished with Canceled
    about 1 month ago
    Total: 113s
    #447807
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Going to go on a limb and say letโ€™s try it

  • Pipeline finished with Success
    about 1 month ago
    Total: 11032s
    #447809
  • ๐Ÿ‡ช๐Ÿ‡ธSpain penyaskito Seville ๐Ÿ’ƒ, Spain ๐Ÿ‡ช๐Ÿ‡ธ, UTC+2 ๐Ÿ‡ช๐Ÿ‡บ

    Should we have a report on coverage with the artifacts generated, aside of the output?

  • Pipeline finished with Success
    about 1 month ago
    Total: 505s
    #447953
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

    #8 I tried to configure coverage reporting, but it does not seem to produce any effect?

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    Looks like this is still in progress.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 539s
    #448674
  • Pipeline finished with Success
    about 1 month ago
    Total: 366s
    #448688
  • Pipeline finished with Failed
    about 1 month ago
    Total: 471s
    #448699
  • Pipeline finished with Failed
    about 1 month ago
    #448708
  • Pipeline finished with Failed
    about 1 month ago
    #448709
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 455s
    #448904
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น
  • Pipeline finished with Failed
    about 1 month ago
    Total: 127s
    #448910
  • Pipeline finished with Failed
    about 1 month ago
    Total: 457s
    #448913
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

    With regards to #8, we already have had coverage visualization configured in the MR.
    This is producing inline display of the covered line in the merge request diffs. It's not visible in this MR as it does include changes to components code, but an example is here: ๐Ÿ“Œ Introduce a @return-type-will-be-added annotation to indicate return type addition in next major; enforce with a PHPStan rule Active : in the MR visualization of changes https://git.drupalcode.org/project/drupal/-/merge_requests/10111/diffs#7... you can see that the covered code has a green sideline close to the line numbers.

    When it comes to summary metrics, IMHO the standard GitLab solution with adding a coverage key to the job yaml is insufficient, for the following reasons:

    1. trivial but annoying: it is not compatible with color output by PHPUnit's coverage text reporting. If you set --colors=always to PHPUnit CLI command, the coverage text report includes ANSI color codes that the regex in coverage cannot cope with.
    2. more importantly: the standard approach is limited to reporting line coverage only and averages results from different jobs - this would lead to meaningless figures if we were later to, say, have code coverage for core too as it will make simple average without any weighting etc.

    So I will try to take cue from the work in ๐Ÿ“Œ [CI] Report PHPStan baseline statistics in job Active , and see if with some postprocessing of the coverage text report, we can get a metrics report that can be more tuned to Drupal.

  • Pipeline finished with Failed
    about 1 month ago
    #448984
  • Pipeline finished with Failed
    about 1 month ago
    #448985
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 379s
    #448986
  • Pipeline finished with Canceled
    about 1 month ago
    Total: 299s
    #449061
  • Pipeline finished with Success
    about 1 month ago
    Total: 490s
    #449065
  • Pipeline finished with Success
    about 1 month ago
    Total: 578s
    #449096
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

    Added a small script that processes PHPUnit's coverage text report into an OpenMetrics file with the relevant metrics included.

    See file attached with a screenshot of the resulting report in the MR.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

    Added a small script that processes PHPUnit's coverage text report into an OpenMetrics file with the relevant metrics included.

    See file attached with a screenshot of the resulting report in the MR.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Are the metrics suppose to be clickable?

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Guess it's still neat to have that info though it would be cool to know what classes aren't being covered. Maybe would start a new initiative :)

    But having the info is a net improvement.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

    #17 thatโ€™s just the summary. All the details are visible in the raw logs https://git.drupalcode.org/issue/drupal-3485069/-/jobs/4674359 and as artifacts.

    Obviously a code coverage analisys service (e.g. Codecov or the likes of it) would provide full interactive reporting, trends etc but I suppose itโ€™s well beyond the scope of this issue.

  • Pipeline finished with Success
    25 days ago
    Total: 466s
    #462190
  • Pipeline finished with Failed
    11 days ago
    Total: 332s
    #473820
  • Pipeline finished with Failed
    10 days ago
    Total: 429s
    #474824
  • Pipeline finished with Success
    1 day ago
    #481884
  • Pipeline finished with Failed
    about 6 hours ago
    Total: 238s
    #482453
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    The code coverage report is really nice to have here!

    It looks like even though there's no concurrency, the number of tests here is low enough that the jobs still finish pretty fast.

    However, can you confirm why each job needs 8 CPU when they're only running with single concurrency? I would have thought 1-2 CPU each would be enough.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

    Huh, did not even look at that, was just a copypasta exercise. Let's see with 2.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

    No sensible difference, I think the change is small enough to let me self-RTBC this back.

  • Pipeline finished with Success
    about 4 hours ago
    Total: 514s
    #482515
    • catch โ†’ committed 8c466813 on 11.x
      Issue #3485069 by mondrake, smustgrave, catch: [CI] Spin off Drupal...
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    Yep let's do it. Committed/pushed to 11.x, thanks!

    Would be good to open an issue to look into exporting/importing these into a visual code coverage report that we can link from somewhere on the project page, or something like that.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch
Production build 0.71.5 2024