diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 21:08:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 21:08:00 +0300 |
commit | f781b0b69368ea3181cf892305c60a22886c0d7e (patch) | |
tree | 0737d7313d4e5760e3addcec0b0f40c474008dcf /danger | |
parent | 1d5ae049f089db097048fa896105ad75fe859596 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'danger')
-rw-r--r-- | danger/bundle_size/Dangerfile | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/danger/bundle_size/Dangerfile b/danger/bundle_size/Dangerfile new file mode 100644 index 00000000000..e2621360c7f --- /dev/null +++ b/danger/bundle_size/Dangerfile @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +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", + "--from-sha #{gitlab.mr_json["diff_refs"]["start_sha"]}", + "--to-file #{analysis_result}", + "--html ./bundle-size-review/comparison.html", + "--markdown #{markdown_result}" +].join(" ") + +# execute comparison +`#{comparison_cmd}` + +comment = `cat #{markdown_result}` + +markdown(<<~MARKDOWN) + #{comment} +MARKDOWN |