Set up GitLab CI

Created on 22 February 2024, 9 months ago
Updated 15 March 2024, 8 months ago

Problem/Motivation

Drupal.org now uses GitLab CI to run automated linting and testing for projects hosted on Drupal.org .

Automated linting and testing makes maintaining a project easier, because we get feedback on whether a proposed change will cause a regression. We can also use it to test our code on new versions of our dependencies (including Drupal.org).

Proposed resolution

Copy the the Drupal Association .gitlab-ci.yml template to this project, and fix any issues identified by the lints and tests.

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

📌 Task
Status

Fixed

Version

4.0

Component

Code

Created by

🇨🇦Canada mparker17 UTC-4

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

Merge Requests

Comments & Activities

  • Issue created by @mparker17
  • Merge request !3Resolve #3423322 "Set up gitlab ci" → (Merged) created by mparker17
  • Status changed to Needs work 9 months ago
  • 🇨🇦Canada mparker17 UTC-4

    Getting some linter suggestions for eslint and phpstan; will try to resolve these before merging.

  • Status changed to Needs review 9 months ago
  • 🇨🇦Canada mparker17 UTC-4

    Yay, all tests and lints are green!

    Some notes on what I did:

    1. It might be easiest to review the 11 commits in the merge request one at a time, in chronological order.
    2. As a general best practice, I've found that, when you're first introducing linting to a project, establishing a "baseline" of ignored lints is the best course of action... if you disable that type of linting, then you'll have more work to do (i.e.: on new code) when you re-enable it; and if you just leave it, then contributors might just assume it's always been broken and not try to make their new code satisfy the linter.
    3. I started by copying the suggested .gitlab-ci.yml from the GitLab Templates project , according to the instructions .
    4. I applied the automated linter suggestions for PHPCS, which fixed all of them.
    5. I ignored all the "misspelled" words, to satisfy the new CSpell linter 📌 Use CSPELL to fix spelling errors and add custom dictionary Active , which was running in my local pipeline (but doesn't appear to run in this module's CI yet).
    6. I told eslint to ignore minified code, code generated by / downloaded by CKEditor, and the CKEditor code translations.
    7. I applied the automated linter suggestions for eslint.
    8. I configured the CSpell lint to ignore the minified code, the code generated by / downloaded by CKEditor, and the CKEditor code translations. This allowed me to drastically reduce the number of misspelled words. The remaining ones are variable names, so I don't want to fix them until I have automated tests in place.
    9. In trying to fix the remaining eslint issues, I updated the libraries file to note that this project's JS "glue code" depends on the core/jquery and core/drupal libraries, and also removed an import in the webpack configuration that wasn't being used.
    10. I ignored the rest of the eslint notices so that we can fix them later, if ever. I daresay some of them will go away as more contrib projecdts run into the same sort of things we're doing, and the rules get updated.
    11. When I was running the pipelines locally, I noticed that the script would rewrite composer.json; and the new version used 4 spaces instead of 2, so I reformatted composer.json so it was easier to see whether the rewritten code was useful in any way. It was not (seems to be an imperfect side-effect of testing locally), but I decided to keep the commit anyway.
    12. I did notice that the SPDX license list now considers the "GPL-2.0+" license identifier deprecated, and prefers "GPL-2.0-or-later", so I fixed that in composer.json.
    13. Finally, I tried tracking down the source of the PHPStan errors, and discovered that it was complaining because it was testing on Drupal 10, but it depended on \Drupal\ckeditor_abbreviation\Plugin\CKEditorPlugin\AbbreviationCKEditorButton depends on some CKEditor 4 classes, which are now in the CKEditor [4] module, so I added a test dependency on it. As an aside, we should probably drop support for CKEditor 4, given that the CKEditor 4 module is now unmaintained, and has no supported releases, but I daresay this would come in a 2.0.x release.

    I'm going to run some manual tests, and if everything still works, then I will mark as RTBC and assign to @boromino to review.

  • Assigned to boromino
  • 🇨🇦Canada mparker17 UTC-4

    I did some manual tests for the code in this branch, and it works just fine on Drupal 10.1.x so I'm going to move this to RTBC, and assign to @boromino for review.

  • Status changed to RTBC 9 months ago
  • 🇨🇦Canada mparker17 UTC-4

    Whoops, I said I was going to move this to RTBC but forgot.

  • Issue was unassigned.
  • Status changed to Fixed 9 months ago
  • 🇨🇦Canada mparker17 UTC-4

    Awesome, thanks @boromino! :D

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

Production build 0.71.5 2024