forked from espressif/openocd-esp32
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
257 lines (227 loc) · 6.57 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
stages:
- build
- test
- sanitizer_tests
- sanitizer_checks
- deploy
- private_deploy
- pre_release
- release_stage1
- release_submit
image: $CI_DOCKER_REGISTRY/esp32-toolchain
variables:
#
# System environment
# Common parameters for the 'make' during CI tests
MAKEFLAGS: "-j4 --no-keep-going"
# OpenOCD configuration options
OPENOCD_CONFIGURE_OPTS: "--disable-doxygen-html --disable-doxygen-pdf --enable-ftdi --enable-jlink --enable-ulink"
# 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"
GH_TOOL_NAME: github-release
GH_TOOL: "./${DIST_ART_DIR}/${GH_TOOL_NAME}"
RELEASE_DESC: "New release"
#
# default variables
ESP_TOOLCHAIN: "${ESP_TOOLCHAIN_VER}"
TOOLCHAIN_PREFIX: "xtensa-esp32"
CHIP_NAME: "esp32"
TEST_APP_IDF_TAG: $CI_COMMIT_REF_NAME
.add_gh_key_remote: &add_gh_key_remote |
command -v ssh-agent >/dev/null || exit 1
eval $(ssh-agent -s)
printf '%s\n' "${GH_PUSH_KEY}" | tr -d '\r' | ssh-add - > /dev/null
mkdir -p ~/.ssh && chmod 700 ~/.ssh
[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config || ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
git remote remove github || true
git remote add github ${GH_PUSH_REPO}
.gh_getting_tool: &gh_getting_tool |
# do not download if it was installed locally
LOCAL_TOOL_PATH=$(command -v ${GH_TOOL_NAME}) && cp ${LOCAL_TOOL_PATH} . || wget --no-verbose -O $GH_TOOL_NAME $GH_TOOL_URL
chmod +x ./$GH_TOOL_NAME
.gh_upload_archive: &gh_upload_archive |
ARCHIVE_NAME=$(cat ${DIST_ART_DIR}/dist_name_${PLATFORM_NAME})
echo Release ${GH_REL_TAG}, file ${ARCHIVE_NAME}
${GH_TOOL} upload -s ${GITHUB_TOKEN} --tag ${GH_REL_TAG} -f ${DIST_ART_DIR}/${ARCHIVE_NAME} -n ${ARCHIVE_NAME}
# 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_submit_action: &release_submit_action
when: manual
allow_failure: true
before_script:
- set -o errexit; set -o pipefail; set -o nounset
- test "${DEBUG_SHELL:-''}" = "1" && set -x
osx_code_sign:
stage: pre_release
<<: *release_tag_filter
when: on_success
tags:
- macos_shell
dependencies:
- build_macos
artifacts:
paths:
- ${DIST_ART_DIR}
script:
- ARCHIVE_NAME=$(cat ${DIST_ART_DIR}/dist_name_macos)
- tar -xzf ${DIST_ART_DIR}/$ARCHIVE_NAME -C ${DIST_ART_DIR} && rm ${DIST_ART_DIR}/$ARCHIVE_NAME
- export TARGET_BINARY="${DIST_ART_DIR}/openocd-esp32/bin/openocd"
- $PWD/tools/codesign.sh
- $PWD/tools/notarize.sh
- cd ${DIST_ART_DIR}
- ${ARCHIVE_TOOL} ${ARCHIVE_NAME} openocd-esp32/
- rm -r openocd-esp32/
push_master_to_github:
stage: deploy
image: $CI_DOCKER_REGISTRY/esp32-ci-env
only:
- master
when: on_success
dependencies: []
variables:
GIT_STRATEGY: clone
script:
- *add_gh_key_remote
- git push github HEAD:master
get_gh_tools:
stage: test
<<: *release_tag_filter
artifacts:
paths:
- ${DIST_ART_DIR}
variables:
GIT_STRATEGY: none
script:
- *gh_getting_tool
- mkdir -p ${DIST_ART_DIR}
- mv ${GH_TOOL_NAME} ${DIST_ART_DIR}/
release_tag_draft:
stage: release_stage1
<<: *release_tag_filter
when: on_success
script:
- *add_gh_key_remote
- git push github --force ${CI_COMMIT_TAG}
# release draft
- ${GH_TOOL} delete -s ${GITHUB_TOKEN} --tag ${CI_COMMIT_TAG} || true
- ${GH_TOOL} release -s ${GITHUB_TOKEN} --tag ${CI_COMMIT_TAG} --description "${RELEASE_DESC}" --draft
- GH_REL_TAG=${CI_COMMIT_TAG}
# Upload archives
- PLATFORM_NAME="linux-amd64"
- *gh_upload_archive
- PLATFORM_NAME="linux-armel"
- *gh_upload_archive
- PLATFORM_NAME="linux-armhf"
- *gh_upload_archive
- PLATFORM_NAME="linux-arm64"
- *gh_upload_archive
- PLATFORM_NAME="win32"
- *gh_upload_archive
- PLATFORM_NAME="macos"
- *gh_upload_archive
Release_tag_submit:
stage: release_submit
<<: *release_tag_filter
<<: *release_submit_action
dependencies:
- get_gh_tools
variables:
GIT_STRATEGY: none
script:
- ${GH_TOOL} edit -s ${GITHUB_TOKEN} --tag ${CI_COMMIT_TAG} --description "${RELEASE_DESC}"
Pre-Release_tag_submit:
stage: release_submit
<<: *release_tag_filter
<<: *release_submit_action
dependencies:
- get_gh_tools
variables:
GIT_STRATEGY: none
script:
- ${GH_TOOL} edit -s ${GITHUB_TOKEN} --tag ${CI_COMMIT_TAG} --description "${RELEASE_DESC}" --pre-release
Delete_tag_release:
stage: release_submit
<<: *release_tag_filter
<<: *release_submit_action
dependencies:
- get_gh_tools
variables:
GIT_STRATEGY: none
script:
- ${GH_TOOL} delete -s ${GITHUB_TOKEN} --tag ${CI_COMMIT_TAG} || true
.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_armel
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-armel)
- 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
variables:
OOCD_DISTRO_URL: ${NEW_OOCD_DISTRO_URL}
needs:
- job: upload_to_http
artifacts: true
trigger:
project: espressif/esp-idf
strategy: depend
test_premajor_idf_rel_examples:
stage: pre_release
when: manual
only:
- master
allow_failure: true
variables:
OOCD_DISTRO_URL: ${NEW_OOCD_DISTRO_URL}
needs:
- job: upload_to_http
artifacts: true
trigger:
project: espressif/esp-idf
branch: ${TEST_APP_PREMAJOR_IDF_RELEASE_BRANCH}
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'