Add support for Gitlab CI

Created on 6 August 2024, 3 months ago
Updated 21 August 2024, 3 months ago

Problem/Motivation

Allows running code-checks

Proposed resolution

See docs: https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr... โ†’

Enable CSpell, ESLint, PHPCS, and PHPStan tests and checks.

################
# Require CSpell checks to pass.
################
cspell:
  allow_failure: false

################
# Require ESLint checks to pass.
################
eslint:
  allow_failure: false

################
# Require PHPCS checks to pass.
################
phpcs:
  allow_failure: false

################
# Require PHPStan checks to pass.
################
phpstan:
  allow_failure: false

################
# Require stylelint checks to pass.
################
stylelint:
  allow_failure: false

Take inspiration from https://git.drupalcode.org/project/svg_image_field/-/blob/2.3.x/.gitlab-...

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3

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

Merge Requests

Comments & Activities

  • Issue created by @jwilson3
  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3
  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3
  • Pipeline finished with Success
    3 months ago
    Total: 219s
    #246212
  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3

    Iโ€™m hitting some strange inconsistencies with the way Gitlab CI runs stylelint against my theme, versus running it locally. It seems like the style rules on my local are missing stylelint-prettier or something like that. On local itโ€™s expecting singular quotes for all CSS rules, whereas on Gitlab CI, prettier is expecting double quotes.

    No errors on local Ddev site install running Drupal 10.3.1:

    yarn --cwd web/core install
    web/core/node_modules/.bin/stylelint --ignore-path ./.stylelintignore --formatter verbose --config "web/core/.stylelintrc.json" "web/themes/contrib/rivet/**/*.css" --color
    64 sources checked
    0 problems found
    

    Error on Gitlab CI:

    $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/stylelint --ignore-path ./.stylelintignore --formatter verbose --config $CI_PROJECT_DIR/$_WEB_ROOT/core/.stylelintrc.json ./**/*.css --color $_STYLELINT_EXTRA || true
    
    css/rvt-drupal-compatibility.css
     144:39  โœ–  Replace "'rvt-container'" with ""rvt-container""  prettier/prettier
     196:33  โœ–  Replace "'true'" with ""true""                    prettier/prettier
     200:33  โœ–  Replace "'true'" with ""true""                    prettier/prettier
     207:12  โœ–  Replace "''" with """"                            prettier/prettier
    

    I'm not sure what I'm doing wrong.

  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3

    Was unable to figure out the stylelint issues with the doublequotes.

    So I ended up applying stylelint piecemeal, in separate commits, then reverting the change to single quotes from double quotes.

    This made Gitlab CI stylelint happy.

    My local stylelint isn't happy, and what is worse is that npm run build (we use sass in the theme) generates different output that is probably going to fail stylelint again on next push ... let's see.

  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3

    okay, it's green!

    Going to do visual regression testing...

  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3

    Tested on a page that leverages several theme features and I'm not seeing any issues.

    Going for the merge!

  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3
  • Status changed to Fixed 3 months ago
  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024