Skip to content
Snippets Groups Projects
Commit 683bba26 authored by Wim Leers's avatar Wim Leers
Browse files

Issue #3391990 by Wim Leers, diqidoq: Automated report on core config validatability

parent 603a7fbf
No related branches found
No related tags found
1 merge request!11Resolve #3391990 "Pages"
Pipeline #73579 failed with stages
in 29 minutes and 57 seconds
......@@ -48,15 +48,14 @@ phpcs:
📈 Core config validatability:
variables:
_TARGET_PHP: '8.1'
START_DATETIME: "2023-01-01 00:00:00"
START_DATETIME: "2022-12-01 00:00:00"
stage: build
before_script:
# Log state before.
- which php && which composer && which jq && which r || true
# Install jq and r.
- which php && which composer && which jq || true
# Install jq.
- sudo apt-get -qq update
- sudo apt-get -qq install -y jq
- sudo apt-get -qq install -y r-base
# Log state after.
- which php && which composer && which jq
# This is the most resource-intensive test: log the current memory limit & composer version.
......@@ -71,12 +70,36 @@ phpcs:
- mv $CI_PROJECT_DIR modules/
- mkdir statistics
- php config-validatability-report.php $START_DATETIME
- mkdir -p $CI_PROJECT_DIR/public
- Rscript visualize_statistics.R
- echo '<img src="validatability.png" width="100%">' > $CI_PROJECT_DIR/public/index.html
- mv validatability.png $CI_PROJECT_DIR/public/
- mv statistics $CI_PROJECT_DIR/public/
- mv statistics.csv $CI_PROJECT_DIR/public/
- mkdir -p $CI_PROJECT_DIR/validatability-report
- mv statistics $CI_PROJECT_DIR/validatability-report/
- mv statistics.csv $CI_PROJECT_DIR/validatability-report/
artifacts:
paths:
- validatability-report
# Run in every scheduled pipeline, and allow manual runs on the default branch as well as in MRs.
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: always
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
pages:
stage: build
needs:
- 📈 Core config validatability
image: r-base
script:
# Visualize the statistics from the report.
- mv validatability-report/statistics.csv .
- Rscript scripts/visualize_statistics.R
# Publish the visualization of the report, plus the raw data behind it.
- mkdir public
- echo '<img src="validatability.png" width="100%">' > public/index.html
- mv validatability.png public/
- mv validatability-report public/raw
- mv statistics.csv public/raw/
artifacts:
paths:
- public
......
......@@ -142,7 +142,9 @@ function assess_revision(string $revision, int $day, string $date): \stdClass {
// Ensure `drush config:inspect --statistics` keeps working.
$prep_output[] = @shell_exec("git diff 10.99.$prev 10.99.$day --name-only | grep -q '.install$\|.post_update\.php$' && echo '🤖 Installing DB updates…' && vendor/bin/drush updatedb --yes --quiet");
$prep_output[] = @shell_exec("git diff 10.99.$prev 10.99.$day --name-only | grep -q '.schema\.yml$' && echo '🤖 Erasing discovery cache because config schema changed…' && vendor/bin/drush cc bin discovery --quiet");
$prep_output[] = @shell_exec("git diff 10.99.$prev 10.99.$day --name-only | grep -q '^core\/lib\/Drupal\/Core\/Config\/Schema\/' && echo '🤖 Erasing discovery cache because config schema infrastructure changed…' && vendor/bin/drush cc bin discovery --quiet");
$prep_output[] = @shell_exec("git diff 10.99.$prev 10.99.$day --name-only | grep -q '\/Validation\/' && echo '🤖 Rebuilding container because validation constraints were added or modified…' && vendor/bin/drush cr --quiet");
$prep_output[] = @shell_exec("git diff 10.99.$prev 10.99.$day --name-only | grep -q '^core\/lib\/Drupal\/Core\/.*Kernel' && echo '🤖 Rebuilding container because kernel infrastructure changed…' && vendor/bin/drush cr --quiet");
// Actually gather statistics.
@shell_exec("vendor/bin/drush config:inspect --statistics > statistics/$date.json");
$assessment_json = @shell_exec("jq -r .assessment statistics/$date.json");
......
# Inspiration for improvements: https://exts.ggplot2.tidyverse.org/gallery/
install.packages("ggplot2", repos="http://cran.us.r-project.org", quiet=TRUE)
install.packages("ggpmisc", repos="http://cran.us.r-project.org", quiet=TRUE)
# @see https://stackoverflow.com/a/4090208
list.of.packages <- c("ggplot2", "ggpmisc")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
library(ggplot2)
library(ggpmisc)
df <- read.csv("statistics.csv")
......
......@@ -52,7 +52,7 @@ class ConfigInspectorManager {
ConfigFactoryInterface $config_factory,
TypedConfigManagerInterface $typed_config_manager,
CacheBackendInterface $discovery_cache,
CacheBackendInterface $bootstrap_cache,
CacheBackendInterface $bootstrap_cache
) {
$this->configFactory = $config_factory;
$this->typedConfigManager = $typed_config_manager;
......
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