forked from espressif/ESP8266_RTOS_SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
185 lines (165 loc) · 5.38 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
stages:
- build
- deploy
variables:
GIT_STRATEGY: clone
IDF_PATH: "$CI_PROJECT_DIR"
# before each job, we need to check if this job is filtered by bot stage/job filter
.apply_bot_filter: &apply_bot_filter
python $APPLY_BOT_FILTER_SCRIPT || exit 0
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
.do_nothing_before:
before_script: &do_nothing_before
# apply bot filter in before script
- *apply_bot_filter
- echo "Not setting up GitLab key, fetching submodules ..."
- git submodule update --init --recursive
- source tools/ci/configure_ci_environment.sh
.build_template: &build_template
stage: build
image: $CI_DOCKER_REGISTRY/esp8266-ci-env-new
tags:
- build
build_ssc:
<<: *build_template
artifacts:
paths:
- ./SSC/ssc_bin
expire_in: 6 mos
script:
- git clone $GITLAB_SSH_SERVER/yinling/SSC.git
- cd SSC
# try checkout same branch
- git checkout "${CI_BUILD_REF_NAME}_8266" || echo "Using default branch..."
- ./gen_misc_rtos.sh
push_master_to_github:
stage: deploy
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
tags:
- deploy
only:
- master
- /^release\/v/
- /^v\d+\.\d+(\.\d+)?($|-)/
when: on_success
dependencies: []
variables:
GITHUB_PUSH_REFS: refs/remotes/origin/release refs/remotes/origin/master
before_script: *do_nothing_before
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
- git remote remove github &>/dev/null || true
- git remote add github git@github.com:espressif/ESP8266_RTOS_SDK.git
# What the next line of script does: goes through the list of refs for all branches we push to github,
# generates a snippet of shell which is evaluated. The snippet checks CI_COMMIT_SHA against the SHA
# (aka objectname) at tip of each branch, and if any SHAs match then it checks out the local branch
# and then pushes that ref to a corresponding github branch
- eval $(git for-each-ref --shell bash --format 'if [ $CI_COMMIT_SHA == %(objectname) ]; then git checkout -B %(refname:strip=3); git push --follow-tags github %(refname:strip=3); fi;' $GITHUB_PUSH_REFS)
build_docs:
stage: build
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
tags:
- build_docs
artifacts:
when: always
paths:
# English version of documentation
- docs/en/doxygen-warning-log.txt
- docs/en/sphinx-warning-log.txt
- docs/en/sphinx-warning-log-sanitized.txt
- docs/en/_build/html
- docs/sphinx-err-*
expire_in: 1 day
only:
variables:
- $BOT_TRIGGER_WITH_LABEL == null
- $BOT_LABEL_BUILD
- $BOT_LABEL_BUILD_DOCS
- $BOT_LABEL_REGULAR_TEST
script:
- cd docs
- cd en
- make gh-linkcheck
- make html
- ../check_doc_warnings.sh
.build_examples_make_template: &build_examples_make_template
<<: *build_template
# This is a workaround for a rarely encountered issue with building examples in CI.
# Probably related to building of Kconfig in 'make clean' stage
retry: 1
artifacts:
when: always
paths:
- $LOG_PATH
expire_in: 2 days
variables:
LOG_PATH: "$CI_PROJECT_DIR/log_examples_make"
only:
variables:
- $BOT_TRIGGER_WITH_LABEL == null
- $BOT_LABEL_BUILD
- $BOT_LABEL_EXAMPLE_TEST
- $BOT_LABEL_REGULAR_TEST
before_script: *do_nothing_before
script:
# it's not possible to build 100% out-of-tree and have the "artifacts"
# mechanism work, but this is the next best thing
- rm -rf build_examples
- mkdir build_examples
- cd build_examples
# build some of examples
- mkdir -p ${LOG_PATH}
- ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
# same as above, but for CMake
.build_examples_cmake_template: &build_examples_cmake_template
<<: *build_template
artifacts:
when: always
paths:
- $LOG_PATH
expire_in: 2 days
variables:
LOG_PATH: "$CI_PROJECT_DIR/log_examples_cmake"
only:
variables:
- $BOT_TRIGGER_WITH_LABEL == null
- $BOT_LABEL_BUILD
- $BOT_LABEL_EXAMPLE_TEST
- $BOT_LABEL_REGULAR_TEST
before_script: *do_nothing_before
script:
# it's not possible to build 100% out-of-tree and have the "artifacts"
# mechanism work, but this is the next best thing
- rm -rf build_examples_cmake
- mkdir build_examples_cmake
- cd build_examples_cmake
# build some of examples
- mkdir -p ${LOG_PATH}
- ${IDF_PATH}/tools/ci/build_examples_cmake.sh "${CI_JOB_NAME}"
build_examples_make_00:
<<: *build_examples_make_template
build_examples_make_01:
<<: *build_examples_make_template
build_examples_make_02:
<<: *build_examples_make_template
build_examples_make_03:
<<: *build_examples_make_template
build_examples_cmake_00:
<<: *build_examples_cmake_template
build_examples_cmake_01:
<<: *build_examples_cmake_template
build_examples_cmake_02:
<<: *build_examples_cmake_template
build_examples_cmake_03:
<<: *build_examples_cmake_template