forked from espressif/esptool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
175 lines (159 loc) · 6.64 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
# Gitlab CI config
#
# Note: When updating, please also update esptool_tests.yml GH Actions workflow file
stages:
- test
- report
# 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 esp32c3
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh coverage run --parallel-mode ${CI_PROJECT_DIR}/test/test_modules.py
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
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_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_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_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
combine_reports:
stage: report
before_script:
- ${CI_PROJECT_DIR}/test/ci/multirun_with_pyenv.sh python -m pip install -e .
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