forked from espressif/esp-mqtt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
136 lines (128 loc) · 5.03 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
stages:
- build
- deploy
variables:
IDF_REPO: ${GITLAB_SSH_SERVER}/idf/esp-idf.git
OLDER_IDF: release/v3.1
RECENT_IDF: release/v3.3
.add_gh_key_remote: &add_gh_key_remote |
cit_add_ssh_key "${GH_PUSH_KEY}"
git remote remove github || true
git remote add github ${GH_PUSH_REPO}
before_script:
# Use CI Tools
- curl -sSL ${CIT_LOADER_URL} | sh
- source citools/import_functions
- PATH=$CI_PROJECT_DIR/esp-idf/tools:$PATH
- export IDF_PATH=$CI_PROJECT_DIR/esp-idf
- export MQTT_PATH=$CI_PROJECT_DIR
build_with_idf_v3:
stage: build
image: ${CI_DOCKER_REGISTRY}/esp32-ci-env
tags:
- build
dependencies: []
script:
- cit_add_ssh_key "${GITLAB_KEY}"
- git clone "${IDF_REPO}"
# build with IDFv3.2
- $MQTT_PATH/ci/set_idf.sh release/v3.2
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
- $MQTT_PATH/ci/build_examples.sh make
# simple build with IDFv3.1 (buiding directly in mqtt repo)
- $MQTT_PATH/ci/set_idf.sh release/v3.1
- cd $MQTT_PATH && ./ci/modify_for_legacy_idf.sh ${RECENT_IDF} || true
- cd $MQTT_PATH/examples/tcp && rm -rf build && make defconfig && make
build_with_idf_v4:
stage: build
image: ${CI_DOCKER_REGISTRY}/esp-env:v4.4-1
tags:
- build
dependencies: []
artifacts:
when: always
paths:
- tidybuild/*
expire_in: 1 day
variables:
PYTHON_VER: 3.6.13
script:
- cit_add_ssh_key "${GITLAB_KEY}"
- git clone "${IDF_REPO}"
- source /opt/pyenv/activate && pyenv global $PYTHON_VER
- $MQTT_PATH/ci/set_idf.sh master
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
# capture compile commands/flags for static analysis
- cd $IDF_PATH/examples/protocols/mqtt/tcp
- mkdir -p tidybuild && cd tidybuild
- cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
- mv $IDF_PATH/examples/protocols/mqtt/tcp/tidybuild $CI_PROJECT_DIR/tidybuild
# enable pedantic flags for compilation
- export PEDANTIC_CFLAGS="-Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
- export EXTRA_CFLAGS=${PEDANTIC_CFLAGS} && export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
# build other examples
- $MQTT_PATH/ci/build_examples.sh
# rebuild with IDFv4.3
- $MQTT_PATH/ci/set_idf.sh release/v4.3
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
- $MQTT_PATH/ci/build_examples.sh
# rebuild with IDFv4.2
- $MQTT_PATH/ci/set_idf.sh release/v4.2
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
- $MQTT_PATH/ci/build_examples.sh
# rebuild with IDFv4.1
- $MQTT_PATH/ci/set_idf.sh release/v4.1
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
- $MQTT_PATH/ci/build_examples.sh
# rebuild with IDFv4.0
- $MQTT_PATH/ci/set_idf.sh release/v4.0
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
- $MQTT_PATH/ci/build_examples.sh
# build with IDFv3.3
- $MQTT_PATH/ci/set_idf.sh release/v3.3
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
- $MQTT_PATH/ci/build_examples.sh make
build_and_test_qemu:
stage: build
image: ${CI_DOCKER_REGISTRY}/qemu:v4.4-1-20210517
tags:
- build
- shiny
dependencies: []
variables:
PYTHON_VER: 3.6.13
script:
- cit_add_ssh_key "${GITLAB_KEY}"
- git clone "${IDF_REPO}"
- source /opt/pyenv/activate && pyenv global $PYTHON_VER
# switch to IDF and setup the tools
- $MQTT_PATH/ci/set_idf.sh master
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
# build publish-connect stress test, setup test parameters
- cd tools/test_apps/protocols/mqtt/publish_connect_test && cat sdkconfig.qemu | $IDF_PATH/tools/ci/envsubst.py > sdkconfig.defaults && idf.py build
- export TEST_PATH=`pwd` && export MQTT_PUBLISH_TEST=1
- export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages"
# run test (with environment->qemu)
- cd $IDF_PATH/tools/ci/python_packages/tiny_test_fw/bin
- python Runner.py $TEST_PATH -c $TEST_PATH/publish_connect_mqtt_qemu.yml -e $TEST_PATH/env.yml
push_master_to_github:
stage: deploy
image: ${CI_DOCKER_REGISTRY}/esp32-ci-env
tags:
- build
only:
- master
- idf
when: on_success
variables:
GIT_STRATEGY: clone
script:
- *add_gh_key_remote
- git push github HEAD:${CI_COMMIT_REF_NAME}