diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /danger/Dangerfile-bundle_size | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) | |
download | gitlab-ce-3cccd102ba543e02725d247893729e5c73b38295.tar.gz |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'danger/Dangerfile-bundle_size')
-rw-r--r-- | danger/Dangerfile-bundle_size | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/danger/Dangerfile-bundle_size b/danger/Dangerfile-bundle_size new file mode 100644 index 00000000000..23ab726096e --- /dev/null +++ b/danger/Dangerfile-bundle_size @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file isn't named "Dangerfile" so that it's not imported by default since it's only meant to be run in the `bundle-size-review` job. + +analysis_result = "./bundle-size-review/analysis.json" +markdown_result = "./bundle-size-review/comparison.md" + +# Executing the webpack-entry-point-analyser +# We would like to do that in the CI file directly, +# but unfortunately the head_commit SHA is not available +# as a CI variable due to our merge into master simulation +analyze_cmd = [ + "webpack-entry-point-analyser", + "--from-file ./webpack-report/stats.json", + "--json #{analysis_result}", + " --sha #{gitlab&.head_commit}" +].join(" ") + +# execute analysis +`#{analyze_cmd}` + +# We are executing the comparison by comparing the start_sha +# to the current pipeline result. The start_sha is the commit +# from master that was merged into for the merged pipeline. +comparison_cmd = [ + "webpack-compare-reports", + "--job #{ENV["CI_JOB_ID"]}", + "--to-file #{analysis_result}", + "--html ./bundle-size-review/comparison.html", + "--markdown #{markdown_result}" +].join(" ") + +# execute comparison +`#{comparison_cmd}` + +comment = `cat #{markdown_result}` + +unless comment.strip.empty? + markdown(<<~MARKDOWN) + #{comment} + MARKDOWN +end |