forked from eclipse-iceoryx/iceoryx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iox-eclipse-iceoryx#889 Add clang-tidy workflows
Build iceoryx and then run clang-tidy on all cpp files exclude tests.
- Loading branch information
Roman Sokolkov
committed
Jul 31, 2021
1 parent
d5f8841
commit 79dd65b
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Check with clang-tidy | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master, release* ] | ||
|
||
jobs: | ||
clang-tidy: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: compiler versions | ||
run: | | ||
echo $(gcc --version) | ||
echo $(clang --version) | ||
- name: Install iceoryx dependencies and clang-tidy | ||
# Softwares installed in ubuntu-20.04 instance | ||
# https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu2004-README.md | ||
run: sudo apt-get update && sudo apt-get install -y libacl1-dev libncurses5-dev clang-tidy-10 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build | ||
env: | ||
CC: clang-10 | ||
CXX: clang++-10 | ||
run: | | ||
$GITHUB_WORKSPACE/tools/iceoryx_build_test.sh | ||
- name: Run clang-tidy | ||
run: ./tools/check_clang_tidy.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
fail() { | ||
printf "\033[1;31merror: %s: %s\033[0m\n" ${FUNCNAME[1]} "${1:-"Unknown error"}" | ||
exit 1 | ||
} | ||
|
||
hash run-clang-tidy-10.py || fail "run-clang-tidy-10.py not found" | ||
cd $(git rev-parse --show-toplevel) | ||
[ -f build/compile_commands.json ] || fail "build/compile_commands.json not found" | ||
# TODO: only process files change in PR | ||
# https://dev.to/scienta/get-changed-files-in-github-actions-1p36 | ||
FILES=$(git ls-files | grep -E "\.(c|cpp)$" | grep -E -v '/(test|testing)/') | ||
run-clang-tidy-12.py -p build $FILES |