Skip to content
Snippets Groups Projects
Forked from EDP / MKDocs Template
51 commits behind the upstream repository.
.gitlab-ci.yml 13.04 KiB
### BEGIN MKDOCS TEMPLATE ###
### WARNING, DO NOT UPDATE CONTENT BETWEEN MKDOCS TEMPLATE TAG !###
### Modified content will be overwritten when updating.###
---
# GLOBAL CONFIGURATION
# =============================================================================
# YAML Anchors
# -----------------------------------------------------------------------------
# This CI file haevily make use of YAML anchors for multiple reasons:
#   - Avoid writing twice the same block of codes
#   - Resuse block of codes
#   - Make the CI more generic and easily extensible or modifiable
# See https://docs.gitlab.com/ee/ci/yaml/README.html#anchors

# Define base workflow
# https://docs.gitlab.com/ee/ci/yaml/README.html#workflow
workflow:
  rules:
    # Do not run CI when commit title have
    # WIP, NO-CI or 🚧 (gitmoji for "work in progress", aka :construction:)
    - if: $CI_COMMIT_TITLE =~ /.*(WIP|NO-CI|🚧|:construction:).*/
      when: never
    # Run the CI otherwise (depending on `rules` key per jobs)
    - when: always

# Stages jobs will pass through with anchors to avoid updating stage in multiple
# place within this file. Now renaming a stage can be done directly after the
# anchor name below.
# https://docs.gitlab.com/ee/ci/yaml/README.html#stage
stages:
  - &pre_test pre_test
  - &test test
  - &build build
  - &deploy deploy
  - &post_deploy post_deploy

# Global variables shared for all jobs
# https://docs.gitlab.com/ee/ci/yaml/README.html#variables
variables:
  PIP_CACHE_DIR: "${CI_PROJECT_DIR}/.cache/pip"

# Images anchors
# -----------------------------------------------------------------------------
# https://docs.gitlab.com/ee/ci/yaml/README.html#image
# Basic docker image -> docker:latest image
.image_docker: &image_docker
  image: docker:latest

# Before scripts anchors
# -----------------------------------------------------------------------------
# https://docs.gitlab.com/ee/ci/yaml/README.html#before_script
.before_script_python_dependencies: &before_script_python_dependencies
  # Add python dependencies
  - apk update
  # Install base package required for mkdocs builds
  - apk add --no-cache --update-cache
      build-base
      python3-dev
      py3-pip
      py3-virtualenv
      bash
      git
      gcc
  # Create virtual environment
  - virtualenv .venv
  # Activate virtual environment
  - source .venv/bin/activate

.before_script_prepare_deployment: &before_script_prepare_deployment
  # Add rsync dependencies