mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-07-30 10:48:06 +02:00
CI: Add checks to build against different IDF releases
This commit is contained in:
@ -20,8 +20,10 @@ before_script:
|
|||||||
- curl -sSL ${CIT_LOADER_URL} | sh
|
- curl -sSL ${CIT_LOADER_URL} | sh
|
||||||
- source citools/import_functions
|
- source citools/import_functions
|
||||||
- PATH=$CI_PROJECT_DIR/esp-idf/tools:$PATH
|
- PATH=$CI_PROJECT_DIR/esp-idf/tools:$PATH
|
||||||
|
- export IDF_PATH=$CI_PROJECT_DIR/esp-idf
|
||||||
|
- export MQTT_PATH=$CI_PROJECT_DIR
|
||||||
|
|
||||||
build_with_older_idf:
|
build_with_idf_v3:
|
||||||
stage: build
|
stage: build
|
||||||
image: ${CI_DOCKER_REGISTRY}/esp32-ci-env
|
image: ${CI_DOCKER_REGISTRY}/esp32-ci-env
|
||||||
tags:
|
tags:
|
||||||
@ -29,16 +31,21 @@ build_with_older_idf:
|
|||||||
dependencies: []
|
dependencies: []
|
||||||
script:
|
script:
|
||||||
- cit_add_ssh_key "${GITLAB_KEY}"
|
- cit_add_ssh_key "${GITLAB_KEY}"
|
||||||
- git clone "${IDF_REPO}" && cd esp-idf && git checkout ${OLDER_IDF}
|
- git clone "${IDF_REPO}"
|
||||||
- ./tools/ci/mirror-submodule-update.sh
|
# build with IDFv3.2
|
||||||
- export IDF_PATH=$(pwd)
|
- $MQTT_PATH/ci/set_idf.sh release/v3.2
|
||||||
- cd $CI_PROJECT_DIR
|
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
|
||||||
- ./modify_for_legacy_idf.sh ${RECENT_IDF} || true
|
- $MQTT_PATH/ci/build_examples.sh make
|
||||||
- cd $CI_PROJECT_DIR/examples/tcp
|
# build with IDFv3.3
|
||||||
- make defconfig
|
- $MQTT_PATH/ci/set_idf.sh release/v3.3
|
||||||
- make
|
- $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:
|
build_with_idf_v4:
|
||||||
stage: build
|
stage: build
|
||||||
image: ${CI_DOCKER_REGISTRY}/esp32-ci-env
|
image: ${CI_DOCKER_REGISTRY}/esp32-ci-env
|
||||||
tags:
|
tags:
|
||||||
@ -52,14 +59,9 @@ build_with_idf:
|
|||||||
script:
|
script:
|
||||||
- cit_add_ssh_key "${GITLAB_KEY}"
|
- cit_add_ssh_key "${GITLAB_KEY}"
|
||||||
- git clone "${IDF_REPO}"
|
- git clone "${IDF_REPO}"
|
||||||
- cd esp-idf
|
- $MQTT_PATH/ci/set_idf.sh master
|
||||||
- tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
|
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
|
||||||
- ./tools/ci/mirror-submodule-update.sh
|
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
|
||||||
- export IDF_PATH=$(pwd)
|
|
||||||
- cd $IDF_PATH/components/mqtt/esp-mqtt
|
|
||||||
- rm -rf .git
|
|
||||||
- cp -r $CI_PROJECT_DIR/.git .
|
|
||||||
- git reset --hard $CI_COMMIT_SHA
|
|
||||||
# capture compile commands/flags for static analysis
|
# capture compile commands/flags for static analysis
|
||||||
- cd $IDF_PATH/examples/protocols/mqtt/tcp
|
- cd $IDF_PATH/examples/protocols/mqtt/tcp
|
||||||
- mkdir -p tidybuild && cd tidybuild
|
- mkdir -p tidybuild && cd tidybuild
|
||||||
@ -69,11 +71,17 @@ build_with_idf:
|
|||||||
- export PEDANTIC_CFLAGS="-Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
|
- 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}
|
- export EXTRA_CFLAGS=${PEDANTIC_CFLAGS} && export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
|
||||||
# build other examples
|
# build other examples
|
||||||
- cd $IDF_PATH/examples/protocols/mqtt/tcp && idf.py build
|
- $MQTT_PATH/ci/build_examples.sh
|
||||||
- cd $IDF_PATH/examples/protocols/mqtt/ssl && idf.py build
|
# rebuild with IDFv4.1
|
||||||
- cd $IDF_PATH/examples/protocols/mqtt/ssl_mutual_auth && idf.py build
|
- $MQTT_PATH/ci/set_idf.sh release/v4.1
|
||||||
- cd $IDF_PATH/examples/protocols/mqtt/ws && idf.py build
|
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
|
||||||
- cd $IDF_PATH/examples/protocols/mqtt/wss && idf.py build
|
- $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_and_test_qemu:
|
build_and_test_qemu:
|
||||||
stage: build
|
stage: build
|
||||||
@ -85,14 +93,9 @@ build_and_test_qemu:
|
|||||||
script:
|
script:
|
||||||
- cit_add_ssh_key "${GITLAB_KEY}"
|
- cit_add_ssh_key "${GITLAB_KEY}"
|
||||||
- git clone "${IDF_REPO}"
|
- git clone "${IDF_REPO}"
|
||||||
- cd esp-idf
|
- $MQTT_PATH/ci/set_idf.sh master
|
||||||
- tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
|
- cd $IDF_PATH && tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)"
|
||||||
- ./tools/ci/mirror-submodule-update.sh
|
- $MQTT_PATH/ci/set_mqtt.sh $CI_COMMIT_SHA
|
||||||
- export IDF_PATH=$(pwd)
|
|
||||||
- cd $IDF_PATH/components/mqtt/esp-mqtt
|
|
||||||
- rm -rf .git
|
|
||||||
- cp -r $CI_PROJECT_DIR/.git .
|
|
||||||
- git reset --hard $CI_COMMIT_SHA
|
|
||||||
# build publish stress test
|
# build publish stress test
|
||||||
- cd $IDF_PATH/examples/protocols/mqtt/publish_test && cat sdkconfig.qemu | $IDF_PATH/tools/ci/envsubst.py >> sdkconfig.defaults && idf.py build
|
- cd $IDF_PATH/examples/protocols/mqtt/publish_test && cat sdkconfig.qemu | $IDF_PATH/tools/ci/envsubst.py >> sdkconfig.defaults && idf.py build
|
||||||
- source /opt/pyenv/activate && pyenv global 2.7.15 && python --version
|
- source /opt/pyenv/activate && pyenv global 2.7.15 && python --version
|
||||||
@ -109,7 +112,7 @@ clang_tidy_check:
|
|||||||
tags:
|
tags:
|
||||||
- host_test
|
- host_test
|
||||||
dependencies:
|
dependencies:
|
||||||
- build_with_idf
|
- build_with_idf_v4
|
||||||
artifacts:
|
artifacts:
|
||||||
reports:
|
reports:
|
||||||
junit: esp-idf/examples/protocols/mqtt/tcp/tidybuild/output.xml
|
junit: esp-idf/examples/protocols/mqtt/tcp/tidybuild/output.xml
|
||||||
|
21
ci/build_examples.sh
Executable file
21
ci/build_examples.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# build mqtt examples with make if $1=="make", with cmake otherwise
|
||||||
|
set -o errexit # Exit if command failed.
|
||||||
|
|
||||||
|
if [ -z $IDF_PATH ] ; then
|
||||||
|
echo "Mandatory variables undefined"
|
||||||
|
exit 1;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
examples="tcp ssl ssl_mutual_auth ws wss"
|
||||||
|
for i in $examples; do
|
||||||
|
echo "Building MQTT example $i"
|
||||||
|
cd $IDF_PATH/examples/protocols/mqtt/$i
|
||||||
|
if [[ "$1" = "make" ]]; then
|
||||||
|
make defconfig
|
||||||
|
make -j 4
|
||||||
|
else
|
||||||
|
idf.py build
|
||||||
|
fi;
|
||||||
|
done
|
19
ci/set_idf.sh
Executable file
19
ci/set_idf.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# sets up the IDF repo incl submodules with specified version as $1
|
||||||
|
set -o errexit # Exit if command failed.
|
||||||
|
|
||||||
|
if [ -z $IDF_PATH ] || [ -z $MQTT_PATH ] || [ -z $1 ] ; then
|
||||||
|
echo "Mandatory variables undefined"
|
||||||
|
exit 1;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
echo "Checking out IDF version $1"
|
||||||
|
cd $IDF_PATH
|
||||||
|
# Cleans out the untracked files in the repo, so the next "git checkout" doesn't fail
|
||||||
|
git clean -f
|
||||||
|
git checkout $1
|
||||||
|
# Removes the mqtt submodule, not the next submodule update doesn't fail
|
||||||
|
rm -rf $IDF_PATH/components/mqtt/esp-mqtt
|
||||||
|
./tools/ci/mirror-submodule-update.sh
|
||||||
|
|
16
ci/set_mqtt.sh
Executable file
16
ci/set_mqtt.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# sets the mqtt in IDF tree as a submodule with the version specified as $1
|
||||||
|
set -o errexit # Exit if command failed.
|
||||||
|
|
||||||
|
if [ -z $IDF_PATH ] || [ -z $MQTT_PATH ] || [ -z $1 ] ; then
|
||||||
|
echo "Mandatory variables undefined"
|
||||||
|
exit 1;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
echo "Checking out MQTT version to $1"
|
||||||
|
# exchange remotes of mqtt submodules with plain copy
|
||||||
|
cd $IDF_PATH/components/mqtt/esp-mqtt
|
||||||
|
rm -rf .git # removes the actual IDF referenced version
|
||||||
|
cp -r $MQTT_PATH/.git . # replaces with the MQTT_PATH (CI checked tree)
|
||||||
|
git reset --hard $1 # sets the requested version
|
Reference in New Issue
Block a user