File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 with :
1818 fetch-depth : 1000
1919
20- - name : Configure git
21- run : |
22- git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF" --depth=1000
20+ - name : Fetch base branch
21+ run : git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF"
2322
2423 - name : Install clang-format
2524 run : |
3534 with :
3635 name : Patches
3736 path : ./*.patch
37+ test-clang-tidy :
38+ runs-on : ubuntu-latest
39+ container :
40+ image : infinitime/infinitime-build
41+ steps :
42+ # This workaround fixes the error "unsafe repository (REPO is owned by someone else)".
43+ # See https://github.com/actions/checkout/issues/760 and https://github.com/actions/checkout/issues/766
44+ # The fix in "actions/checkout@v2" was not sufficient as the build process also uses git (to get the current
45+ # commit hash, for example).
46+ - name : Workaround permission issues
47+ run : git config --global --add safe.directory "$GITHUB_WORKSPACE"
48+ - name : Checkout source files
49+ uses : actions/checkout@v3
50+ with :
51+ submodules : recursive
52+ fetch-depth : 1000
53+ - name : Fetch base branch
54+ run : git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF"
55+ - name : Install clang-tidy
56+ run : |
57+ apt-get update
58+ apt-get -y install clang-tidy-12
59+ - name : Prepare environment
60+ shell : bash
61+ env :
62+ SOURCES_DIR : .
63+ run : |
64+ . docker/build.sh
65+ GetGcc
66+ GetNrfSdk
67+ GetMcuBoot
68+ CmakeGenerate
69+ - run : tests/test-tidy.sh
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ set -e
4+
5+ if [ -z " $GITHUB_BASE_REF " ]
6+ then
7+ echo " This script is only meant to be run in a GitHub Workflow"
8+ exit 1
9+ fi
10+
11+ CHANGED_FILES=$( git diff --name-only " $GITHUB_BASE_REF " ...HEAD)
12+
13+ for file in $CHANGED_FILES
14+ do
15+ [ -e " $file " ] || continue
16+ case " $file " in
17+ src/libs/* |src/FreeRTOS/* ) continue ;;
18+ * .cpp|* .h)
19+ echo " ::group::$file "
20+ clang-tidy-12 -p build " $file " || true
21+ echo " ::endgroup::"
22+ esac
23+ done
24+
25+ exit 0
You can’t perform that action at this time.
0 commit comments