Skip to content

Add clang review workflow #1

Add clang review workflow

Add clang review workflow #1

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