Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Amirault <mamirault@gitlab.com>2020-06-04 05:10:43 +0300
committerMarcel Amirault <mamirault@gitlab.com>2020-06-04 05:10:43 +0300
commitf2a92a3aa4057b423859d07b5dcc4d353584a4e7 (patch)
tree8d5244b4ea26ad77070e532d911397ae8178cd88
parente6e68f577c48c5b70c145a5ea187af49960ff03c (diff)
parent573be35ef1d0a330a3e599ca96cee527ae53e564 (diff)
Merge branch 'ci-gzip-refactor' into 'master'
Change how the size of the site is calculated in CI See merge request gitlab-org/gitlab-docs!930
-rw-r--r--.gitlab-ci.yml16
1 files changed, 10 insertions, 6 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c7ca615e..456121d0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -117,15 +117,19 @@ variables:
- for i in `find public -name README.html`; do ln -sf README.html $(dirname $i)/index.html; done
# Remove CE dir and symlink EE to CE
- if [ $CI_PIPELINE_SOURCE != 'pipeline' ]; then cd public && rm -rf ce && ln -s ee ce && cd ../; fi
- # Use gzip to compress content
- - SIZE_BEFORE_GZIP=$(du -sh public/)
- - find public/ -type f \( -iname "*.html" -o -iname "*.js" -o -iname "*.css" -o -iname "*.svg" \) -exec gzip --keep --best --force --verbose {} \;
- - SIZE_AFTER_GZIP=$(du -sh public/)
+ # Calculate sizes before and after minifying/gzipping the static files (HTML, CSS, JS)
+ - SIZE_BEFORE=$(du -sh public/ | awk '{print $1}')
# Minify the assets of the resulting site
- ./scripts/minify-assets.sh ./ public/
- - SIZE_AFTER_MINIFY=$(du -sh public/)
+ - SIZE_AFTER_MINIFY=$(du -sh public/ | awk '{print $1}')
+ # Use gzip to compress static content for faster web serving
+ # https://docs.gitlab.com/ee/user/project/pages/introduction.html#serving-compressed-assets
+ - find public/ -type f \( -iname "*.html" -o -iname "*.js" -o -iname "*.css" -o -iname "*.svg" \) -exec gzip --keep --best --force --verbose {} \;
+ - SIZE_AFTER_GZIP=$(du -sh public/ | awk '{print $1}')
# Print size results
- - echo -e "Size before gzipping $SIZE_BEFORE_GZIP\nSize after gzipping $SIZE_AFTER_GZIP\nSize after minifying $SIZE_AFTER_MINIFY"
+ - echo "Minify and compress the static assets (HTML, CSS, JS)"
+ - echo
+ - echo -e "Size before minifying and gzipping ..... $SIZE_BEFORE\nSize after minifying ................... $SIZE_AFTER_MINIFY\nSize after adding gzipped versions ..... $SIZE_AFTER_GZIP"
artifacts:
paths:
- public