Skip to content
Snippets Groups Projects
.gitlab-ci.yml 6.32 KiB
image: ruby:3.0

stages:
  - build
  - test
  - review
  - accessibility
  - deploy

.artifacts_extension:
  artifacts:
    paths:
      - public
    expire_in: 1d

.cache_latest: &cache_latest
  cache:
    key: latest
    paths:
      - vendor/bundle
      - assets/img/jumbotrons

.cache_production: &cache_production
  cache:
    key: production
    paths:
      - vendor/bundle
      - assets/img/jumbotrons

.common_production: &production_before_script
  before_script:
    - "[[ -x \"$(command -v apt-get)\" ]] && \
          apt-get update && \
          apt-get install -y ffmpeg"
    - gem install bundler --no-document
    - bundle config set without 'test'
    - bundle install --jobs $(nproc)
  <<: *cache_production

.common_latest: &latest_before_script
  before_script:
    - "[[ -x \"$(command -v apt-get)\" ]] && \
          apt-get update && \
          apt-get install -y ffmpeg"
    - "[[ -f \"Gemfile.lock\" ]] && rm Gemfile.lock"
    - bundle config set without 'test'
    - bundle install --jobs $(nproc) --without test "${FLAGS[@]}"
    - bundle update --jobs $(nproc) "${FLAGS[@]}"
  <<: *cache_latest

.common_variables: &common_variables
  GIT_SUBMODULE_STRATEGY: recursive
  SUBPATH: "/"
  BUNDLE_PATH: vendor/bundle
  NOKOGIRI_USE_SYSTEM_LIBRARIES: "1"

.builds: &builds
  stage: build
  variables:
    <<: *common_variables
  script:
    - "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