https://gitlab.com/tezos/tezos
Raw File
Tip revision: 05f407cdad802ec10e0c096baba67fd46f55a469 authored by Raphaël Cauderlier on 16 May 2023, 20:44:57 UTC
Vendor Ott
Tip revision: 05f407c
.gitlab-ci.yml
---

# General setup
default:
  interruptible: true

# Basic configuration to guard against double-pipelines
workflow:
  rules:
    # /!\ These rules should be kept in sync with the corresponding
    # 'if'-rules on the pipeline includes below.

    # Allow 'Before merging' pipelines
    - if: '($CI_PROJECT_NAMESPACE == "tezos") && ($CI_PIPELINE_SOURCE == "merge_request_event")'
    # Allow 'Latest release' pipelines
    - if: '($CI_PROJECT_NAMESPACE == "tezos") && ($CI_COMMIT_BRANCH == "latest-release")'
    # Allow 'Test latest release' pipelines for dry running latest
    # release pipelines in the nomadic-labs/tezos CI.
    - if: '($CI_PROJECT_NAMESPACE != "tezos") && ($CI_COMMIT_BRANCH == "latest-release-test")'
    # Allow 'Master branch' pipelines
    - if: '($CI_PROJECT_NAMESPACE == "tezos") && ($CI_COMMIT_BRANCH == "master")'
    # Allow 'Release tag' pipelines
    - if: '($CI_PROJECT_NAMESPACE == "tezos") && ($CI_COMMIT_TAG =~ /^v\d+\.\d+(?:\-rc\d+)?$/)'
    # Allow 'Beta release tag' pipelines
    - if: '($CI_PROJECT_NAMESPACE == "tezos") && ($CI_COMMIT_TAG =~ /^v\d+\.\d+\-beta\d*$/)'
    # Allow 'Test release tag' pipelines for dry running release tag
    # pipelines in the nomadic-labs/tezos CI.
    - if: '($CI_PROJECT_NAMESPACE != "tezos") && ($CI_COMMIT_TAG =~ /^v\d+\.\d+(?:\-(rc|beta)\d*)?$/)'
    # Allow 'Scheduled pipeline for extended tests' pipelines
    - if: '($CI_PIPELINE_SOURCE == "schedule") && ($TZ_SCHEDULE_KIND == "EXTENDED_TESTS")'
    # Disallow all other pipelines
    - when: never

variables:
  # /!\ CI_REGISTRY is overriden to use a private Docker registry mirror in AWS ECR
  # in GitLab namespaces `nomadic-labs` and `tezos`
  ## This value MUST be the same as `opam_repository_tag` in `scripts/version.sh`
  build_deps_image_version: 205530c16047066997bf2b210542ceeef8fb96d1
  build_deps_image_name: "${CI_REGISTRY}/tezos/opam-repository"
  GIT_STRATEGY: fetch
  GIT_DEPTH: "1"
  GET_SOURCES_ATTEMPTS: "2"
  ARTIFACT_DOWNLOAD_ATTEMPTS: "2"
  # Sets the number of tries before failing opam downloads.
  OPAMRETRIES: "5"

  # An addition to working around a bug in gitlab-runner's default
  # unzipping implementation (https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27496),
  # this setting cuts cache creation time.
  FF_USE_FASTZIP: "true"

  # If RUNTEZTALIAS is true, then Tezt tests are included in the @runtest
  # alias. We set it to false to deactivate these tests in the unit
  # test jobs, as they already run in the Tezt jobs. It is set to true
  # in the opam jobs where we want to run the tests --with-test.
  RUNTEZTALIAS: "false"

# Image templates
.image_template__runtime_build_e2etest_dependencies_template:
  image: ${build_deps_image_name}:runtime-build-e2etest-dependencies--${build_deps_image_version}

.image_template__runtime_build_test_dependencies_template:
  image: ${build_deps_image_name}:runtime-build-test-dependencies--${build_deps_image_version}

.image_template__runtime_build_dependencies_template:
  image: ${build_deps_image_name}:runtime-build-dependencies--${build_deps_image_version}

.image_template__runtime_prebuild_dependencies_template:
  image: ${build_deps_image_name}:runtime-prebuild-dependencies--${build_deps_image_version}

# Match GitLab executors version and directly use the Docker socket
# The Docker daemon is already configured, experimental features are enabled
# The following environment variables are already set:
# - BUILDKIT_PROGRESS
# - DOCKER_DRIVER
# - DOCKER_VERSION
# https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-socket-binding
.image_template__docker:
  # https://gitlab.com/tezos/docker-images/ci-docker
  image: "${CI_REGISTRY}/tezos/docker-images/ci-docker:v1.6.0"

.image_template__alpine:
  image: alpine:3.15

# The "manual" stage exists to fix a UI problem that occurs when mixing
# manual and non-manual jobs.
stages:
  - trigger
  - sanity
  - build
  - test
  - test_coverage
  - packaging
  - doc
  - prepare_release
  - publish_release_gitlab
  - publish_release
  - manual

# Trigger
#
# §1: The purpose of this job is to launch the CI manually in certain cases.
# The objective is not to run computing when it is not
# necessary and the decision to do so belongs to the developer
#
# §2: Gitlab CI needs at least one job definition, otherwise we're stuck with
# this error: 'Jobs config should contain at least one visible job'
trigger:
  extends:
    - .image_template__runtime_build_test_dependencies_template
  stage: trigger
  rules:
    - if: '($CI_PIPELINE_SOURCE == "merge_request_event") && ($CI_PROJECT_NAMESPACE == "tezos") && ($CI_MERGE_REQUEST_ASSIGNEES !~ /nomadic-margebot/)'
      when: manual
    - when: always
  allow_failure: false
  timeout: "10m"
  script:
    - echo 'Trigger pipeline 🤠'

include:
  # /!\ These rules should be kept in sync with the corresponding
  # 'if'-rules on the workflow rules above.

  # Common templates
  - local: .gitlab/ci/jobs/shared/templates.yml

  # Before merging
  - local: .gitlab/ci/pipelines/before_merging.yml
    rules:
      - if: '($CI_PROJECT_NAMESPACE == "tezos") && ($CI_PIPELINE_SOURCE == "merge_request_event")'

  # Latest release
  - local: .gitlab/ci/pipelines/latest_release.yml
    rules:
      - if: '($CI_PROJECT_NAMESPACE == "tezos") && ($CI_COMMIT_BRANCH == "latest-release")'

  # Test latest release
  - local: .gitlab/ci/pipelines/latest_release_test.yml
    rules:
      - if: '($CI_PROJECT_NAMESPACE != "tezos") && ($CI_COMMIT_BRANCH == "latest-release-test")'

  # Master branch
  - local: .gitlab/ci/pipelines/master_branch.yml
    rules:
      - if: '($CI_PROJECT_NAMESPACE == "tezos") && ($CI_COMMIT_BRANCH == "master")'

  # Release tag
  - local: .gitlab/ci/pipelines/release_tag.yml
    rules:
      - if: '($CI_PROJECT_NAMESPACE == "tezos") && ($CI_COMMIT_TAG =~ /^v\d+\.\d+(?:\-rc\d+)?$/)'

  # Beta release tag
  - local: .gitlab/ci/pipelines/beta_release_tag.yml
    rules:
      - if: '($CI_PROJECT_NAMESPACE == "tezos") && ($CI_COMMIT_TAG =~ /^v\d+\.\d+\-beta\d*$/)'

  # Test release tag
  - local: .gitlab/ci/pipelines/release_tag_test.yml
    rules:
      - if: '($CI_PROJECT_NAMESPACE != "tezos") && ($CI_COMMIT_TAG =~ /^v\d+\.\d+(?:\-(rc|beta)\d*)?$/)'

  # Scheduled pipeline for extended tests
  - local: .gitlab/ci/pipelines/schedule_extended_test.yml
    rules:
      - if: '($CI_PIPELINE_SOURCE == "schedule") && ($TZ_SCHEDULE_KIND == "EXTENDED_TESTS")'
back to top