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:
-rw-r--r--.gitlab/ci/build-and-deploy.gitlab-ci.yml73
-rw-r--r--.gitlab/ci/rules.gitlab-ci.yml19
2 files changed, 31 insertions, 61 deletions
diff --git a/.gitlab/ci/build-and-deploy.gitlab-ci.yml b/.gitlab/ci/build-and-deploy.gitlab-ci.yml
index dc89fc96..1cb64675 100644
--- a/.gitlab/ci/build-and-deploy.gitlab-ci.yml
+++ b/.gitlab/ci/build-and-deploy.gitlab-ci.yml
@@ -7,24 +7,6 @@
extends:
- .retry
- .bundle_and_yarn
- artifacts:
- paths:
- - public
- expire_in: 1d
-
-# Common setup for review apps
-.review-environment:
- image: registry.gitlab.com/gitlab-org/gitlab-build-images:www-gitlab-com-debian-bullseye-ruby-3.0-node-16
- environment:
- name: review/$CI_COMMIT_REF_SLUG$REVIEW_SLUG
- url: https://$CI_COMMIT_REF_SLUG$REVIEW_SLUG.docs.gitlab-review.app
- on_stop: review_stop
- auto_stop_in: 30 days
-
-#
-# The script lines for compiling and minifying the site
-#
-.compile-and-minify-scripts:
script:
- bundle exec rake default
- bundle exec nanoc compile -VV
@@ -33,29 +15,36 @@
# Build the Lunr.js search index if needed
- if [[ "$ALGOLIA_SEARCH" == "false" ]]; then node scripts/lunr/preindex.js; fi
# Calculate sizes before and after minifying/gzipping the static files (HTML, CSS, JS)
- - SIZE_BEFORE_MINIFY=$(du -sh public/ | awk '{print $1}')
+ - SIZE_BEFORE=$(du -sh public/ | awk '{print $1}')
# Minify the assets of the resulting site
- cd public
- ../scripts/minify-assets.sh ./ ./
- cd ..
- SIZE_AFTER_MINIFY=$(du -sh public/ | awk '{print $1}')
- # Print size results
- - echo -e "Size before minifying ......... $SIZE_BEFORE_MINIFY\nSize after minifying ................... $SIZE_AFTER_MINIFY"
-
-#
-# The script lines for gzipping the site (not used in upstream review apps, to speed up pipelines)
-#
-.gzip-scripts:
- script:
- # Use gzip to compress static content for faster web serving. Keep uncompressed files for browsers that don't support
- # compressed files: 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" -o -iname "*.json" \) -exec gzip --keep --best --force --verbose {} \;
+ # 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" -o -iname "*.json" \) -exec gzip --keep --best --force --verbose {} \;
- SIZE_AFTER_GZIP=$(du -sh public/ | awk '{print $1}')
# Print size results
- - echo -e "Size after adding gzipped versions ..... $SIZE_AFTER_GZIP"
+ - 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
+ expire_in: 1d
+
+# Common setup for review apps
+.review-environment:
+ image: registry.gitlab.com/gitlab-org/gitlab-build-images:www-gitlab-com-debian-bullseye-ruby-3.0-node-16
+ environment:
+ name: review/$CI_COMMIT_REF_SLUG$REVIEW_SLUG
+ url: https://$CI_COMMIT_REF_SLUG$REVIEW_SLUG.docs.gitlab-review.app
+ on_stop: review_stop
+ auto_stop_in: 30 days
#
-# Compile "prod" only on the default and stable branches
+# Compile only on the default and stable branches
#
compile_prod:
extends:
@@ -64,12 +53,9 @@ compile_prod:
variables:
ALGOLIA_SEARCH: 'true'
NANOC_ENV: 'production'
- script:
- - !reference [".compile-and-minify-scripts", "script"]
- - !reference [".gzip-scripts", "script"]
#
-# Compile "dev" for all MRs in `gitlab-docs`
+# Compile on all branches except the default branch
#
compile_dev:
extends:
@@ -77,21 +63,6 @@ compile_dev:
- .build_base
variables:
ALGOLIA_SEARCH: 'false'
- script:
- - !reference [".compile-and-minify-scripts", "script"]
- - !reference [".gzip-scripts", "script"]
-
-#
-# Compile but skip gzip step for review apps from upstream projects
-#
-compile_upstream_review_app:
- extends:
- - .rules_upstream_review_app
- - .build_base
- variables:
- ALGOLIA_SEARCH: 'false'
- script:
- - !reference [".compile-and-minify-scripts", "script"]
###############################################
# Review Apps #
diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml
index 02b1aa12..09c9d5e9 100644
--- a/.gitlab/ci/rules.gitlab-ci.yml
+++ b/.gitlab/ci/rules.gitlab-ci.yml
@@ -126,16 +126,6 @@ default:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- if: '$CI_COMMIT_BRANCH =~ /^\d{1,2}\.\d{1,2}$/'
-.rules_dev:
- rules:
- - if: '$CI_MERGE_REQUEST_ID'
- - if: '$CI_COMMIT_BRANCH =~ /docs-preview/' # TODO: Remove once no projects create such branch
- - if: '$CI_PIPELINE_SOURCE == "schedule" && $CHORES_PIPELINE == "true"'
-
-.rules_upstream_review_app:
- rules:
- - if: '$CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "trigger"'
-
.rules_pages:
rules:
- if: $CHORES_PIPELINE == "true" || $CLEAN_REVIEW_APPS_DAYS
@@ -144,3 +134,12 @@ default:
- if: '$CI_PIPELINE_SOURCE == "pipeline"|| $CI_PIPELINE_SOURCE == "trigger"'
when: never
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+
+.rules_dev:
+ rules:
+ - if: '$CLEAN_REVIEW_APPS_DAYS'
+ when: never
+ - if: '$CI_MERGE_REQUEST_ID'
+ - if: '$CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "trigger"'
+ - if: '$CI_COMMIT_BRANCH =~ /docs-preview/' # TODO: Remove once no projects create such branch
+ - if: '$CI_PIPELINE_SOURCE == "schedule" && $CHORES_PIPELINE == "true"'