Add clang-analyzer action

This commit is contained in:
Christian W. Zuckschwerdt 2020-09-19 21:26:13 +02:00
commit 6613c72cf4

25
.github/workflows/analyzer.yml vendored Normal file
View file

@ -0,0 +1,25 @@
on: [push, pull_request]
# https://github.com/actions/virtual-environments
# - Ubuntu 20.04 ubuntu-20.04 ubuntu-20.04
# - Ubuntu 18.04 ubuntu-latest or ubuntu-18.04
# https://apt.llvm.org/
# - Bionic (18.04)
# - Focal (20.04)
jobs:
analyzer:
runs-on: ubuntu-18.04
name: Analyze with Clang
steps:
- uses: actions/checkout@v2
- name: Install Clang
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main' -y
sudo apt-get update -q
sudo apt-get install -y clang-11 lld-11 libc++-11-dev libc++abi-11-dev clang-tools-11
- name: Clang Analyzer
# excludes include/mongoose.h src/mongoose.c
# exit code 1 if there is output
run: |
clang -Iinclude --analyze -Xanalyzer -analyzer-output=text -Xanalyzer -analyzer-disable-checker=deadcode.DeadStores include/[a-ln-z]*.h src/[a-ln-z]*.c src/devices/*.c 2>&1 | tee analyzer.out
[ ! -s analyzer.out ]