Move lint jobs to the pipeline

Created on 4 October 2023, about 1 year ago

Problem/Motivation

We currently have linting jobs in the 'parent' gitlab.yml and tests in the pipeline.yml

This has a couple of drawbacks compared to them being in the child jobs:

1. We have to run composer install and yarn jobs first in the parent, then the child jobs, instead of once, and those jobs block both stages.

2. Core branch runs don't get linting jobs run on them at all, this potentially allows for phpcs/cspell/phpstan race conditions with commits that pass independently but wouldn't together.

3. Each branch only ever runs lint jobs on the default environment, we currently cover PHP 8.2 and PHP 8.1 via the 10.1 and 11.x default job configuration, but this would give us flexibility to run on all supported PHP versions on each branch.

The downside is we don't want to run lint jobs on every possible environment on branch tests, so should ideally restrict them to only a couple of environments. Not sure how to do that yet but assume it's possible.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Closed: duplicate

Version

11.0 🔥

Component
PHPUnit 

Last updated about 8 hours ago

Created by

🇬🇧United Kingdom catch

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

Comments & Activities

  • Issue created by @catch
  • 🇪🇸Spain fjgarlin

    The downside is we don't want to run lint jobs on every possibly environment on branch tests, so should ideally restrict them to only a couple of environments. Not sure how to do that yet but assume it's possible.

    We can set a variable in the parent to pass it to the child. ie:
    .gitlab-ci.yml

    'PHP 8.1 MySQL 5.7':
      <<: [ *default-stage, *run-on-commit ]
      variables:
        _TARGET_PHP: "8.1"
        _TARGET_DB: "mysql-5.7"
        RUN_LINT: "1"
    

    pipeline.yml

    ...inside lint jobs...
    rules:
        - if: $RUN_LINT == "1"
    
  • 🇬🇧United Kingdom longwave UK

    1. Can be solved with 📌 Use composer and yarn artifacts from parent pipeline Needs work

    2. Core branch runs do get lint pipelines run? See e.g. https://git.drupalcode.org/project/drupal/-/pipelines/26646

    3. I think we decided that linting doesn't really vary between environments; certainly JavaScript doesn't care which combination of PHP and database we are on, and it's unlikely except for perhaps the PHPStan case that the PHP version matters either.

  • 🇬🇧United Kingdom catch

    #2 is right about commit tests, I was looking at the scheduled branch pipelines, which don't run linting steps. Given that we might not need this issue at all then. #3 there are potentially deprecations picked up differently between phpcs for different PHP versions, but we can mostly solve that with the per-branch configuration for default jobs so makes this much lower priority.

  • Status changed to Closed: duplicate about 1 year ago
  • 🇬🇧United Kingdom catch

    Marking duplicate of 📌 Use composer and yarn artifacts from parent pipeline Needs work which handles nearly all of what I wanted to achieve here.

Production build 0.71.5 2024