Skip to content
Snippets Groups Projects
Commit d00dda38 authored by Sophie Servan (DESY)'s avatar Sophie Servan (DESY)
Browse files

minimalist version for the gitlab-ci

parent ee27e051
No related branches found
No related tags found
No related merge requests found
Pipeline #228937 passed
......@@ -2,6 +2,3 @@
_site
# ignore jekyll cache
.jekyll-cache
# ignore local Gemfile
Gemfile
Gemfile.lock
......@@ -2,212 +2,19 @@ image: ruby:3.0
stages:
- build
- test
- review
- accessibility
- deploy
.artifacts_extension:
artifacts:
paths:
- public
expire_in: 1d
.caching: &caching
cache:
- key:
files:
- Gemfile.lock
prefix: "$CI_JOB_IMAGE"
paths:
- vendor/bundle
- key: jumbotron-cache-$CI_COMMIT_REF_SLUG
paths:
- assets/img/jumbotrons/desktop
- assets/img/jumbotrons/display_2k
- assets/img/jumbotrons/phone
- assets/img/jumbotrons/tablet
.common_production: &production_before_script
before_script:
## Following four lines are not needed.
#- "[[ -x \"$(command -v apt-get)\" ]] && \
# apt-get update && \
# apt-get install -y ffmpeg"
#- ./fetch_external_content.sh
- gem install bundler --no-document
- bundle config set without 'test'
- bundle install --jobs $(nproc)
<<: *caching
.common_latest: &latest_before_script
before_script:
## Following four lines are not needed.
#- "[[ -x \"$(command -v apt-get)\" ]] && \
# apt-get update && \
# apt-get install -y ffmpeg"
#- ./fetch_external_content.sh
- "[[ -f \"Gemfile.lock\" ]] && rm Gemfile.lock"
- bundle config set without 'test'
- bundle install --jobs $(nproc) --without test "${FLAGS[@]}"
- bundle update --jobs $(nproc) "${FLAGS[@]}"
<<: *caching
.common_variables: &common_variables
GIT_SUBMODULE_STRATEGY: recursive
SUBPATH: "/"
BUNDLE_PATH: vendor/bundle
NOKOGIRI_USE_SYSTEM_LIBRARIES: "1"
variables:
JEKYLL_ENV: production
before_script:
- gem install bundler jekyll --no-document
.builds: &builds
build:
stage: build
variables:
<<: *common_variables
script:
## REVISIT: skip generating thumbnails for now.
#- "bash scripts/create_jumbotrons.sh assets/img/jumbotrons/"
- "bundle exec jekyll build --future \
--config _config.yml \
-d public$SUBPATH \
--baseurl $SUBPATH"
- "cp _favicons/* public/$SUBPATH"
# https://docs.gitlab.com/ce/ci/yaml/#interruptible
interruptible: true
.builds_reviewapps: &builds_reviewapps
stage: build
variables:
<<: *common_variables
script:
## REVISIT: skip generating thumbnails for now.
#- "bash scripts/create_jumbotrons.sh assets/img/jumbotrons/"
- "bundle exec jekyll build --future \
--config _config.yml,_config_reviewapps.yml \
-d public$SUBPATH \
--baseurl $SUBPATH"
- "cp _favicons/* public/$SUBPATH"
# https://docs.gitlab.com/ce/ci/yaml/#interruptible
interruptible: true
.tests: &tests
stage: test
variables:
<<: *common_variables
before_script:
# Installing, generating and exporting locale because htmlproofer needs it.
# Locale is not set in "standard" docker containers.
- "[[ -x \"$(command -v apt-get)\" ]] && \
apt-get update && \
apt-get install -y locales && \
echo \"en_US UTF-8\" > /etc/locale.gen && \
locale-gen en_US.UTF-8 && \
export LANG=en_US.UTF-8 && \
export LANGUAGE=en_US:en && \
export LC_ALL=en_US.UTF-8"
- gem install bundler --no-document
- bundle install --jobs $(nproc)
script:
- "bundle exec htmlproofer public \
--disable-external=true \
--enforce-https=false"
# Use yaml-lint tool to check yaml files.
- "bundle exec yaml-lint _data/ _config.yml"
<<: *caching
# https://docs.gitlab.com/ce/ci/yaml/#interruptible
interruptible: true
# Job runs jekyll build with latest dependencies.
build:latest:
<<: *builds
<<: *latest_before_script
image: ruby:latest
allow_failure: true
# Job runs jekyll build with production dependencies,
# puts everything in a sub-directory as required for review apps.
build:production:review-apps:
<<: *builds_reviewapps
<<: *production_before_script
variables:
<<: *common_variables
SUBPATH: /review-apps/$CI_PROJECT_PATH_SLUG/$CI_COMMIT_REF_SLUG
extends:
- .artifacts_extension
# Job runs jekyll build with current production dependencies
build:production:
<<: *builds
<<: *production_before_script
extends:
- .artifacts_extension
# Job runs htmlproofer basing on production build.
test:htmlproofer:
<<: *tests
dependencies:
- build:production
needs: ["build:production"]
# Job runs htmlproofer basing on production build with subpath.
test:htmlproofer:subpath:
<<: *tests
dependencies:
- build:production:review-apps
needs: ["build:production:review-apps"]
# Job tests external links in addition to test:htmlproofer job.
test:htmlproofer:external_links:
<<: *tests
dependencies:
- build:production
needs: ["build:production"]
script:
- >
bundle exec htmlproofer public
--disable-external=false
--enforce-https=false
--ignore-urls='/www.openstoragenetwork.org/,/www.hzdr.de/,/indico4.twgrid.org/,/webfts.fedcloud-tf.fedcloud.eu/,/nubes.helmholtz-berlin.de\/f/'
--ignore-status-codes=429
--check-external-hash=false
--typhoeus='{"headers":{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0"}}'
--only-4xx
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
allow_failure: true
review:
stage: review
variables:
GIT_STRATEGY: none
REVIEW_APPS_PATH: review-apps/$CI_PROJECT_PATH_SLUG/$CI_COMMIT_REF_SLUG
dependencies:
- build:production:review-apps
needs: ["build:production:review-apps"]
script:
- mkdir -p /var/www/html/gl-review-apps/$REVIEW_APPS_PATH
- rsync -a --delete ./public/$REVIEW_APPS_PATH/. /var/www/html/gl-review-apps/$REVIEW_APPS_PATH/.
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://$APPS_DOMAIN/review-apps/$CI_PROJECT_PATH_SLUG/$CI_COMMIT_REF_SLUG
on_stop: stop_review
tags:
- review-apps
stop_review:
stage: review
variables:
GIT_STRATEGY: none
REVIEW_APPS_PATH: review-apps/$CI_PROJECT_PATH_SLUG/$CI_COMMIT_REF_SLUG
script:
- rm -rf public /var/www/html/gl-review-apps/$REVIEW_APPS_PATH
- rmdir --ignore-fail-on-non-empty /var/www/html/gl-review-apps/review-apps/$CI_PROJECT_PATH_SLUG/
dependencies: []
when: manual
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
tags:
- review-apps
include:
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
- bundle install
- bundle exec jekyll build
artifacts:
paths:
- _site
expire_in: 1d
Gemfile 0 → 100644
# frozen_string_literal: true
source "https://rubygems.org"
# git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# gem "rails"
# add jekyll as a dependency
gem "jekyll"
# add github pages
# gem "github-pages", group: :jekyll_plugins
GEM
remote: https://rubygems.org/
specs:
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
colorator (1.1.0)
concurrent-ruby (1.1.8)
em-websocket (0.5.2)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
eventmachine (1.2.7)
ffi (1.14.2)
forwardable-extended (2.6.0)
http_parser.rb (0.6.0)
i18n (1.8.9)
concurrent-ruby (~> 1.0)
jekyll (4.2.0)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.4.0)
pathutil (~> 0.9)
rouge (~> 3.0)
safe_yaml (~> 1.0)
terminal-table (~> 2.0)
jekyll-sass-converter (2.1.0)
sassc (> 2.0.1, < 3.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.3.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.4.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.6)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.4)
rouge (3.26.0)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.7.0)
PLATFORMS
ruby
DEPENDENCIES
jekyll
BUNDLED WITH
2.1.4
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