diff options
-rw-r--r-- | .github/workflows/cppcheck.yml | 23 | ||||
-rw-r--r-- | .github/workflows/macos.yml | 1 | ||||
-rwxr-xr-x | .github/workflows/scripts/mass-cppcheck.sh | 54 | ||||
-rwxr-xr-x | .travis.sh | 14 | ||||
-rw-r--r-- | Brewfile | 1 |
5 files changed, 77 insertions, 16 deletions
diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml new file mode 100644 index 00000000..9ffb0150 --- /dev/null +++ b/.github/workflows/cppcheck.yml @@ -0,0 +1,23 @@ +# Copyright (C) 2021 Sebastian Pipping <sebastian@pipping.org> +# Licensed under the MIT license + +name: Run Cppcheck (from macOS Homebrew) + +on: + pull_request: + push: + schedule: + - cron: '0 2 * * 5' # Every Friday at 2am + +jobs: + checks: + name: Run Cppcheck + runs-on: macos-latest + steps: + - uses: actions/checkout@v2.3.4 + - name: Install runtime dependencies + run: | + exec brew install cppcheck findutils + - name: Run Cppcheck + run: | + exec .github/workflows/scripts/mass-cppcheck.sh diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 64c1bb57..8675787d 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -22,7 +22,6 @@ jobs: - MODE: distcheck - MODE: qa-sh FLAT_ENV: CC=clang CXX=clang++ LD=clang++ QA_SANITIZER=address - - MODE: cppcheck runs-on: macos-latest steps: - uses: actions/checkout@v2.3.4 diff --git a/.github/workflows/scripts/mass-cppcheck.sh b/.github/workflows/scripts/mass-cppcheck.sh new file mode 100755 index 00000000..8f6df565 --- /dev/null +++ b/.github/workflows/scripts/mass-cppcheck.sh @@ -0,0 +1,54 @@ +#! /usr/bin/env bash +# __ __ _ +# ___\ \/ /_ __ __ _| |_ +# / _ \\ /| '_ \ / _` | __| +# | __// \| |_) | (_| | |_ +# \___/_/\_\ .__/ \__,_|\__| +# |_| XML parser +# +# Copyright (c) 2021 Expat development team +# Licensed under the MIT license: +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to the +# following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +# USE OR OTHER DEALINGS IN THE SOFTWARE. + +PS4='# ' +set -e -u -o pipefail -x + +if [[ "$(uname -s)" =~ ^Darwin ]]; then + export PATH="/usr/local/opt/findutils/libexec/gnubin${PATH:+:}${PATH}" +fi + +cppcheck --version + +find --version | head -n1 + +find_args=( + -type f \( + -name \*.cpp + -o -name \*.c + \) + -not \( # Exclude .c files that are merely included by other files + -name xmltok_ns.c + -o -name xmltok_impl.c + \) + -exec cppcheck --quiet --error-exitcode=1 --force --suppress=objectIndex {} + +) + +exec find "${find_args[@]}" @@ -59,20 +59,6 @@ elif [[ ${MODE} = cmake-oos ]]; then make VERBOSE=1 CTEST_OUTPUT_ON_FAILURE=1 all test make DESTDIR="${PWD}"/ROOT install find ROOT -printf "%P\n" | sort -elif [[ ${MODE} = cppcheck ]]; then - cppcheck --version - find_args=( - -type f \( - -name \*.cpp - -o -name \*.c - \) - -not \( # Exclude .c files that are merely included by other files - -name xmltok_ns.c - -o -name xmltok_impl.c - \) - -exec cppcheck --quiet --error-exitcode=1 --force --suppress=objectIndex {} + - ) - find "${find_args[@]}" elif [[ ${MODE} = clang-format ]]; then ./apply-clang-format.sh git diff --exit-code @@ -2,7 +2,6 @@ brew "autoconf" brew "automake" brew "cmake" brew "coreutils" -brew "cppcheck" brew "docbook2x" brew "dos2unix" brew "findutils" |