mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-07-29 18:28:24 +02:00
ci: added basic support for building + static analysis with IDF master
This commit is contained in:
32
.clang-tidy-limits.yml
Normal file
32
.clang-tidy-limits.yml
Normal file
@ -0,0 +1,32 @@
|
||||
limits:
|
||||
"google-readability-braces-around-statements" : 30
|
||||
"readability-braces-around-statements" : 30
|
||||
"clang-diagnostic-error" : 10
|
||||
"readability-non-const-parameter" : 10
|
||||
"misc-misplaced-const" : 10
|
||||
"clang-diagnostic-typedef-redefinition" : 10
|
||||
"hicpp-braces-around-statements" : 10
|
||||
"clang-diagnostic-int-to-pointer-cast" : 10
|
||||
"hicpp-no-assembler" : 10
|
||||
"readability-else-after-return" : 10
|
||||
"readability-redundant-declaration" : 10
|
||||
"clang-diagnostic-unknown-attributes" : 10
|
||||
"misc-unused-parameters" : 10
|
||||
"readability-inconsistent-declaration-parameter-name" : 10
|
||||
"google-readability-todo" : 10
|
||||
"clang-diagnostic-macro-redefined" : 10
|
||||
"google-readability-casting" : 10
|
||||
"readability-inconsistent-declaration-parameter-name": 10
|
||||
"readability-named-parameter": 10
|
||||
"readability-container-size-empty": 10
|
||||
"modernize-use-using": 10
|
||||
"modernize-use-override": 10
|
||||
"readability-implicit-bool-cast": 10
|
||||
"modernize-use-default-member-init": 10
|
||||
"performance-unnecessary-value-param": 10
|
||||
"modernize-use-equals-default": 10
|
||||
"modernize-use-nullptr": 10
|
||||
|
||||
ignore:
|
||||
|
||||
|
122
.gitlab-ci.yml
Normal file
122
.gitlab-ci.yml
Normal file
@ -0,0 +1,122 @@
|
||||
stages:
|
||||
- build
|
||||
- static_analysis
|
||||
- deploy_report
|
||||
- deploy
|
||||
|
||||
|
||||
variables:
|
||||
IDF_REPO: ${GITLAB_SSH_SERVER}/idf/esp-idf.git
|
||||
|
||||
.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
|
||||
|
||||
build_with_idf:
|
||||
stage: build
|
||||
image: ${CI_DOCKER_REGISTRY}/esp32-ci-env
|
||||
tags:
|
||||
- build
|
||||
dependencies: []
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- tidybuild/*
|
||||
expire_in: 1 day
|
||||
script:
|
||||
- cit_add_ssh_key "${GITLAB_KEY}"
|
||||
- git clone "${IDF_REPO}"
|
||||
- cd esp-idf
|
||||
- ./tools/ci/mirror-submodule-update.sh
|
||||
- export IDF_PATH=$(pwd)
|
||||
- cd $IDF_PATH/components/mqtt/esp-mqtt
|
||||
- rm -rf .git
|
||||
- cp -r $CI_PROJECT_DIR/.git .
|
||||
- git checkout $CI_COMMIT_SHA
|
||||
# build one example and capture compile commands/flags for static analysis
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/tcp
|
||||
- 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}
|
||||
- idf.py build
|
||||
- mkdir -p tidybuild
|
||||
- cd tidybuild
|
||||
- cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
|
||||
- cd $CI_PROJECT_DIR
|
||||
- mv $IDF_PATH/examples/protocols/mqtt/tcp/tidybuild $CI_PROJECT_DIR/tidybuild
|
||||
# build other examples
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/ssl && idf.py build
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/ssl_mutual_auth && idf.py build
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/ws && idf.py build
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/wss && idf.py build
|
||||
|
||||
clang_tidy_check:
|
||||
stage: static_analysis
|
||||
image: ${CI_DOCKER_REGISTRY}/clang-static-analysis
|
||||
tags:
|
||||
- host_test
|
||||
dependencies:
|
||||
- build_with_idf
|
||||
artifacts:
|
||||
reports:
|
||||
junit: esp-idf/examples/protocols/mqtt/tcp/tidybuild/output.xml
|
||||
when: always
|
||||
paths:
|
||||
- esp-idf/examples/protocols/mqtt/tcp/tidybuild/report/*
|
||||
expire_in: 1 day
|
||||
script:
|
||||
- cit_add_ssh_key "${GITLAB_KEY}"
|
||||
- git clone "${IDF_REPO}"
|
||||
- cd esp-idf
|
||||
- ./tools/ci/mirror-submodule-update.sh
|
||||
- export IDF_PATH=$(pwd)
|
||||
- cd $IDF_PATH/components/mqtt/esp-mqtt
|
||||
- rm -rf .git
|
||||
- cp -r $CI_PROJECT_DIR/.git .
|
||||
- git checkout $CI_COMMIT_SHA
|
||||
- mv $CI_PROJECT_DIR/tidybuild $IDF_PATH/examples/protocols/mqtt/tcp/tidybuild
|
||||
- cd $IDF_PATH/examples/protocols/mqtt/tcp/tidybuild
|
||||
- git clone "${CI_REPORT_TOOLS}"
|
||||
- cd static-analysis-utils
|
||||
- ./generate_report.sh $CI_PROJECT_DIR/.clang-tidy-limits.yml $IDF_PATH/examples/protocols/mqtt/tcp/tidybuild/report $IDF_PATH/examples/protocols/mqtt/tcp/tidybuild/output.xml
|
||||
|
||||
deploy_report:
|
||||
stage: deploy_report
|
||||
image: $CI_DOCKER_REGISTRY/esp32-ci-env
|
||||
tags:
|
||||
- deploy
|
||||
dependencies:
|
||||
- clang_tidy_check
|
||||
script:
|
||||
- cit_add_ssh_key "${DOCS_DEPLOY_KEY}"
|
||||
- echo -e "Host $DOCS_SERVER\n\tStrictHostKeyChecking no\n\tUser $DOCS_SERVER_USER\n" >> ~/.ssh/config
|
||||
- export GIT_VER=$(git describe --always)
|
||||
- cd esp-idf/examples/protocols/mqtt/tcp/tidybuild
|
||||
- mv report $GIT_VER
|
||||
- tar czvf $GIT_VER.tar.gz $GIT_VER
|
||||
- ssh $DOCS_SERVER -x "mkdir -p $DOCS_PATH/clang-tidy"
|
||||
- scp $GIT_VER.tar.gz $DOCS_SERVER:$DOCS_PATH/clang-tidy
|
||||
- ssh $DOCS_SERVER -x "cd $DOCS_PATH/clang-tidy && tar xzvf $GIT_VER.tar.gz && rm -f latest && ln -s $GIT_VER latest"
|
||||
# add link to view the report
|
||||
- echo "[static analysis][clang tidy] $CI_DOCKER_REGISTRY/static_analysis/esp-idf/clang-tidy/${GIT_VER}/index.html"
|
||||
|
||||
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}
|
@ -13,6 +13,8 @@ addons:
|
||||
before_install:
|
||||
# Save path to the git respository
|
||||
- PROJECT_PATH=$(pwd)
|
||||
# Have to checkout a temp branch for later in tree reference
|
||||
- git checkout -b temporary_ref_branch
|
||||
- CI_COMMIT_SHA=$(git rev-parse HEAD)
|
||||
|
||||
install:
|
||||
|
Reference in New Issue
Block a user