forked from espressif/esp-serial-flasher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
233 lines (216 loc) · 6.88 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
stages:
- pre_check
- build
- test
- deploy
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- if: "$CI_COMMIT_BRANCH"
variables:
STM32_CUBE_H7_REPO: https://github.com/STMicroelectronics/STM32CubeH7
STM32_CUBE_H7_REPO_TAG: v1.11.1
ARM_TOOLCHAIN_URL: https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz?rev=e434b9ea4afc4ed7998329566b764309&hash=CA590209F5774EE1C96E6450E14A3E26
QEMU_PATH: /opt/qemu/bin/qemu-system-xtensa
ZEPHYR_REPO: https://github.com/zephyrproject-rtos/zephyr.git
ZEPHYR_REPO_REV: v3.5.0
ZEPHYR_TOOLCHAIN: https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.3/toolchain_linux-x86_64_xtensa-espressif_esp32_zephyr-elf.tar.xz
ZEPHYR_SDK: https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.3/zephyr-sdk-0.16.3_linux-aarch64_minimal.tar.xz
PI_PICO_SDK_REV: 1.5.1
PI_PICO_SDK: https://github.com/raspberrypi/pico-sdk
run_pre_commit:
stage: pre_check
image: python:3.11-bookworm
tags:
- internet
script:
- apt-get update
- pip install pre-commit
- git fetch origin master
- pre-commit run --show-diff-on-failure --from-ref origin/master --to-ref HEAD
check_stub_source_correctness:
stage: pre_check
image: espressif/idf:v5.2.2
tags:
- internet
script:
- cd $CI_PROJECT_DIR/examples/esp32_stub_example
- idf.py reconfigure -DSERIAL_FLASHER_STUB_PULL_VERSION='0.3.0'
- git diff --exit-code
.build_idf_template:
stage: build
tags:
- build
- internet
before_script:
- pip install -U idf-build-apps
variables:
PEDANTIC_FLAGS: "-Werror -Wall -Wextra"
EXTRA_CFLAGS: "${PEDANTIC_FLAGS}"
EXTRA_CXXFLAGS: "${PEDANTIC_FLAGS}"
BUILD_DIR: "build"
script:
- python -m idf_build_apps build -v -p .
--recursive
--exclude ./examples/binaries
--config "sdkconfig.defaults*"
--build-dir ${BUILD_DIR}
--check-warnings
build_idf_v4.3:
image: espressif/idf:release-v4.3
stage: build
tags:
- build
- internet
before_script:
- pip install -U idf-build-apps
variables:
PEDANTIC_FLAGS: "-Werror -Wall -Wextra"
EXTRA_CFLAGS: "${PEDANTIC_FLAGS}"
EXTRA_CXXFLAGS: "${PEDANTIC_FLAGS}"
BUILD_DIR: "build"
script:
- python -m idf_build_apps build -v -p .
--recursive
--exclude ./examples/binaries
--target "esp32"
--config "sdkconfig.defaults*"
--build-dir ${BUILD_DIR}
--check-warnings
build_idf_v4.4:
image: espressif/idf:release-v4.4
extends: .build_idf_template
build_idf_v5.0:
image: espressif/idf:release-v5.0
extends: .build_idf_template
build_idf_v5.1:
image: espressif/idf:release-v5.1
extends: .build_idf_template
build_idf_v5.2:
image: espressif/idf:release-v5.2
extends: .build_idf_template
build_idf_v5.3:
image: espressif/idf:release-v5.3
variables:
BUILD_DIR: "build_stable"
artifacts:
paths:
- "**/build*/*.bin"
- "**/build*/*.elf"
- "**/build*/*.map"
- "**/build*/flasher_args.json"
- "**/build*/flash_project_args"
- "**/build*/config/sdkconfig.json"
- "**/build*/bootloader/*.bin"
- "**/build*/partition_table/*.bin"
when: always
expire_in: 3 days
extends: .build_idf_template
build_idf_master:
image: espressif/idf:latest
variables:
BUILD_DIR: "build_master"
artifacts:
paths:
- "**/build*/*.bin"
- "**/build*/*.elf"
- "**/build*/*.map"
- "**/build*/flasher_args.json"
- "**/build*/flash_project_args"
- "**/build*/config/sdkconfig.json"
- "**/build*/bootloader/*.bin"
- "**/build*/partition_table/*.bin"
when: always
expire_in: 3 days
extends: .build_idf_template
build_stm32:
stage: build
# IDF is not necessary for STM32 build, but this image is already used in another job
# and it comes with a recent enough CMake version.
image: espressif/idf:latest
tags:
- build
- internet
script:
- cd $CI_PROJECT_DIR
- git submodule update --init
- git clone --depth=1 -b ${STM32_CUBE_H7_REPO_TAG} ${STM32_CUBE_H7_REPO}
- wget --no-verbose -O gcc-arm-none-eabi.tar.xz ${ARM_TOOLCHAIN_URL}
- tar xf gcc-arm-none-eabi.tar.xz
- mv arm-gnu-toolchain-* gcc-arm-none-eabi
- mkdir $CI_PROJECT_DIR/examples/stm32_example/build
- cd $CI_PROJECT_DIR/examples/stm32_example/build
- cmake -DSTM32_TOOLCHAIN_PATH=$CI_PROJECT_DIR/gcc-arm-none-eabi -DSTM32_CUBE_H7_PATH=$CI_PROJECT_DIR/STM32CubeH7 -G Ninja ..
- cmake --build .
build_zephyr:
stage: build
image: espressif/idf:latest
tags:
- build
- internet
script:
- mkdir $CI_PROJECT_DIR/zephyrproject-rtos
- cd $CI_PROJECT_DIR/zephyrproject-rtos
- git clone --single-branch --depth=1 -b ${ZEPHYR_REPO_REV} ${ZEPHYR_REPO}
- mkdir $CI_PROJECT_DIR/zephyrproject-rtos/zephyr-sdk
- cd $CI_PROJECT_DIR/zephyrproject-rtos/zephyr-sdk
- wget --no-verbose -O zephyr_sdk.tar.xz ${ZEPHYR_SDK}
- tar xvf zephyr_sdk.tar.xz --strip-components=1
- wget --no-verbose -O esp32_toolchain.tar.xz ${ZEPHYR_TOOLCHAIN}
- tar xvf esp32_toolchain.tar.xz
- export ZEPHYR_SDK_INSTALL_DIR=$(pwd)
- export ZEPHYR_TOOLCHAIN_VARIANT="zephyr"
- cd $CI_PROJECT_DIR/zephyrproject-rtos/zephyr
- export ZEPHYR_BASE=$(pwd)
- pip install -r scripts/requirements.txt
- pip install wheel
- if [[ ! -d "$CI_PROJECT_DIR/zephyrproject-rtos/.west" ]]; then
- west init -l .
- fi
- unset IDF_PATH
- west zephyr-export
- west update hal_espressif
- west build -p -b esp32_devkitc_wroom $CI_PROJECT_DIR/examples/zephyr_example -DZEPHYR_EXTRA_MODULES=$CI_PROJECT_DIR
build_pi_pico:
stage: build
image: espressif/idf:latest
tags:
- build
- internet
script:
- git clone --single-branch --depth=1 -b ${PI_PICO_SDK_REV} ${PI_PICO_SDK}
- export PICO_SDK_PATH=$(pwd)/pico-sdk
- wget --no-verbose -O gcc-arm-none-eabi.tar.xz ${ARM_TOOLCHAIN_URL}
- tar xf gcc-arm-none-eabi.tar.xz
- mv arm-gnu-toolchain-* gcc-arm-none-eabi
- export PATH="$(pwd)/gcc-arm-none-eabi/bin:$PATH"
- cd $CI_PROJECT_DIR/examples/pi_pico_example
- mkdir build
- cd build
- cmake ..
- cmake --build .
run_tests:
stage: test
image: ${CI_DOCKER_REGISTRY}/qemu:esp-develop-20191124
tags:
- build
- internet
script:
- cd $CI_PROJECT_DIR/test
- export QEMU_PATH=/opt/qemu/bin/qemu-system-xtensa
- ./run_test.sh qemu
- ./run_test.sh host
push_to_the_components_registry:
stage: deploy
image: python:3.11-bookworm
tags:
- build
- internet
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$FORCE_PUSH_COMPONENT == "1"'
script:
- pip install idf-component-manager
- compote component upload --allow-existing --name=esp-serial-flasher --namespace=espressif