From c6df798b68ab2e6f053cb6701e67203faac5eb9e Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Tue, 15 Dec 2020 01:24:11 +0100 Subject: GitHub Actions: Add clang-tidy to build-checks workflow --- .clang-tidy | 19 +++++++++++++++++ .github/workflows/build-checks.yml | 43 ++++++++++++++++++++++++++++++++------ 2 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 .clang-tidy diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000000..1926a002d3 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,19 @@ +--- +Checks: '-*,modernize-use-nullptr,readability-braces-around-statements,readability-namespace-comment,readability-qualified-auto' +WarningsAsErrors: '' +HeaderFilterRegex: '' +AnalyzeTemporaryDtors: false +FormatStyle: none +User: user +CheckOptions: + - key: readability-braces-around-statements.ShortStatementLines + value: 0 + - key: readability-namespace-comments.ShortNamespaceLines + value: 0 + - key: readability-namespace-comments.SpacesBeforeComments + value: 1 + - key: readability-qualified-auto.AddConstToQualified + value: true + - key: modernize-use-nullptr.NullMacros + value: 'NULL' +... diff --git a/.github/workflows/build-checks.yml b/.github/workflows/build-checks.yml index 68ed7224cd..11672b71d5 100644 --- a/.github/workflows/build-checks.yml +++ b/.github/workflows/build-checks.yml @@ -1,12 +1,18 @@ -name: clazy +name: build-checks on: push: pull_request: jobs: - clazy: + build-checks: + strategy: + matrix: + include: + - name: clazy + - name: clang-tidy runs-on: ubuntu-20.04 + name: ${{ matrix.name }} steps: - name: Check out repository uses: actions/checkout@v2 @@ -46,10 +52,12 @@ jobs: qtscript5-dev \ qt5keychain-dev \ clazy \ + clang-tidy \ cmake - name: Create build directory - run: mkdir cmake_build - - name: Configure + run: mkdir build + - name: Configure (clazy) + if: matrix.name == 'clazy' # Disable optimizations as workaround for Clang 9 bug: https://bugs.llvm.org/show_bug.cgi?id=45034 run: | cmake \ @@ -71,17 +79,40 @@ jobs: -DMODPLUG=ON \ -DWAVPACK=ON \ .. - working-directory: cmake_build + working-directory: build env: LD: clang++ CC: clang CXX: clazy + - name: Configure (clang-tidy) + if: matrix.name == 'clang-tidy' + run: | + cmake \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCLANG_TIDY=clang-tidy \ + -DWARNINGS_FATAL=ON \ + -DBATTERY=ON \ + -DBROADCAST=ON \ + -DBULK=ON \ + -DHID=ON \ + -DLILV=ON \ + -DOPUS=ON \ + -DQTKEYCHAIN=ON \ + -DVINYLCONTROL=ON \ + -DFFMPEG=ON \ + -DKEYFINDER=ON \ + -DLOCALECOMPARE=ON \ + -DMAD=ON \ + -DMODPLUG=ON \ + -DWAVPACK=ON \ + .. + working-directory: build - name: Set up problem matcher uses: ammaraskar/gcc-problem-matcher@master - name: Build # Do not abort on errors and build/check the whole project run: cmake --build . -j $(nproc) -- --keep-going - working-directory: cmake_build + working-directory: build env: CLAZY_CHECKS: level2,no-rule-of-two-soft,no-non-pod-global-static,no-qproperty-without-notify,no-wrong-qevent-cast,no-qstring-allocations,no-function-args-by-value,no-copyable-polymorphic,no-ctor-missing-parent-argument,no-missing-qobject-macro,no-rule-of-three,no-returning-void-expression,no-missing-typeinfo,no-base-class-event CLAZY_IGNORE_DIRS: lib/.* -- cgit v1.2.3