Problem/Motivation

The module has no .gitlab-ci.yml, so merge requests are not checked automatically. Coding standards, static analysis and compatibility with other Drupal core versions are only checked when someone runs the tools by hand. #2915427 had to fix coding standards violations that had been committed to 2.x over time; a pipeline would have reported them on each merge request.

The drupal.org GitLab CI templates provide the standard jobs for contributed projects (composer, phpcs, phpstan, cspell, eslint, phpunit and others) and are kept up to date centrally by the Drupal Association, so a project only needs a short .gitlab-ci.yml that includes them.

Steps to reproduce

Open any merge request for the module: no pipeline runs.

Proposed resolution

Add a .gitlab-ci.yml based on the drupal.org template:

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:
  OPT_IN_TEST_PREVIOUS_MAJOR: '1'

OPT_IN_TEST_PREVIOUS_MAJOR adds Drupal 10 variants of the jobs, because field_expression.info.yml declares core_version_requirement: ^10.2 || ^11 and the default jobs only cover the current major. The variant jobs do not run automatically by default; they can be started from the pipeline page.

No other variables are needed:

  • The phpunit and nightwatch jobs are only created when the project has tests (tests/**/*Test.php, tests/src/Nightwatch/**/*.js). The module has none yet, so they are left out, and they will start running once tests are added.
  • Stylelint only runs when there are CSS files; the module has none.

Checked locally on 2.x with the settings the templates use:

  • phpcs with the Drupal and DrupalPractice standards: no errors or warnings.
  • phpstan at level 0 (the template default) with phpstan-drupal: no errors.
  • composer validate: valid.

cspell was not run locally. If the first pipeline reports module-specific words (function names such as arcsinh, the webit/eval-math package name), they can go in a .cspell-project-words.txt file, which the template reads by default.

Out of scope:

  • Testing against the next major (OPT_IN_TEST_NEXT_MAJOR), which belongs with the Drupal 12 work in #3598184.
  • Adding tests. A follow-up issue for kernel tests of evaluateExpression() would make the phpunit job useful.

Remaining tasks

  • Merge request adding .gitlab-ci.yml.
  • Check the first pipeline and fix or whitelist any findings (most likely cspell).
  • Review.

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

orkutmuratyilmaz created an issue. See original summary.

orkutmuratyilmaz’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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