forked from openhwgroup/cva6
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
180 lines (159 loc) · 5.79 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Copyright 2022 Thales DIS design services SAS
#
# Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
# You may obtain a copy of the License at https://solderpad.org/licenses/
#
# Original Author: Yannick Casamatta ([email protected])
# Project maintainers must define following variables to adapt this CI to their runtime environment (Settings > CI/CD > Variables)
# - RUN_CORE_CI: 'true'/'false'
# - SETUP_CI_CORE_BRANCH: master
# - RUN_CORE_V_VERIF_CI: 'true'/'false'
# - SETUP_CI_CVV_BRANCH: master
# - RUN_EXTERNAL_CI: 'true'/'false'
# - SETUP_CI_BRANCH: master
# A git repository named "setup-ci" must be created in the same namespace as cva6 and must contain the following files:
# - 'cva6/cva6.yml' (if RUN_CORE_CI == 'true')
# - 'cva6/core-v-verif-cva6.yml' (if RUN_CVV_CI == 'true')
# - 'common/cva6.yml' (if $RUN_EXTERNAL_CI == 'true')
# Each of these files must at least contain the variables necessary for the execution of the associated downstream pipeline.
# Other elements such as new jobs can be added to overload the associated downstream pipeline included in this repository.
# Example for core-v-verif can be found in repository core-v-verif, path ".gitlab-ci/setup-ci-example/"
# Guidelines:
# - Prefer using parent-child pipelines instead of including yml for ease of maintenance.
# - Specific elements should be defined in the triggered yml to avoid conflicts between pipelines.
# - In this file, only generic job/variables should be declared.
include:
- project: '$CI_PROJECT_NAMESPACE/setup-ci'
ref: '$SETUP_CI_CVV_BRANCH'
file: 'cva6/cva6-core-v-verif.yml'
rules:
- if: '$RUN_CORE_V_VERIF_CI == "true"'
workflow:
rules:
- if: '$CI_WEIGHT == "forced"' #bypass workflow
- if: '$CI_COMMIT_REF_NAME =~ /^master.*|^hotfix.*|^rc.*|^github-pr.*/'
variables:
CI_WEIGHT: "full"
- if: '$CI_COMMIT_REF_NAME =~ /^dev.*|^feature.*/'
variables:
CI_WEIGHT: "short"
- if: '$CI_COMMIT_REF_NAME =~ /^cvvdev\/master.*|^cvvdev\/hotfix.*|^cvvdev\/rc.*/'
variables:
CI_WEIGHT: "full"
CORE_V_VERIF_BRANCH: $CI_COMMIT_REF_NAME
- if: '$CI_COMMIT_REF_NAME =~ /^cvvdev\/dev.*|^cvvdev\/feature.*/'
variables:
CI_WEIGHT: "lite"
CORE_V_VERIF_BRANCH: $CI_COMMIT_REF_NAME
- when: never
stages:
- build
- test
check_env:
variables:
GIT_STRATEGY: none
tags: [$TAGS_RUNNER]
before_script:
after_script:
stage: build
script:
- echo $TAGS_RUNNER
- echo $RUN_CORE_CI
- echo $SETUP_CI_CORE_BRANCH
- echo $RUN_CORE_V_VERIF_CI
- echo $SETUP_CI_CVV_BRANCH
- echo $RUN_EXTERNAL_CI
- echo $SETUP_CI_EXTERNAL_BRANCH
- echo $CORE_V_VERIF_REPO
- echo $CORE_V_VERIF_BRANCH
- echo $CI_COMMIT_REF_NAME
- echo $CI_COMMIT_BRANCH
# core testbench downstream pipeline describes in '.gitlab-ci/cva6.yml' + 'cva6/cva6.yml' of 'setup-ci' repository
# If enabled by RUN_CORE_CI
cva6:
stage: test
trigger:
include:
- local: .gitlab-ci/cva6.yml
- project: '$CI_PROJECT_NAMESPACE/setup-ci'
ref: '$SETUP_CI_CORE_BRANCH'
file: 'cva6/cva6.yml'
strategy: depend
variables:
TAGS_RUNNER: $TAGS_RUNNER
SETUP_CI_BRANCH: $SETUP_CI_CORE_BRANCH
CI_PROJECT_NAMESPACE: $CI_PROJECT_NAMESPACE
DASHBOARD: "cva6"
WORKFLOW_EVENT: $CI_PIPELINE_SOURCE
rules:
- if: $RUN_CORE_CI == "true"
when: always
- when: never
# Please read .gitlab-ci/cva6.yml in core-v-verif repository
# core testbench downstream pipeline describes in '.gitlab-ci/core-v-verif-cva6.yml' + 'cva6/core-v-verif-cva6.yml' of 'setup-ci' repository
# If enabled by RUN_CORE_V_VERIF_CI
# core-v-verif trigger job (see previous core-v-verif-build job)
core-v-verif-build:
stage: build
variables:
GIT_STRATEGY: none
tags: [$TAGS_RUNNER]
script:
- echo $CORE_V_VERIF_REPO
- echo $CORE_V_VERIF_BRANCH
- '[[ -e ./core-v-verif ]] && rm -rf core-v-verif'
- git clone $CORE_V_VERIF_REPO -b $CORE_V_VERIF_BRANCH --depth=1 core-v-verif
- cd core-v-verif
- echo CORE_V_VERIF_HASH=$(git rev-parse origin/$CORE_V_VERIF_BRANCH)
- echo CORE_V_VERIF_HASH=$(git rev-parse origin/$CORE_V_VERIF_BRANCH) > ../.env
- cd ..
- mkdir -p artifacts/.gitlab-ci/core_v_verif
- mv core-v-verif/.gitlab-ci/cva6.yml artifacts/.gitlab-ci/core_v_verif/cva6.yml
rules:
- if: '$RUN_CORE_V_VERIF_CI == "true"'
when: always
- when: never
artifacts:
paths:
- artifacts/.gitlab-ci/core_v_verif/cva6.yml
reports:
dotenv: .env
# core-v-verif trigger job (see previous core-v-verif-build job)
core-v-verif:
stage: test
trigger:
include:
- artifact: artifacts/.gitlab-ci/core_v_verif/cva6.yml
job: core-v-verif-build
- project: '$CI_PROJECT_NAMESPACE/setup-ci'
ref: '$SETUP_CI_CVV_BRANCH'
file: 'cva6/core-v-verif-cva6.yml'
- local: .gitlab-ci/core-v-verif-cva6.yml
strategy: depend
variables:
TAGS_RUNNER: $TAGS_RUNNER
SCOPE_CVV: "false"
CORE_V_VERIF_HASH: $CORE_V_VERIF_HASH
DASHBOARD: "cva6"
WORKFLOW_EVENT: $CI_PIPELINE_SOURCE
rules:
- if: '$RUN_CORE_V_VERIF_CI == "true"'
when: always
- when: never
# Use this entry point to run a pipeline from another repository (hosted on the same gitlab server)
# If enabled by RUN_SETUP_CI, additionnal variables may be necessary and should be declared by project maintainers.
external:
trigger:
include:
- project: '$CI_PROJECT_NAMESPACE/setup-ci'
ref: '$SETUP_CI_EXTERNAL_BRANCH'
file: 'common/cva6.yml'
strategy: depend
variables:
TAGS_RUNNER: $TAGS_RUNNER
rules:
- if: '$RUN_EXTERNAL_CI == "true"'
when: always
- when: never