forked from Ngoguey42/tezos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
148 lines (128 loc) · 5.46 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
---
# General setup
default:
interruptible: true
# Basic configuration to guard against double-pipelines
workflow:
rules:
# This workflow entry allows pipelines for schedules events in which case it checks the
# CI_PIPELINE_SOURCE which is automatically set by Gitlab.
# See https://docs.gitlab.com/ee/ci/yaml/README.html#workflow for additional
# details.
- if: '$CI_PIPELINE_SOURCE == "schedule" && $TZ_SCHEDULE_KIND == "EXTENDED_TESTS"'
when: always
# Switch between branch pipelines and merge request pipelines.
# https://docs.gitlab.com/13.12/ee/ci/yaml/README.html#switch-between-branch-pipelines-and-merge-request-pipelines
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
when: never
# No branch pipelines outside of the tezos namespace, except for testing releases.
# The goal is to avoid triggering two pipelines for each MR:
# - one when pushing the branch, before the MR exists;
# - and one when the MR is created.
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != "latest-release-test" && $CI_PROJECT_NAMESPACE != "tezos"'
when: never
# This workflow entry allows pipelines for push events (including force-push, push of fixup commits, rebase, etc.)
- if: '$CI_PIPELINE_SOURCE == "push"'
when: always
- when: never # default
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: 25dac742bf06804f9fe91a8b38f98e12c9a4e80e
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"
# Image templates
.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:
# Common templates
- local: .gitlab/ci/jobs/shared/templates.yml
# Before merging
- local: .gitlab/ci/pipelines/before_merging.yml
rules:
- if: '($CI_PIPELINE_SOURCE == "merge_request_event") && ($CI_PROJECT_NAMESPACE == "tezos")'
# Latest release and test latest release
- local: .gitlab/ci/pipelines/latest_release.yml
rules:
- if: '($CI_COMMIT_BRANCH == "latest-release") && ($CI_PROJECT_NAMESPACE == "tezos")'
# Test latest release
- local: .gitlab/ci/pipelines/latest_release_test.yml
rules:
- if: '($CI_COMMIT_BRANCH == "latest-release-test") && ($CI_PROJECT_NAMESPACE != "tezos")'
# 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_COMMIT_TAG =~ /^v\d+\.\d+(?:\-rc\d+)?$/) && ($CI_PROJECT_NAMESPACE == "tezos")'
# Test release tag
- local: .gitlab/ci/pipelines/release_tag_test.yml
rules:
- if: '($CI_COMMIT_TAG =~ /^v\d+\.\d+(?:\-rc\d+)?$/) && ($CI_PROJECT_NAMESPACE != "tezos")'
# Scheduled pipeline for extended tests
- local: .gitlab/ci/pipelines/schedule_extended_test.yml
rules:
- if: '($CI_PIPELINE_SOURCE == "schedule") && ($TZ_SCHEDULE_KIND == "EXTENDED_TESTS")'