From 1716bf5c0fb48f2420d7ccd6a3741ee1713b42ac Mon Sep 17 00:00:00 2001 From: Balaji Srinivasan Date: Wed, 16 Aug 2023 15:17:17 +0200 Subject: [PATCH] workflow: Add clang-tidy review workflow Add clang-tidy review workflow Signed-off-by: Balaji Srinivasan --- .github/workflows/clang-tidy-review.yml | 63 +++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/clang-tidy-review.yml diff --git a/.github/workflows/clang-tidy-review.yml b/.github/workflows/clang-tidy-review.yml new file mode 100644 index 00000000000..4b58980f5c2 --- /dev/null +++ b/.github/workflows/clang-tidy-review.yml @@ -0,0 +1,63 @@ +name: Clang-tidy review +on: + pull_request: + +jobs: + build: + name: Clang tidy review + runs-on: ubuntu-latest + container: zephyrprojectrtos/ci:v0.26.4 + env: + CMAKE_PREFIX_PATH: /opt/toolchains + steps: + - name: Checkout the code + uses: actions/checkout@v2 + if: github.event_name == 'pull_request_target' + with: + ref: ${{ github.event.pull_request.head.sha }} # Checkout the PR's head sha instead of the target branch's sha + path: ncs/nrf + fetch-depth: 0 + + - name: Checkout the code + uses: actions/checkout@v2 + if: github.event_name != 'pull_request_target' + with: + path: ncs/nrf + fetch-depth: 0 + + - name: Install jq + run: | + sudo apt-get update + sudo apt-get install jq + + # The docker image comes pre-initialized with west dependencies. We want to do west update ourselves to to be sure that we get the latest changes in all repos. + # The docker image is built nightly. So it may contain slightly out of date repos. + # Hence we remove the .west folder and do a re-init + - name: West init and update + run: | + rm -rf /workdir/.west/ + west init -l ncs/nrf + cd ncs + west update --narrow -o=--depth=1 + + # Download the quarantine file base branch. This is needed to build and run the tests. + - name: Download quarentine file from nrf (PR only) + if: github.event_name == 'pull_request_target' + run: | + wget https://raw.githubusercontent.com/balaji-nordic/sdk-nrf/master/scripts/quarantine_downstream.yaml -P ncs/nrf/scripts/ + + - name: Build native_posix tests (via sonarcloud build wrapper) + shell: bash + run: | + source ncs/zephyr/zephyr-env.sh + ncs/zephyr/scripts/twister -b -v -i -T ncs/nrf/applications/asset_tracker_v2 -p native_posix --quarantine-list ncs/nrf/scripts/quarantine_downstream.yaml + + - name: Use jq to combine compile_commands.json files + run: | + jq -s 'map(.[])' twister-out/**/compile_commands.json > compile_commands.json + + - uses: ZedThree/clang-tidy-review@v0.12.0 + with: + split_workflow: true + + - uses: ZedThree/clang-tidy-review/upload@v0.12.0