Skip to content

Commit

Permalink
Add Static Code Analysis GitHub Action
Browse files Browse the repository at this point in the history
For now runs clazy, but should get clang-tidy added in the future.
  • Loading branch information
kbroulik committed Dec 18, 2023
1 parent 696d055 commit 6355bbd
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/static-code-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# SPDX-License-Identifier: BSD-2-Clause
#
# SPDX-FileCopyrightText: 2023 Kai Uwe Broulik <[email protected]>

name: Static Code Analysis

on: ["push", "pull_request"]

jobs:
static-code-analysis:
strategy:
matrix:
config:
- {name: "Ubuntu 22.04 (Clang)", os: "ubuntu-22.04", CC: "clang", CXX: "clang++"}

name: ${{matrix.config.name}}
runs-on: ${{matrix.config.os}}

steps:
- name: Install dependencies
env:
DEBIAN_FRONTEND: "noninteractive"
run: sudo apt-get update && sudo apt-get install -y build-essential cmake clazy clang-tidy qtbase5-dev qtdeclarative5-dev qtquickcontrols2-5-dev extra-cmake-modules libkf5coreaddons-dev libkf5declarative-dev libkf5sysguard-dev libsensors-dev

- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive

- name: Export Compile Commands
env:
CC: ${{matrix.config.CC}}
CXX: ${{matrix.config.CXX}}
BUILD_DIR: "build/"
run: |
cmake -B ${BUILD_DIR} -DBUILD_EXAMPLES=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Clazy
env:
BUILD_DIR: "build/"
run: |
find . -name '*.cpp' | xargs clazy-standalone -p ${BUILD_DIR}compile_commands.json

0 comments on commit 6355bbd

Please sign in to comment.