forked from espressif/esp-thread-br
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
executable file
·224 lines (203 loc) · 6.36 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
stages:
- build
- docs
variables:
CI_DOCKER_REGISTRY: "ciregistry.espressif.cn:8443"
ESP_THREAD_BR_PATH: "$CI_PROJECT_DIR"
CI_TOOLS_PATH: "$CI_PROJECT_DIR/tools/ci"
ESP_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-env-v5.3:1"
before_script:
- 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
pre_commit:
stage: .pre
image: "$CI_DOCKER_REGISTRY/esp-idf-pre-commit:1"
script:
- echo "Merge request is from ${CI_COMMIT_REF_NAME} into main"
- git fetch origin main ${CI_COMMIT_REF_NAME}
- export from_sha=$(git merge-base HEAD origin/main)
- echo "Checking changes from ${from_sha} to ${CI_COMMIT_SHA}:"
- git log --oneline ${from_sha}..${CI_COMMIT_SHA}
- echo "Modified files:"
- git diff-tree --no-commit-id --name-only -r ${from_sha} ${CI_COMMIT_SHA}
- echo "Running pre-commit:"
- pre-commit run --from ${from_sha} --to ${CI_COMMIT_SHA}
except:
- main
tags:
- host_test
.submodule_update: &submodule_update
- cd $ESP_THREAD_BR_PATH
- git submodule update --init --recursive
.setup_idf: &setup_idf
- cd $CI_PROJECT_DIR
- git clone --recursive -b master ${IDF_GIT_REPO_URL}
- cd esp-idf
- git checkout --track origin/$CI_COMMIT_REF_NAME || git branch
- git submodule update --recursive --init
- git rev-parse HEAD
- ./install.sh
- . ./export.sh
.build_basic_thread_border_router: &build_basic_thread_border_router
- cd $IDF_PATH/examples/openthread/ot_rcp
- idf.py set-target esp32h2
- git rev-parse HEAD
- idf.py build
- cd $ESP_THREAD_BR_PATH/examples/basic_thread_border_router
- idf.py build
.build_local_components: &build_local_components
- cd $IDF_PATH/examples/openthread/ot_rcp
- idf.py set-target esp32h2
- git rev-parse HEAD
- idf.py build
- cd $ESP_THREAD_BR_PATH/examples/basic_thread_border_router
- rm -rf main/idf_component.yml
- cp ${CI_TOOLS_PATH}/idf_component_local.yml main/idf_component.yml
- idf.py build
.build_idf_example_ot_br: &build_idf_example_ot_br
- cd $IDF_PATH/examples/openthread/ot_br/main
- rm -rf idf_component.yml
- cp ${CI_TOOLS_PATH}/idf_component_otbr.yml idf_component.yml
- cd ..
- rm -rf CMakeLists.txt
- cp ${CI_TOOLS_PATH}/ot_br.cmake CMakeLists.txt
- idf.py set-target esp32s3
- idf.py build
- idf.py set-target esp32c6
- idf.py build
.build_idf_example_ot_br_autostart: &build_idf_example_ot_br_autostart
- cd $IDF_PATH/examples/openthread/ot_br/main
- rm -rf idf_component.yml
- cp ${CI_TOOLS_PATH}/idf_component_otbr.yml idf_component.yml
- cd ..
- rm -rf CMakeLists.txt
- cp ${CI_TOOLS_PATH}/ot_br.cmake CMakeLists.txt
- rm -rf sdkconfig.defaults
- cp ${CI_TOOLS_PATH}/sdkconfig.br.autostart sdkconfig.defaults
- idf.py set-target esp32s3
- idf.py build
- idf.py set-target esp32c6
- idf.py build
.build_idf_example_ot_cli: &build_idf_example_ot_cli
- cd $IDF_PATH/examples/openthread/ot_cli/main
- rm -rf idf_component.yml
- cp ${CI_TOOLS_PATH}/idf_component_otcli.yml idf_component.yml
- cd ..
- rm -rf CMakeLists.txt
- cp ${CI_TOOLS_PATH}/ot_cli.cmake CMakeLists.txt
- idf.py set-target esp32c6
- idf.py build
- idf.py set-target esp32h2
- idf.py build
build_examples:
stage: build
image: espressif/idf:latest
script:
- *submodule_update
- *build_basic_thread_border_router
tags:
- build
# allow failure if esp_ot_cli_extension version updated but haven't publish to component registry yet
allow_failure: true
build_examples_local_components:
stage: build
image: $ESP_ENV_IMAGE
script:
- *submodule_update
- *setup_idf
- *build_local_components
tags:
- build
build_idf_otbr_examples:
stage: build
image: $ESP_ENV_IMAGE
allow_failure: true
script:
- *setup_idf
- *build_idf_example_ot_br
tags:
- build
build_idf_otbr_autostart_examples:
stage: build
image: $ESP_ENV_IMAGE
allow_failure: true
script:
- *setup_idf
- *build_idf_example_ot_br_autostart
tags:
- build
build_idf_otcli_examples:
stage: build
image: $ESP_ENV_IMAGE
allow_failure: true
script:
- *setup_idf
- *build_idf_example_ot_cli
tags:
- build
build_docs:
stage: build
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.0:2-3
variables:
ESP_DOCS_LATEST_BRANCH_NAME: "main"
artifacts:
when: always
paths:
- docs/_build/*/*/*.txt
- docs/_build/*/*/html/*
expire_in: 1 days
script:
- cd docs
- pip install -r requirements.txt
- build-docs -l en
tags:
- build_docs
.deploy_docs_template:
stage: docs
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.0:2-3
needs:
- build_docs
variables:
ESP_DOCS_LATEST_BRANCH_NAME: "main"
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
tags:
- deploy
deploy_docs_preview:
extends:
- .deploy_docs_template
except:
- main
- /^release\/v/
- /^v\d+\.\d+/
variables:
TYPE: "preview"
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
DOCS_DEPLOY_PATH: "$DOCS_PREVIEW_PATH"
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PREVIEW_DEPLOY_KEY"
DOCS_DEPLOY_SERVER: "$DOCS_PREVIEW_SERVER"
DOCS_DEPLOY_SERVER_USER: "$DOCS_PREVIEW_SERVER_USER"
DOCS_DEPLOY_URL_BASE: "https://$DOCS_PREVIEW_SERVER/projects/esp-thread-br"
deploy_docs_production:
extends:
- .deploy_docs_template
only:
- main
- /^release\/v/
- /^v\d+\.\d+/
variables:
TYPE: "preview"
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
DOCS_DEPLOY_PATH: "$DOCS_PROD_PATH"
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PROD_DEPLOY_KEY"
DOCS_DEPLOY_SERVER: "$DOCS_PROD_SERVER"
DOCS_DEPLOY_SERVER_USER: "$DOCS_PROD_SERVER_USER"
DOCS_DEPLOY_URL_BASE: "https://docs.espressif.com/projects/esp-thread-br"