-
Notifications
You must be signed in to change notification settings - Fork 132
/
.gitlab-ci.yml
373 lines (341 loc) · 10.6 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
stages:
- pre_check
- static_analyzers
- build_openocd
- build_idf5.0.x
- build_idf5.1.x
- build_idf5.2.x
- build_idf_master
- build_nuttx
- test_idf5.0.x
- test_idf5.1.x
- test_idf5.2.x
- test_idf_master
- test_host
- test_nuttx
- coverage
- sanitizer_test_idf5.0.x
- sanitizer_test_idf5.1.x
- sanitizer_test_idf5.2.x
- sanitizer_test_idf_master
- sanitizer_test_nuttx
- sanitizer_check_idf5.0.x
- sanitizer_check_idf5.1.x
- sanitizer_check_idf5.2.x
- sanitizer_check_idf_master
- sanitizer_check_nuttx
- deploy
- private_deploy
- pre_release
- release_stage1
- release_submit
- update_idf_tools
image: $CI_DOCKER_REGISTRY/openocd-ci-env:1
default:
interruptible: true
retry: 2
variables:
#
# System environment
# Common parameters for the 'make' during CI tests
MAKEFLAGS: "-j4 --no-keep-going"
GCOV_BUILD_OPTS: ""
# OpenOCD configuration options
OPENOCD_CONFIGURE_OPTS: "--disable-doxygen-html --enable-remote-bitbang"
# GitHub Tool options
GITHUB_USER: "${GH_USER}"
GITHUB_REPO: "${GH_REPO}"
GITHUB_TOKEN: "${GH_TOKEN}"
#
# CI settings
# GIT_STRATEGY is not defined here, an option from "CI / CD Settings"- "General pipelines" is used.
GIT_SUBMODULE_STRATEGY: none
#
# Customization of jobs
DIST_ART_DIR: "dist"
DIST_INSTALLED_DIR: "${CI_PROJECT_NAME}"
ARCHIVE_TOOL: "tar czf"
ARCHIVE_EXT: "tar.gz"
RELEASE_DESC: "New release"
# prefix should be like a $CI_PROJECT_NAME, but we cannot use variable here
.release_tag_filter: &release_tag_filter
only:
- /^v[0-9].*$/
- /^openocd-esp32-.*$/
.release_binaries: &release_binaries
needs:
- job: build_linux
- job: build_linux_armhf
- job: build_linux_armel
- job: build_linux_arm64
- job: build_windows_win32
- job: build_windows_win64
- job: macos_codesign
.release_submit_action: &release_submit_action
image: espressif/github-hub:2
when: manual
allow_failure: true
before_script:
- set -o errexit; set -o pipefail; set -o nounset
- test "${DEBUG_SHELL:-''}" = "1" && set -x
- git remote remove github || true
- git remote add github ${GH_REPO_HTTPS}
variables:
GIT_STRATEGY: fetch
GH_REL_TAG: ${CI_COMMIT_TAG}
SHA256_FILE: openocd-esp32-${CI_COMMIT_TAG}-checksum.sha256
before_script:
- set -o errexit; set -o pipefail; set -o nounset
- test "${DEBUG_SHELL:-''}" = "1" && set -x
macos_codesign:
stage: pre_release
<<: *release_tag_filter
when: on_success
resource_group: macos_codesign
tags: [ "darwin", "codesign" ]
# list all jobs that produces macos distros
needs: [build_macos, build_macos_arm64]
artifacts:
paths:
- ${DIST_ART_DIR}
variables:
# directory with distro archives
DIST_ART_DIR: dist
# command to unarchive distro
UNARCHIVE_TOOL: "tar xzf"
# URL to macos codesign repo
NOTARIZATION_SCRIPTS_GIT: "${CI_SERVER_PROTOCOL}://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/espressif/macos_codesign_notarization.git"
script:
- git clone -q --depth=1 ${NOTARIZATION_SCRIPTS_GIT} -b ${CI_COMMIT_REF_NAME} ||
git clone -q --depth=1 ${NOTARIZATION_SCRIPTS_GIT}
- ./macos_codesign_notarization/run.sh
release_tag_draft:
stage: release_stage1
tags: [ "amd64", "internet" ]
<<: *release_tag_filter
<<: *release_submit_action
<<: *release_binaries
script:
- git remote remove github || true
- git remote add github ${GH_REPO_HTTPS}
- hub release show ${GH_REL_TAG} || { echo "Please create a release on GitHub with ${GH_REL_TAG} tag at first"; exit 1; }
# List of archives
- DIST_DIR=dist
- FILES=$(find ${DIST_DIR} -name dist_name_\* -exec cat {} \+)
- cd ${DIST_DIR}
- ls -l $FILES
# Generate checksum file
- >
for n in $FILES; do
sz=$(stat -c%s "${n}") >> ${SHA256_FILE};
printf "# %s: %s bytes\n" "${n}" "${sz}" >> ${SHA256_FILE};
sha256sum -b "${n}" >> ${SHA256_FILE};
done
# Append FILES with checksum file
- FILES=$(echo -e "${FILES}\n${SHA256_FILE}")
- ls -l $FILES
# Upload archives
- for n in ${FILES}; do hub release edit -m "" -a "${n}" "${GH_REL_TAG}"; done
Release_tag_submit:
stage: release_submit
tags: [ "amd64", "internet" ]
<<: *release_tag_filter
<<: *release_submit_action
script:
- hub release create -m "${RELEASE_DESC}" ${GH_REL_TAG}
Pre-Release_tag_submit:
stage: release_submit
tags: [ "amd64", "internet" ]
<<: *release_tag_filter
<<: *release_submit_action
script:
- hub release create --prerelease -m "${RELEASE_DESC}" ${GH_REL_TAG}
Delete_tag_release:
stage: release_submit
tags: [ "amd64", "internet" ]
<<: *release_tag_filter
<<: *release_submit_action
script:
- hub release delete ${GH_REL_TAG}
.use_ci_tools: &use_ci_tools |
curl -sSL ${CIT_LOADER_URL} -o cit_loader.sh && sh cit_loader.sh
source citools/import_functions
upload_to_http:
stage: private_deploy
when: manual
tags: [ "deploy", "shiny" ]
only:
- master
allow_failure: true
dependencies:
- build_linux_armhf
artifacts:
reports:
dotenv: build.env
before_script:
- *use_ci_tools
script:
- cit_add_ssh_key "${HTTP_UPLOAD_KEY}"
- ARCHIVE_NAME=$(cat ${DIST_ART_DIR}/dist_name_linux-armhf)
- pushd ${DIST_ART_DIR}
- scp ${ARCHIVE_NAME} ${HTTP_UPLOAD_DIR}/openocd/
- popd
- OOCD_DISTRO_URL=${HTTP_PUBLIC_DIR}/openocd/${ARCHIVE_NAME}
- echo "Archive was published there '${OOCD_DISTRO_URL}'"
- echo "NEW_OOCD_DISTRO_URL=${OOCD_DISTRO_URL}" >> build.env
.test_idf_examples:
stage: pre_release
when: manual
only:
- master
allow_failure: true
needs:
- job: upload_to_http
artifacts: true
variables:
OOCD_DISTRO_URL: ${NEW_OOCD_DISTRO_URL}
trigger:
project: espressif/esp-idf
strategy: depend
branch: ${IDF_TEST_BRANCH}
test_idf_master_examples:
extends:
- .test_idf_examples
variables:
BOT_LABEL_EXAMPLE_TEST: "1"
IDF_TEST_BRANCH: "master"
test_idf5.2.x_examples:
extends:
- .test_idf_examples
variables:
IDF_TEST_BRANCH: ${TEST_APP_IDF5_2_RELEASE_BRANCH}
test_idf5.1.x_examples:
extends:
- .test_idf_examples
variables:
IDF_TEST_BRANCH: ${TEST_APP_IDF5_1_RELEASE_BRANCH}
test_idf5.0.x_examples:
extends:
- .test_idf_examples
variables:
IDF_TEST_BRANCH: ${TEST_APP_IDF5_0_RELEASE_BRANCH}
create_coverage_reports:
stage: coverage
tags:
- build
allow_failure: true
artifacts:
paths:
- dist/lcov_all_report.tar.gz
- cov_infos/metrics.txt
- cov_infos/cobertura.xml
reports:
metrics: cov_infos/metrics.txt
coverage_report:
coverage_format: cobertura
path: cov_infos/cobertura.xml
when: always
expire_in: 1 week
needs:
# idf 5.0.x
- job: tests_armhf_esp32_idf5.0.x
- job: tests_armhf_esp32_idf5.0.x_flash_encrypted
- job: tests_armhf_esp32s2_idf5.0.x
- job: tests_armhf_esp32s2_idf5.0.x_flash_encrypted
- job: tests_armhf_esp32s3_idf5.0.x_dual
- job: tests_armhf_esp32s3_idf5.0.x_single
- job: tests_armhf_esp32c2_idf5.0.x
- job: tests_armhf_esp32c3_idf5.0.x
- job: tests_armhf_esp32c3_idf5.0.x_flash_encrypted
# idf 5.1.x
- job: tests_armhf_esp32_idf5.1.x
- job: tests_armhf_esp32_idf5.1.x_flash_encrypted
- job: tests_armhf_esp32s2_idf5.1.x
- job: tests_armhf_esp32s2_idf5.1.x_flash_encrypted
- job: tests_armhf_esp32s3_idf5.1.x_dual
- job: tests_armhf_esp32s3_idf5.1.x_single
- job: tests_armhf_esp32c2_idf5.1.x
- job: tests_armhf_esp32c3_idf5.1.x
- job: tests_armhf_esp32c3_idf5.1.x_flash_encrypted
- job: tests_armhf_esp32c6_idf5.1.x
- job: tests_armhf_esp32h2_idf5.1.x
# idf 5.2.x
- job: tests_armhf_esp32_idf5.2.x
- job: tests_armhf_esp32_idf5.2.x_flash_encrypted
- job: tests_armhf_esp32s2_idf5.2.x
- job: tests_armhf_esp32s2_idf5.2.x_flash_encrypted
- job: tests_armhf_esp32s3_idf5.2.x_dual
- job: tests_armhf_esp32s3_idf5.2.x_single
- job: tests_armhf_esp32c2_idf5.2.x
- job: tests_armhf_esp32c3_idf5.2.x
- job: tests_armhf_esp32c3_idf5.2.x_flash_encrypted
- job: tests_armhf_esp32c6_idf5.2.x
- job: tests_armhf_esp32h2_idf5.2.x
# idf master
- job: tests_armhf_esp32
- job: tests_armhf_esp32_flash_encrypted
- job: tests_armhf_esp32s2
- job: tests_armhf_esp32s2_flash_encrypted
- job: tests_armhf_esp32s3_dual
- job: tests_armhf_esp32s3_single
- job: tests_armhf_esp32c2
- job: tests_armhf_esp32c3
- job: tests_armhf_esp32c3_flash_encrypted
- job: tests_arm64_esp32c5
- job: tests_armhf_esp32c6
- job: tests_arm64_esp32c61
- job: tests_armhf_esp32h2
- job: tests_arm64_esp32p4
- job: test_nuttx_esp32
- job: test_nuttx_esp32s2
- job: test_nuttx_esp32s3
- job: test_nuttx_esp32c3
- job: test_nuttx_esp32c6
- job: test_nuttx_esp32h2
script:
- mkdir -p cov_infos
- mkdir -p dist
# Below lines copies all .info files into cov_infos folder
- >
folder_list=$(ls -d build_test_app*);
for each_folder in $folder_list ;
do
lcov --gcov-tool ${PWD}/${each_folder}/esp_cov_files/gcov --capture --directory ${each_folder}/esp_cov_files --output-file ${each_folder}/${each_folder}.info;
done
- cp `find . -wholename "./build_test_app*/*.info" -size +0` cov_infos
- ls -la cov_infos/
# Creating a html report of coverage files.
- genhtml --ignore-errors source cov_infos/*.info -o lcov_html_report/
- tar czf dist/lcov_all_report.tar.gz lcov_html_report/
# Below lines collecting all coverage file names with '-a' flag for lcov merge command.
- >
FILES="" ;
for each_file in cov_infos/*.info ;
do
FILES+=" -a ${each_file}" ;
done
- lcov ${FILES} -o cov_infos/merged.info
# Line in below creates a txt file from merged coverage file which includes coverage percentages.
- lcov --rc lcov_list_width=150 --list cov_infos/merged.info > cov_infos/metrics_input.txt
- python3 tools/list_to_metrics.py --file cov_infos/metrics_input.txt
- lcov_cobertura cov_infos/merged.info -o cov_infos/cobertura.xml
update_idf_tools:
stage: update_idf_tools
when: manual
allow_failure: true
<<: *release_tag_filter
variables:
TOOL_NAME: openocd
TOOL_MEMBERS: openocd-esp32
TOOL_VERSION: ${CI_COMMIT_TAG}
TOOL_SHA256_URL: https://github.com/espressif/openocd-esp32/releases/download/${CI_COMMIT_TAG}/openocd-esp32-${CI_COMMIT_TAG}-checksum.sha256
trigger:
project: idf/idf-tools-updater
strategy: depend
include:
- '.gitlab/ci/util.yml'
- '.gitlab/ci/build.yml'
- '.gitlab/ci/build-test-app.yml'
- '.gitlab/ci/test.yml'
- '.gitlab/ci/test-sanitizers.yml'
- '.gitlab/ci/pre-check.yml'