51 lines
1.7 KiB
YAML
51 lines
1.7 KiB
YAML
name: Run clang-tidy
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build:
|
|
name: Run clang-tidy
|
|
runs-on: ubuntu-20.04
|
|
container: espressif/idf:latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: 'true'
|
|
- name: Run code analysis
|
|
shell: bash
|
|
env:
|
|
IDF_TOOLCHAIN: clang
|
|
IDF_TARGET: esp32
|
|
working-directory: test_app
|
|
run: |
|
|
${IDF_PATH}/tools/idf_tools.py --non-interactive install xtensa-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-latest/clang-tidy-sarif-x86_64-unknown-linux-gnu -o clang-tidy-sarif
|
|
chmod +x clang-tidy-sarif
|
|
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: |
|
|
warnings.txt
|
|
results.sarif
|
|
results.sarif.raw
|
|
- name: Upload SARIF file
|
|
uses: github/codeql-action/upload-sarif@v1
|
|
with:
|
|
sarif_file: results.sarif
|
|
category: clang-tidy
|