From 9d3971c57c2c9636d9060d949196ff28092c3804 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 5 Dec 2022 22:24:31 +0100 Subject: [PATCH 1/2] update astyle-py to v0.9.0, fixes running pre-commit on an arm64 macOS --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa48a26..2e0fdc9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/igrr/astyle_py.git - rev: master + rev: v0.9.0 hooks: - id: astyle_py args: ['--style=otbs', '--attach-namespaces', '--attach-classes', '--indent=spaces=4', '--convert-tabs', '--align-pointer=name', '--align-reference=name', '--keep-one-line-statements', '--pad-header', '--pad-oper'] From b55c12a9284ca6a13f4fdfb6025a135cbf1a192c Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 5 Dec 2022 22:28:19 +0100 Subject: [PATCH 2/2] ci: install libtinfo5, clang dependency; add workflow comments --- .github/workflows/clang-tidy.yml | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 855dfcc..ca89d53 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -15,6 +15,21 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'true' + - name: Install libtinfo (esp-clang dependency) + run: | + export DEBIAN_FRONTEND=noninteractive + apt update && apt-get install -y libtinfo5 + - name: Install esp-clang + run: | + ${IDF_PATH}/tools/idf_tools.py --non-interactive install esp-clang + - name: Install clang-tidy-sarif + run: | + curl -sSL https://github.com/psastras/sarif-rs/releases/download/clang-tidy-sarif-v0.3.3/clang-tidy-sarif-x86_64-unknown-linux-gnu -o clang-tidy-sarif + chmod +x clang-tidy-sarif + - name: Install pyclang + run: | + . ${IDF_PATH}/export.sh + pip install pyclang~=0.2.0 - name: Run code analysis shell: bash env: @@ -22,21 +37,14 @@ jobs: IDF_TARGET: esp32 working-directory: test_app run: | - ${IDF_PATH}/tools/idf_tools.py --non-interactive install esp-clang . ${IDF_PATH}/export.sh - which -a clang-tidy || true - pip install pyclang~=0.2.0 - curl -sSL https://raw.githubusercontent.com/espressif/llvm-project/xtensa_release_12.0.1/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -o run-clang-tidy.py - chmod +x run-clang-tidy.py - curl -sSL https://github.com/psastras/sarif-rs/releases/download/clang-tidy-sarif-v0.3.3/clang-tidy-sarif-x86_64-unknown-linux-gnu -o clang-tidy-sarif - chmod +x clang-tidy-sarif + idf.py clang-check --include-paths $GITHUB_WORKSPACE --exclude-paths $PWD --run-clang-tidy-py run-clang-tidy + cp warnings.txt ../ + - name: Convert clang-tidy results into SARIF output + run: | export PATH=$PWD:$PATH - idf.py clang-check --include-paths $GITHUB_WORKSPACE --exclude-paths $PWD ./clang-tidy-sarif -o results.sarif.raw warnings.txt python3 $GITHUB_WORKSPACE/.github/filter_sarif.py -o results.sarif --include-prefix ${GITHUB_WORKSPACE}/ results.sarif.raw - cp results.sarif ../ - cp results.sarif.raw ../ - cp warnings.txt ../ - uses: actions/upload-artifact@v2 with: path: |