Add coverage for test-only changes job

Created on 7 May 2025, 7 days ago

Problem/Motivation

Investigate if it is possible to add coverage for the "test-only changes" job. This job is triggered when running a Merge Request pipeline and where there are changes to a phpunit test file.

Ideally this should be triggerable from the upstream Gitlab Templates jobs. It may require a permanent Merge Request to be open in a branch on the GTD project. Or we can investigate other ways to simulate the workflow of a MR by changing some things in way the GTD pipelines are triggered upstream.

Proposed resolution

Remaining tasks

Feature request
Status

Active

Component

PHPUnit

Created by

🇬🇧United Kingdom jonathan1055

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

Comments & Activities

  • Issue created by @jonathan1055
  • 🇪🇸Spain fjgarlin

    We could somehow alter a file using the before_script and maybe we also need to override the rules section for the "test-only job" on one of the files so it always runs as well.

  • 🇬🇧United Kingdom jonathan1055

    Yes we can alter files in before_script but even if we changed the rules to trigger the job, I am not sure that this "diff" would pick up the changes when the pipeline is not running from a Merge Request. It might do, so worth a try. But also altering the rules kind-of invalidates the overall testing of the job.

    I will try the above, but it might end up that we create a special MR here, marked as draft, which remains open and we run it in a new downstream pipeline (with other jobs skipped so we don't duplicate and hence waste resource each time)

  • 🇪🇸Spain fjgarlin

    We can only do it on one branch, or just do it for the parent issue (the one of failing curl) and then revert the change.
    Or we can add a new rule that will trigger it, like setting a variable, which we could set in the gitlab_templates project when calling the downstream pipelines.

  • 🇪🇸Spain fjgarlin

    Something like this:

      rules:
        - if: '$FORCE_TEST_ONLY_JOB == "1"'
           when: always
        - *opt-in-current-rule
        - *skip-test-only-changes-rule
        - changes:
            - '**/tests/**/*Test.php'
          when: manual
    
Production build 0.71.5 2024