Skip to content
Snippets Groups Projects
Verified Commit b27e31dc authored by Dave Long's avatar Dave Long
Browse files

Issue #3422641 by Wim Leers, longwave, smustgrave, fjgarlin: Add a...

Issue #3422641 by Wim Leers, longwave, smustgrave, fjgarlin: Add a "Validatable config" tests job to GitLab CI to help core evolve towards 100% validatability

(cherry picked from commit 566b7d32)
parent 5d7c6f18
No related branches found
No related tags found
27 merge requests!11769Issue #3517987: Add option to contextual filters to encode slashes in query parameter.,!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9944Issue #3483353: Consider making the createCopy config action optionally fail...,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!8738Issue #3424162 by camilledavis, dineshkumarbollu, smustgrave: Claro...,!8704Make greek characters available in ckeditor5,!8597Draft: Issue #3442259 by catch, quietone, dww: Reduce time of Migrate Upgrade tests...,!8533Issue #3446962 by kim.pepper: Remove incorrectly added...,!8517Issue #3443748 by NexusNovaz, smustgrave: Testcase creates false positive,!8325Update file Sort.php,!8095Expose document root on install,!7930Resolve #3427374 "Taxonomytid viewsargumentdefault plugin",!7627Issue #3439440 by nicxvan, Binoli Lalani, longwave: Remove country support from DateFormatter,!7445Issue #3440169: When using drupalGet(), provide an associative array for $headers,!7401#3271894 Fix documented StreamWrapperInterface return types for realpath() and dirname(),!7384Add constraints to system.advisories,!7078Issue #3320569 by Spokje, mondrake, smustgrave, longwave, quietone, Lendude,...,!6622Issue #2559833 by piggito, mohit_aghera, larowlan, guptahemant, vakulrai,...,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #118177 passed with warnings
Pipeline: drupal

#118180

    # cspell:ignore codequality Micheh micheh webide
    # cspell:ignore codequality Micheh micheh webide updatedb
    ################
    # Drupal GitLabCI template.
    ......@@ -460,3 +460,60 @@ default:
    echo "HEAD is $(git rev-parse HEAD). \$CI_MERGE_REQUEST_DIFF_BASE_SHA is ${CI_MERGE_REQUEST_DIFF_BASE_SHA}";
    fi;
    - git diff ${CI_MERGE_REQUEST_TARGET_BRANCH_SHA:-$CI_MERGE_REQUEST_DIFF_BASE_SHA} --name-only | sed "s_^_../_" | yarn --cwd=./core run -s spellcheck:core --no-must-find-files --file-list stdin
    '📔 Validatable config':
    <<: [ *default-job-settings-lint ]
    stage: 🪄 Lint
    variables:
    KUBERNETES_CPU_REQUEST: "2"
    # Run on MRs if config schema files have changed, or manually.
    rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    changes:
    - "**/config/schema/*.schema.yml"
    # Modules may alter config schema using hook_config_schema_info_alter().
    - "**/*.module"
    - when: manual
    allow_failure: true
    artifacts:
    expire_in: 1 week
    expose_as: 'validatable-config'
    paths:
    - HEAD.json
    - MR.json
    # This job must pass, but must also not disrupt Drupal core's CI if dependencies are not core-compatible.
    allow_failure:
    exit_codes:
    # `composer require …` fails (implies no version available compatible with Drupal core)
    - 100
    # `drush pm:install config_inspector …` fails (implies failure during module installation)
    - 101
    script:
    # Revert back to the tip of the branch this MR started from.
    - git checkout -f $CI_MERGE_REQUEST_DIFF_BASE_SHA
    # Composer-install Drush & the Config Inspector module.
    - composer require drush/drush drupal/config_inspector || exit 100
    # Install Drupal's Standard install profile + all core modules + the config inspector module.
    - php core/scripts/drupal install standard
    - ls core/modules | xargs vendor/bin/drush pm:install --yes
    - vendor/bin/drush pm:install config_inspector --yes --quiet || exit 101
    # Compute statistics for coverage of validatable config for HEAD.
    - vendor/bin/drush config:inspect --statistics > HEAD.json
    # Return to the MR commit being tested, conditionally install updates, always rebuild the container.
    - git checkout -f $CI_COMMIT_SHA
    - git diff $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_COMMIT_SHA --name-only | grep -q '.install$\|.post_update\.php$' && echo '🤖 Installing DB updates…' && vendor/bin/drush updatedb --yes --quiet
    - vendor/bin/drush cr --quiet
    # Compute statistics for coverage of validatable config for MR.
    - vendor/bin/drush config:inspect --statistics > MR.json
    # Output diff, but never fail the job.
    - diff -u HEAD.json MR.json || true
    # Determine if this increased or decreased coverage. Fail the job if it is worse. All the
    # percentages must be equal or higher, with the exception of `typesInUse`.
    - |
    php -r '
    $head = json_decode(file_get_contents("HEAD.json"), TRUE)["assessment"];
    $mr = json_decode(file_get_contents("MR.json"), TRUE)["assessment"];
    unset($head["_description"], $head["typesInUse"], $mr["_description"], $mr["typesInUse"]);
    $impact = array_map(fn (float $h, float $m) => $m-$h, $head, $mr);
    exit((int) (min($impact) < 0));
    '
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment