Skip to content
Snippets Groups Projects
.gitlab-ci.yml 5.92 KiB
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:
    - "[[ -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:
    - "[[ -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"

.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"