ci: replace internal clang-tidy runner with the pypi project

This commit is contained in:
Fu Hanxi 2023-09-21 16:32:39 +02:00
parent 3b23dc8792
commit 4dbe541f80
No known key found for this signature in database
GPG Key ID: 859132DBB182440F
6 changed files with 5 additions and 39 deletions

View File

@ -58,8 +58,6 @@ variables:
CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
PYTHON_VER: 3.8.17
CLANG_TIDY_RUNNER_PROJ: 2107 # idf/clang-tidy-runner
# Docker images
BOT_DOCKER_IMAGE_TAG: ":latest"

View File

@ -5,23 +5,16 @@ clang_tidy_check:
- .rules:patterns:clang_tidy
artifacts:
paths:
- $OUTPUT_DIR
- clang_tidy_reports/
when: always
expire_in: 1 day
variables:
CLANG_TIDY_DIRS_TXT: ${CI_PROJECT_DIR}/tools/ci/clang_tidy_dirs.txt
RULES_FILE: ${CI_PROJECT_DIR}/tools/ci/static-analysis-rules.yml
OUTPUT_DIR: ${CI_PROJECT_DIR}/clang_tidy_reports
IDF_TOOLCHAIN: clang
script:
- internal_pip_install $CLANG_TIDY_RUNNER_PROJ pyclang
- export PATH=$PATH:$(python -c "import sys; print(sys.executable.rsplit('/', 1)[0])")
- dirs=$(cat ${CLANG_TIDY_DIRS_TXT} | while read line; do echo ${CI_PROJECT_DIR}/${line}; done | xargs)
- run_cmd idf_clang ${dirs}
--output-path ${OUTPUT_DIR}
--limit-file ${RULES_FILE}
- run_cmd idf_clang_tidy $(cat tools/ci/clang_tidy_dirs.txt | xargs)
--output-path clang_tidy_reports
--limit-file tools/ci/static-analysis-rules.yml
--xtensa-include-dir
--run-clang-tidy-py run-clang-tidy
check_pylint:
extends:

View File

@ -21,20 +21,12 @@ Prerequisites
If you have never run this tool before, take the following steps to get this tool prepared.
#. Run the export scripts (``export.sh``, ``export.bat``, or others) to set up the environment variables.
#. Run ``pip install --upgrade pyclang`` to install this plugin. The extra commands would be activated in ``idf.py`` automatically.
#. Run ``idf_tools.py install esp-clang`` to install the clang-tidy required binaries
.. note::
This toolchain is still under development. After the final release, you do not have to install them manually.
#. Get the file from the `llvm repository <https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py>`__ and add the folder of this script to the ``$PATH``. Or you could pass an optional argument ``--run-clang-tidy-py`` later when you call ``idf.py clang-check``. Please do not forget to make the script executable.
.. note::
This file would be bundled in future toolchain releases. This is a temporary workaround.
#. Run the export scripts (``export.sh`` / ``export.bat`` / ... ) again to refresh the environment variables.
Extra Commands

View File

@ -21,20 +21,12 @@ IDF clang-tidy 是使用 `clang-tidy <https://clang.llvm.org/extra/clang-tidy/>`
初次运行此工具时,请按照以下步骤准备该工具:
#. 运行导出脚本(如 ``export.sh````export.bat`` 等),设置环境变量。
#. 运行 ``pip install --upgrade pyclang`` 安装插件,其他命令将在 ``idf.py`` 中自动激活。
#. 运行 ``idf_tools.py install esp-clang`` 安装 clang-tidy 所需的二进制文件。
.. note::
该工具链尚在开发中,最终版本发布后,将无需手动安装工具链。
#. 从 `llvm 仓库 <https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py>`__ 获取文件,并将该脚本所在的文件夹添加到 ``$PATH`` 中,或在调用 ``idf.py clang-check`` 时传递可选参数 ``--run-clang-tidy-py``。请将脚本设置为可执行。
.. note::
在未来工具链版本中,该文件将一并捆绑。目前为临时解决方案。
#. 再次运行导出脚本(如 ``export.sh````export.bat`` 等),刷新环境变量。
其他命令

View File

@ -117,16 +117,6 @@ function retry_failed() {
return $exitCode
}
function internal_pip_install() {
project=$1
package=$2
token_name=${3:-${BOT_TOKEN_NAME}}
token=${4:-${BOT_TOKEN}}
python=${5:-python}
$python -m pip install --index-url https://${token_name}:${token}@${GITLAB_HTTPS_HOST}/api/v4/projects/${project}/packages/pypi/simple --force-reinstall --no-deps ${package}
}
function join_by {
local d=${1-} f=${2-}
if shift 2; then

View File

@ -16,6 +16,7 @@ esp-idf-kconfig
esp-idf-monitor
esp-idf-size
esp-idf-panic-decoder
pyclang
# gdb extensions dependencies
freertos_gdb