GitlabCI support: Add config file and fix PHPUnit tests

Created on 11 December 2023, 12 months ago
Updated 3 August 2024, 4 months ago

add gitlab CI

📌 Task
Status

Closed: outdated

Version

3.0

Component

Code

Created by

🇮🇳India deepakkm

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

Merge Requests

Comments & Activities

  • Issue created by @deepakkm
  • 🇮🇳India prashant.c Dharamshala

    Prashant.c made their first commit to this issue’s fork.

  • Status changed to Needs review 12 months ago
  • 🇮🇳India prashant.c Dharamshala

    Incorporated a .gitlab-ci.yml file into the project's root directory by utilizing the Drupal Association's template.gitlab-ci.yml contents. Continuously learning about it as I progress.

    Thanks

  • Merge request !68Issue #3407845: adopt gitlab ci → (Open) created by zniki.ru
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 11 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    11 months ago
    Total: 371s
    #75422
  • First commit to issue fork.
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 9 months ago
    Waiting for branch to pass
  • Assigned to rahulrasgon
  • Status changed to Needs work 9 months ago
  • 🇮🇳India rahulrasgon

    Working on other warnings/errors.

  • Pipeline finished with Failed
    9 months ago
    Total: 312s
    #113481
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 9 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    9 months ago
    Total: 392s
    #113773
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 9 months ago
    Waiting for branch to pass
  • Issue was unassigned.
  • 🇮🇳India rahulrasgon

    Fixed all issue except eslint and PHPunit.
    I would suggest to create a new issue for eslint warnings. Also, not sure why PHP unit cases are failing.
    Thanks

  • Pipeline finished with Failed
    9 months ago
    Total: 338s
    #113835
  • First commit to issue fork.
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 8 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    8 months ago
    Total: 332s
    #142858
  • Status changed to Needs review 8 months ago
  • 🇩🇪Germany marcoliver Neuss, NRW, Germany

    Fixed one failing functional test by adding another permission so sub-menu-items would show up.

    Not sure how we should deal with the remaining issue. AdminToolbarAdminMenuTest extends ToolbarAdminMenuTest. ToolbarAdminMenuTest (and a bunch of other tests in Core) use drupalGet() and set HTTP headers by sending them as a complete string ("header-name: header-value"), for example here. But drupalGet() expects the headers to be sent with the header name as the key and the value as, well, the value.

    This should probably be addressed as a Core issue, no?

  • 🇮🇳India prashant.c Dharamshala

    @marcoliver

    Thanks for your efforts on this but should not the test failures be taken as a separate issue?

  • Pipeline finished with Failed
    7 months ago
    #156306
  • First commit to issue fork.
  • Pipeline finished with Failed
    7 months ago
    #156307
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 7 months ago
    Waiting for branch to pass
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 7 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    7 months ago
    Total: 337s
    #156310
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 7 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    7 months ago
    Total: 441s
    #156314
  • 🇦🇺Australia darvanen Sydney, Australia

    Some great work in here, thanks very much!

    I'd like to recommend making eslint failures a follow-up issue since they're not required for a module to start using Gitlab CI, as such I've made that change to the template in the hopes that will be accepted.

    I fixed one tiny phpcs issue, not sure why that came up when it passed earlier :shrug:

    Some projects are adopting a more extensible approach to the template which is to only set the yml you need and point back the original for documentation which I would also like to advocate for, like this:

    ################
    # DrupalCI GitLabCI template
    #
    # @see template for documentation https://git.drupalcode.org/project/gitlab_templates/-/blob/main/gitlab-ci/template.gitlab-ci.yml
    ################
    include:
      - project: $_GITLAB_TEMPLATES_REPO
        ref: $_GITLAB_TEMPLATES_REF
        file:
          - "/includes/include.drupalci.main.yml"
          - "/includes/include.drupalci.variables.yml"
          - "/includes/include.drupalci.workflows.yml"
    variables:  
      SKIP_ESLINT: '1'

    I haven't made that change as it seemed too much of a departure from the status quo, but I'd be very happy to do so.

    I've tried to figure out why the test is failing and... well, failed. There are some inconsistent failures which make me think the browser engine isn't keeping up with the test suite (race condition in JS) but there's one consistent test failure on AdminToolbarAdminMenuTest and that extends a core test which passes in the core test suite.

    I think #10 is correct in stating that test failures aren't necessarily a blocker to switching to the new test system, especially when the main branch is failing in the old system anyway.

  • 🇫🇷France fgm Paris, France

    IMHO switching to Gitlab CI should just be a matter of adding and configuring .gitlab-ci.yml : fixing the tests could very well be done in followups, taking advantage of Gitlab, especially considering they didn't pass before either. Conflating the CI change with bug fixes is the reason why this has been waiting for 4 months.

    This could unblock the D11 issue, and make it possibly easier to work on the various test issues.

  • 🇦🇺Australia darvanen Sydney, Australia

    Here's the cause of one failure: 📌 When using drupalGet(), provide an associative array for $headers Fixed

  • Pipeline finished with Failed
    6 months ago
    Total: 397s
    #179696
  • Status changed to Needs work 6 months ago
  • 🇫🇷France dydave

    Thanks a lot everyone for all the work on this issue.

    One thing though: Why would ESLint be disabled?

    I've taken a quick look at the issues raised by the ESLint job:
    https://git.drupalcode.org/issue/admin_toolbar-3407845/-/jobs/1291671
    They don't look very difficult to fix, especially since 171 errors out of 192 could be automatically fixed with the --fix flag.
    (see report linked above)

    If it's a question of work and amount of changes, if fixing the ESLint job would take too much work, we could leave it aside/untouched and create a different issue specifically to fix ESLint for the module, see for example: 📌 GitlabCI: Fix ESLINT validation errors Fixed .

    But I would certainly advise against completely shutting down the job, see:
    https://git.drupalcode.org/project/admin_toolbar/-/merge_requests/68/dif...

    variables:
      SKIP_ESLINT: '1'
    

    Switching back to Needs work, as an attempt to get feedback and perhaps an update to the GitlabCI file to revert the ESLint configuration.

    Any feedback, comments, suggestions or questions would be greatly appreciated.

    Feel free to let us know if you have any questions or concerns on any aspects of this comment or the ticket in general, we would surely be glad to help.
    Thanks in advance!

  • 🇦🇺Australia acbramley

    Agree with #13 here - there's also no reason to disable the eslint job you can simply ignore the warnings (it does not fail the pipeline by default) - the same goes for phpcs and phpstan. IMO do the bare minimum to get this in and branch out into other issues. Unblocking D11 support would be fantastic.

  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 6 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    6 months ago
    Total: 402s
    #179766
  • Pipeline finished with Failed
    6 months ago
    Total: 291s
    #179794
  • Pipeline finished with Failed
    6 months ago
    Total: 311s
    #179801
  • Pipeline finished with Failed
    6 months ago
    Total: 708s
    #180395
  • Pipeline finished with Success
    6 months ago
    #180404
  • Pipeline finished with Success
    6 months ago
    Total: 334s
    #180671
  • Pipeline finished with Success
    6 months ago
    Total: 335s
    #180693
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 6 months ago
    Waiting for branch to pass
  • Pipeline finished with Success
    6 months ago
    Total: 340s
    #180698
  • Pipeline finished with Success
    6 months ago
    Total: 381s
    #180699
  • Status changed to Needs review 6 months ago
  • 🇫🇷France dydave

    Quick follow-up on this issue:

    A few additional commits were added to the current merge request MR!68 with a few comments, see above.

    But mostly, at this point:
    Last build on MR!68: https://git.drupalcode.org/issue/admin_toolbar-3407845/-/pipelines/180699

     

    In order for the tests to pass, the broken core test \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::testSubtreesJsonRequest had to be temporarily disabled, until related issue 📌 When using drupalGet(), provide an associative array for $headers Fixed is fixed. From a testing standpoint, this failing core test shouldn't be holding up the tests for the admin_toolbar module: Whenever it is fixed in core, it could be re-enabled for the module.
    See: https://git.drupalcode.org/project/admin_toolbar/-/merge_requests/68/dif...
     

    At this point, all tests now seem to be passing green 🟢\o/ 🎉
    https://git.drupalcode.org/issue/admin_toolbar-3407845/-/pipelines/180699
    thus marking issue as Needs review and bumping as Major as an attempt to attract maintainers attention.

    We would greatly appreciate if a maintainer or someone with write permission could take a look at ticket's merge request MR!68 and let us know if there would be any more work needed.

    Feel free to let us know if you have any questions or concerns on merge request MR!68 or any aspect of this ticket in general, we would surely be glad to help.
    Thanks in advance for your feedback and reviews.

  • 🇦🇺Australia acbramley

    Nice work getting everything green, but as previously stated eslint, stylelint, phpcs, and phpstan are NOT required to be green to get a passing pipeline. By default these fail with warnings. The MR as it currently stands has many changes unrelated to getting a functional pipeline - these could all be pushed into other issues, making it quicker for a maintainer to review and accept this issue. I think this is especially true for the CSS and JS changes as these will almost certainly require manual testing.

    The previously stripped back gitlab ci file has now also been completely overwritten.

  • 🇦🇺Australia darvanen Sydney, Australia

    For what it's worth, I'm with @acbramley on this.

    When I was contributing to this earlier I was yet to come across any kind of guidance on how to approach adopting GitLab CI, but senior people in the community all seem to be coalescing around "just do it and fix the lint failures later".

    That said, the final decision on how to approach this is down to the maintainers of this module of course, who are yet to comment.

  • Pipeline finished with Success
    6 months ago
    Total: 433s
    #181055
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 6 months ago
    Waiting for branch to pass
  • Pipeline finished with Success
    6 months ago
    Total: 358s
    #181112
  • 🇫🇷France dydave

    Thanks for the prompt feedback.

    Agreed: seems too risky to include these changes in the same MR, sounds like a lot to testing in one go and getting CSpell, PHPCS, PHPStan and PHPUnit fixed would already be a great step forward.

    The work on ESLint was moved to a separate issue, see: 📌 GitlabCI: Fix ESLINT validation errors Active , thus reverted all the changes to JS files and eslint configuration for Gitlab CI.
    (Changes were mostly cherry-picked to be moved to a different branch/issue fork)

    At this point, all tests now seem to be passing green 🟢 (Except ESLint, to be addressed in a separate merge request).
    https://git.drupalcode.org/issue/admin_toolbar-3407845/-/pipelines/181112
     

    Feel free to let us know if you have any questions or concerns on merge request MR!68 or any aspect of this ticket in general, we would surely be glad to help.
    Thanks in advance for your feedback and reviews.

  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 6 months ago
    Waiting for branch to pass
  • Pipeline finished with Success
    6 months ago
    Total: 381s
    #181141
  • First commit to issue fork.
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 6 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    6 months ago
    Total: 416s
    #181214
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 6 months ago
    Waiting for branch to pass
  • Pipeline finished with Success
    6 months ago
    Total: 344s
    #181250
  • Pipeline finished with Success
    6 months ago
    Total: 345s
    #181363
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 6 months ago
    Waiting for branch to pass
  • Pipeline finished with Success
    6 months ago
    Total: 350s
    #181367
  • Status changed to RTBC 6 months ago
  • 🇮🇳India ankitv18

    Reviewed the gitlab template ~~ All CI jobs for phpcs, phpstan and phpunit covered properly, Hence marking this one as RTBC

  • Status changed to Needs work 6 months ago
  • 🇦🇺Australia acbramley

    See MR comments

  • 🇫🇷France dydave

    Not sure whether ticket's status should be changed back to Needs review, but the last comments have been answered.

    Additional reviews, comments and feedback would be greatly appreciated.
    Thanks in advance !

  • 🇮🇳India rajeshreeputra Pune

    Commits are cherry-picked from this issue to 📌 Add Drupal 11 support Needs review , please review.

  • Pipeline finished with Failed
    4 months ago
    Total: 355s
    #222971
  • Pipeline finished with Failed
    4 months ago
    Total: 359s
    #222979
  • Pipeline finished with Failed
    4 months ago
    Total: 369s
    #222992
  • Pipeline finished with Failed
    4 months ago
    Total: 524s
    #223004
  • Pipeline finished with Failed
    4 months ago
    Total: 357s
    #223009
  • Pipeline finished with Failed
    4 months ago
    Total: 2270s
    #223015
  • Pipeline finished with Failed
    4 months ago
    Total: 224s
    #223031
  • Pipeline finished with Failed
    4 months ago
    Total: 174s
    #223057
  • 🇫🇷France dydave

    DYdave changed the visibility of the branch 3407845-add-gitlab-ci-temp2 to hidden.

  • Pipeline finished with Success
    4 months ago
    Total: 419s
    #225917
  • Pipeline finished with Failed
    4 months ago
    Total: 426s
    #225928
  • Pipeline finished with Success
    4 months ago
    Total: 345s
    #225931
  • Pipeline finished with Success
    4 months ago
    Total: 404s
    #225938
  • Status changed to Needs review 4 months ago
  • 🇫🇷France dydave

    Quick follow-up on this issue:

    MR!68 is now passing all tests and jobs except ESLint.

    Moving issue back to Needs review as an attempt to get more reviews and feedback.

    Thanks in advance!

  • 🇨🇭Switzerland berdir Switzerland

    Not a maintainer, but if I were, I would ask that this is reduced to the changes that are actually required to enable CI and get it to pass in the default configuration. For example cspell, css changes and probably also php coding standards, at least the part that requires deprecations.

    The last commit on this project was 9 month ago. Clearly the maintainer is currently not very active, and since this also blocks Drupal 11 compatibility at the moment, it should be kept as simple as possible for a maintainer to review and commit.

    I also don't get the comments about 10.2 testing. That still worked in the previous MR and previous major testing also still works, what is the problem with 10.2? In my projects, I usually keep previous minor on, since I want to ensure that my projects work on supported core versions.

  • 🇦🇺Australia acbramley

    Yep, agree with #29, see #19 and #17

    If I have time I'll try to spin an MR with just the relevant changes.

  • Pipeline finished with Success
    4 months ago
    Total: 399s
    #226053
  • 🇫🇷France dydave

    Thanks for the prompt reviews and feedback!

    Created new merge request MR!83 with the bare minimum:

    • GitlabCI template copied from DO-3440169.
    • Fixed PHPUnit tests.

    Everything else was removed.

    New merge request MR!83 seems to pass PHPUnit tests, see latest pipeline:
    https://git.drupalcode.org/issue/admin_toolbar-3407845/-/pipelines/226057

    Feel free to broaden test coverage as required.

    Thanks in advance!

  • Pipeline finished with Success
    4 months ago
    Total: 323s
    #226057
  • 🇩🇰Denmark ressa Copenhagen

    Thanks for working on this @DYdave and @acbramley! I agree with @berdir that focus should be on getting required tests to pass, since Drupal 11 release is close now, in about two weeks:

    Week of July 29, 2024 (UTC) | Drupal 11.0.0 released.

    https://www.drupal.org/about/core/policies/core-release-cycles/schedule#...

    Ideally, a Drupal 11 ready release of Admin Toolbar should have been made a while ago ...

  • Pipeline finished with Success
    4 months ago
    Total: 321s
    #227251
  • 🇫🇷France dydave

    Thanks @ressa!

    The requested changes above have been made to MR!83, which should at this point have the bare minimum changes to add GitlabCI support and get PHPUnit tests to pass.

    Thanks in advance for your reviews and feedback.

  • Status changed to RTBC 4 months ago
  • 🇦🇺Australia acbramley

    Looks great, thanks @DYdave

  • 🇮🇳India rajeshreeputra Pune

    Can we get it merged, Thanks!

  • 🇮🇳India rajeshreeputra Pune

    Changes looks good, CI passing, can we get it merged? this will unblock the Drupal 11 compatibility issue - 📌 Add Drupal 11 support Needs review .
    Thanks!

  • Status changed to Closed: outdated 4 months ago
  • 🇺🇸United States japerry KVUO

    Added gitlab and fixed tests already. One point though, I think the sort method in this test might actually fix 🐛 Max Bundles not being honored Fixed so moving that part of the commit there and closing this.

  • 🇦🇺Australia acbramley

    It's a shame everyone that worked on this didn't get credited tbh

Production build 0.71.5 2024