forked from espressif/esp-iot-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
264 lines (216 loc) · 7.58 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
stages:
- build
- deploy
# global variables
variables: &global-variables
GIT_STRATEGY: clone
PYTHON_VER: 3
.before_script_preparation: &before_script_preparation
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $GITLAB_KEY >> ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
.setup_tools: &setup_tools
- git submodule update --init --recursive
- export IDF_PATH=$(pwd)/esp-idf
- source $IDF_PATH/tools/ci/configure_ci_environment.sh
- $IDF_PATH/tools/idf_tools.py --non-interactive install && eval "$($IDF_PATH/tools/idf_tools.py --non-interactive export)" || exit 1
- python $IDF_PATH/tools/idf_tools.py install-python-env
- pip install -r requirements.txt
.get_gateway_priv: &get_gateway_priv
- git clone ${GITLAB_PRIV_SRC_URL} components/gateway/priv_src
- cd components/gateway/priv_src
- git checkout ${CI_BUILD_REF_NAME} || echo "Using esp-gateway default branch"
- cd -
.build_gateway_esp32: &build_gateway_esp32
- echo -e "\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_SPI=y" >> sdkconfig.defaults.esp32
- idf.py set-target esp32
- idf.py build
- rm -rf build sdkconfig
- sed -i '$d' sdkconfig.defaults.esp32
- echo -e "\nCONFIG_LITEMESH_ENABLE=y\nCONFIG_GATEWAY_USE_WIFI_PROVISIONING_OVER_BLE=y" >> sdkconfig.defaults.esp32
- idf.py set-target esp32
- idf.py build
- rm -rf build sdkconfig
- sed -i '$d' sdkconfig.defaults.esp32
- echo -e "\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_ETHERNET=y\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_SDIO=y" >> sdkconfig.defaults.esp32
- idf.py set-target esp32
- idf.py build
.build_gateway_esp32c3: &build_gateway_esp32c3
- idf.py set-target esp32c3
- idf.py build
- rm -rf build sdkconfig
- echo -e "\nCONFIG_LITEMESH_ENABLE=y\nCONFIG_GATEWAY_EXTERNAL_NETIF_MODEM=y\nCONFIG_GATEWAY_USE_WIFI_PROVISIONING_OVER_BLE=y" >> sdkconfig.defaults.esp32c3
- idf.py set-target esp32c3
- idf.py build
- rm -rf build sdkconfig
- sed -i '$d' sdkconfig.defaults.esp32c3
- echo -e "\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_ETHERNET=y\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_SPI=y\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_SDIO=y" >> sdkconfig.defaults.esp32c3
- idf.py set-target esp32c3
- idf.py build
.build_gateway_esp32s2: &build_gateway_esp32s2
- idf.py set-target esp32s2
- idf.py build
- rm -rf build sdkconfig
- echo -e "\nCONFIG_LITEMESH_ENABLE=y\nCONFIG_GATEWAY_EXTERNAL_NETIF_MODEM=y" >> sdkconfig.defaults.esp32s2
- echo -e "\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_ETHERNET=y\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_SPI=y\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_SDIO=y" >> sdkconfig.defaults.esp32s2
- echo -e "\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_USB=y" >> sdkconfig.defaults.esp32s2
- idf.py set-target esp32s2
- idf.py build
.build_gateway_esp32s3: &build_gateway_esp32s3
- idf.py set-target esp32s3
- idf.py build
- rm -rf build sdkconfig
- echo -e "\nCONFIG_LITEMESH_ENABLE=y\nCONFIG_GATEWAY_EXTERNAL_NETIF_MODEM=y\nCONFIG_GATEWAY_USE_WIFI_PROVISIONING_OVER_BLE=y" >> sdkconfig.defaults.esp32s3
- idf.py set-target esp32s3
- idf.py build
- rm -rf build sdkconfig
- sed -i '$d' sdkconfig.defaults.esp32s3
- echo -e "\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_ETHERNET=y\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_SPI=y\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_SDIO=y" >> sdkconfig.defaults.esp32s3
- echo -e "\nCONFIG_GATEWAY_DATA_FORWARDING_NETIF_USB=y" >> sdkconfig.defaults.esp32s3
- idf.py set-target esp32s3
- idf.py build
esp32_v4.4_build:
stage: build
image: $CI_DOCKER_REGISTRY/esp-env:v4.4-1
tags:
- build
variables:
<<: *global-variables
before_script:
- *before_script_preparation
script:
- *get_gateway_priv
- git clone -b release/v4.4 --recursive ${GITLAB_SSH_SERVER}/espressif/esp-idf.git esp-idf
- *setup_tools
- *build_gateway_esp32
- cd examples/rainmaker/led_light
- idf.py set-target esp32
- idf.py build
esp32_v5.0_build:
stage: build
image: $CI_DOCKER_REGISTRY/esp-env-v5.0:2
tags:
- build
variables:
<<: *global-variables
before_script:
- *before_script_preparation
script:
- *get_gateway_priv
- git clone -b release/v5.0 --recursive ${GITLAB_SSH_SERVER}/espressif/esp-idf.git esp-idf
- *setup_tools
- *build_gateway_esp32
esp32c3_v4.4_build:
stage: build
image: $CI_DOCKER_REGISTRY/esp-env:v4.4-1
tags:
- build
variables:
<<: *global-variables
before_script:
- *before_script_preparation
script:
- *get_gateway_priv
- git clone -b release/v4.4 --recursive ${GITLAB_SSH_SERVER}/espressif/esp-idf.git esp-idf
- *setup_tools
- *build_gateway_esp32c3
- cd examples/rainmaker/led_light
- idf.py set-target esp32c3
- idf.py build
esp32c3_v5.0_build:
stage: build
image: $CI_DOCKER_REGISTRY/esp-env-v5.0:2
tags:
- build
variables:
<<: *global-variables
before_script:
- *before_script_preparation
script:
- *get_gateway_priv
- git clone -b release/v5.0 --recursive ${GITLAB_SSH_SERVER}/espressif/esp-idf.git esp-idf
- *setup_tools
- *build_gateway_esp32c3
esp32s2_v4.4_build:
stage: build
image: $CI_DOCKER_REGISTRY/esp-env:v4.4-1
tags:
- build
variables:
<<: *global-variables
before_script:
- *before_script_preparation
script:
- *get_gateway_priv
- git clone -b release/v4.4 --recursive ${GITLAB_SSH_SERVER}/espressif/esp-idf.git esp-idf
- *setup_tools
- *build_gateway_esp32s2
esp32s2_v5.0_build:
stage: build
image: $CI_DOCKER_REGISTRY/esp-env-v5.0:2
tags:
- build
variables:
<<: *global-variables
before_script:
- *before_script_preparation
script:
- *get_gateway_priv
- git clone -b release/v5.0 --recursive ${GITLAB_SSH_SERVER}/espressif/esp-idf.git esp-idf
- *setup_tools
- *build_gateway_esp32s2
esp32s3_v4.4_build:
stage: build
image: $CI_DOCKER_REGISTRY/esp-env:v4.4-1
tags:
- build
variables:
<<: *global-variables
before_script:
- *before_script_preparation
script:
- *get_gateway_priv
- git clone -b release/v4.4 --recursive ${GITLAB_SSH_SERVER}/espressif/esp-idf.git esp-idf
- *setup_tools
- *build_gateway_esp32s3
- cd examples/rainmaker/led_light
- idf.py set-target esp32s3
- idf.py build
esp32s3_v5.0_build:
stage: build
image: $CI_DOCKER_REGISTRY/esp-env-v5.0:2
tags:
- build
variables:
<<: *global-variables
before_script:
- *before_script_preparation
script:
- *get_gateway_priv
- git clone -b release/v5.0 --recursive ${GITLAB_SSH_SERVER}/espressif/esp-idf.git esp-idf
- *setup_tools
- *build_gateway_esp32s3
push_master_to_github:
stage: deploy
only:
- master
# when: on_success
image: $CI_DOCKER_REGISTRY/esp32-ci-env
variables:
GIT_STRATEGY: clone
GITHUB_PUSH_REFS: refs/remotes/origin/release refs/remotes/origin/master
before_script:
- echo "skip default before_script"
script:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- if [ -d "components/gateway/priv_src" ]; then exit 1; fi
- git remote add github [email protected]:espressif/esp-gateway.git
- eval $(git for-each-ref --shell bash --format 'if [ $CI_BUILD_REF == %(objectname) ]; then git checkout -B %(refname:strip=3); git push --follow-tags github %(refname:strip=3); fi;' $GITHUB_PUSH_REFS)