forked from espressif/esptool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
321 lines (293 loc) · 11.3 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
# Gitlab CI config
#
# Note: When updating, please also update test_esptool.yml GH Actions workflow file
stages:
- rfc2217_test
- test
- report
- build_docs
- deploy_docs
# cache the pip download directory in all jobs
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"
cache:
paths:
- "$CI_PROJECT_DIR/pip-cache"
.test_template: &test_template
stage: test
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
tags:
- host_test
dependencies: []
version_check:
<<: *test_template
only:
- tags
script:
- VERSION=$(python esptool.py version | head -n 1)
- |
if [[ "$VERSION" != *"$CI_COMMIT_TAG" ]]
then
echo "Version number and git tag do not match!"
exit 1
fi
host_tests:
<<: *test_template
artifacts:
when: always
paths:
- "**/.coverage*"
- ".coverage*"
expire_in: 1 week
variables:
PYTHONPATH: "$PYTHONPATH:${CI_PROJECT_DIR}/test"
COVERAGE_PROCESS_START: "${CI_PROJECT_DIR}/test/.covconf"
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/setup.py build
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_imagegen.py
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espsecure.py
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_merge_bin.py
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espefuse_host.py esp32
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espefuse_host.py esp32s2
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espefuse_host.py esp32s3beta2
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espefuse_host.py esp32s3
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espefuse_host.py esp32c3
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_espefuse_host.py esp32h2beta1
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_modules.py
# some .coverage files in sub-directories are not collected on some runners, move them first
- find . -mindepth 2 -type f -name ".coverage*" -print -exec mv --backup=numbered {} . \;
check_python_style:
<<: *test_template
script:
# this step installs any 'dev' dependencies (ie flake8) that might be missing in the CI image.
# The runner should cache the downloads, so still quite fast.
- ./test/ci/multirun_with_pyenv.sh pip install --user -e .[dev]
- ./test/ci/multirun_with_pyenv.sh python -m flake8
# Check all the scripts can run when installed under all Python versions
check_installation_can_run:
<<: *test_template
artifacts:
when: always
paths:
- "**/.coverage*"
- ".coverage*"
expire_in: 1 week
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode setup.py install
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode esptool.py --help
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode espefuse.py --help
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode espsecure.py --help
# Check the stub can build and that a stub built in CI has the same contents
# as the one embedded in esptool
check_stub_build:
<<: *test_template
artifacts:
when: always
paths:
- flasher_stub/build/
- "**/.coverage*"
- ".coverage*"
expire_in: 1 week
variables:
# using this directory as the CI image probably already has an ESP32, ESP32S2, ESP32S3 and ESP32C3 toolchain downloaded into here
TOOLCHAIN_DIR: "/root/.espressif/dist"
ESP8266_BINDIR: "${TOOLCHAIN_DIR}/xtensa-lx106-elf/bin"
ESP32_BINDIR: "${TOOLCHAIN_DIR}/xtensa-esp32-elf/bin"
ESP32S2_BINDIR: "${TOOLCHAIN_DIR}/xtensa-esp32s2-elf/bin"
ESP32S3_BINDIR: "${TOOLCHAIN_DIR}/xtensa-esp32s3-elf/bin"
ESP32C3_BINDIR: "${TOOLCHAIN_DIR}/riscv32-esp-elf/bin"
TOOLCHAIN_PATHS: "${ESP8266_BINDIR}:${ESP32_BINDIR}:${ESP32S2_BINDIR}:${ESP32S3_BINDIR}:${ESP32C3_BINDIR}"
script:
- ./test/ci/setup_ci_build_env.sh
- make -C flasher_stub V=1 PATH="${TOOLCHAIN_PATHS}:${PATH}"
- cd flasher_stub && ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage run --parallel-mode ./compare_stubs.py
.target_esptool_test:
stage: test
image: $CI_DOCKER_REGISTRY/rpi-test-env$BOT_DOCKER_IMAGE_TAG
variables:
PYTHONPATH: "$PYTHONPATH:${CI_PROJECT_DIR}/test"
COVERAGE_PROCESS_START: "${CI_PROJECT_DIR}/test/.covconf"
before_script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh python -m pip install -e .
artifacts:
reports:
junit: test/report.xml
when: always
paths:
- test/*.out
- "**/.coverage*"
- ".coverage*"
expire_in: 1 week
# ESP8266
target_esptool_test_esp8266:
extends: .target_esptool_test
tags:
- esptool_esp8266_target
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_esptool.py /dev/serial_ports/ESP8266 esp8266 115200
target_rfc2217_test_esp8266:
extends: .target_esptool_test
stage: rfc2217_test
allow_failure: true
tags:
- esptool_esp8266_target
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_rfc2217.py /dev/serial_ports/ESP8266 esp8266 115200
# ESP32
target_esptool_test_esp32:
extends: .target_esptool_test
tags:
- esptool_esp32_target
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_esptool.py /dev/serial_ports/ESP32 esp32 115200
target_rfc2217_test_esp32:
extends: .target_esptool_test
stage: rfc2217_test
allow_failure: true
tags:
- esptool_esp32_target
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_rfc2217.py /dev/serial_ports/ESP32 esp32 115200
# ESP32S2
target_esptool_test_esp32s2:
extends: .target_esptool_test
tags:
- esptool_esp32s2_target
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_esptool.py /dev/serial_ports/ESP32S2 esp32s2 115200
target_rfc2217_test_esp32s2:
extends: .target_esptool_test
stage: rfc2217_test
allow_failure: true
tags:
- esptool_esp32s2_target
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_rfc2217.py /dev/serial_ports/ESP32S2 esp32s2 115200
target_esptool_test_esp32s2_usbcdc:
extends: .target_esptool_test
tags:
- esptool_esp32s2_cdc_target
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_esptool.py /dev/serial_ports/ESP32S2_USBCDC esp32s2 115200
target_rfc2217_test_esp32s2_usbcdc:
extends: .target_esptool_test
stage: rfc2217_test
allow_failure: true
tags:
- esptool_esp32s2_cdc_target
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_rfc2217.py /dev/serial_ports/ESP32S2 esp32s2 115200
# ESP32C3
target_esptool_test_esp32c3:
extends: .target_esptool_test
tags:
- esptool_esp32c3_target
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_esptool.py /dev/serial_ports/ESP32C3 esp32c3 115200
target_rfc2217_test_esp32c3:
extends: .target_esptool_test
stage: rfc2217_test
allow_failure: true
tags:
- esptool_esp32c3_target
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_rfc2217.py /dev/serial_ports/ESP32C3 esp32c3 115200
# ESP32S3
target_esptool_test_esp32s3:
extends: .target_esptool_test
tags:
- esptool_esp32s3_target
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_esptool.py /dev/serial_ports/ESP32S3 esp32s3 115200
target_rfc2217_test_esp32s3:
extends: .target_esptool_test
stage: rfc2217_test
allow_failure: true
tags:
- esptool_esp32s3_target
script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_rfc2217.py /dev/serial_ports/ESP32S3 esp32s3 115200
combine_reports:
stage: report
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
artifacts:
reports:
cobertura: cobertura_report.xml
when: always
paths:
- ".coverage*"
- cobertura_report.xml
- ./html_report/
expire_in: 1 week
variables:
LC_ALL: C.UTF-8
script:
# all .coverage files in sub-directories are moved to the parent dir first
- find . -mindepth 2 -type f -name ".coverage*" -print -exec mv --backup=numbered {} . \;
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage combine
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage report
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage html -d html_report
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh -p 3.4.8 coverage xml -o cobertura_report.xml
build_docs:
stage: build_docs
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env:v4.4-1-v4
tags:
- build_docs
only:
changes:
- "docs/**/*"
needs: []
artifacts:
when: always
paths:
- docs/_build/*/*/*.txt
- docs/_build/*/*/html/*
expire_in: 4 days
script:
- cd docs
- pip install -r requirements.txt
- build-docs -l en -t {esp8266,esp32,esp32s2,esp32c3,esp32s3}
.deploy_docs_template:
stage: deploy_docs
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env:v4.4-1-v4
tags:
- deploy
needs:
- build_docs
only:
changes:
- "docs/**/*"
script:
- source ${CI_PROJECT_DIR}/docs/utils.sh
- add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
- export GIT_VER=$(git describe --always)
- pip install -r ${CI_PROJECT_DIR}/docs/requirements.txt
- deploy-docs
deploy_docs_preview:
extends:
- .deploy_docs_template
except:
refs:
- master
variables:
TYPE: "preview"
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_DEPLOY_KEY"
DOCS_DEPLOY_SERVER: "$DOCS_SERVER"
DOCS_DEPLOY_SERVER_USER: "$DOCS_SERVER_USER"
DOCS_DEPLOY_PATH: "$DOCS_PATH"
DOCS_DEPLOY_URL_BASE: "https://$DOCS_PREVIEW_SERVER_URL/docs/esptool"
deploy_docs_production:
extends:
- .deploy_docs_template
only:
refs:
- master
variables:
TYPE: "production"
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PROD_DEPLOY_KEY"
DOCS_DEPLOY_SERVER: "$DOCS_PROD_SERVER"
DOCS_DEPLOY_SERVER_USER: "$DOCS_PROD_SERVER_USER"
DOCS_DEPLOY_PATH: "$DOCS_PROD_PATH"
DOCS_DEPLOY_URL_BASE: "https://docs.espressif.com/projects/esptool"