Actions: Split off Cppcheck to stop installing 13 unrelated Homebrew formulas

This commit is contained in:
Sebastian Pipping 2021-04-06 23:19:40 +02:00
parent ae6c9b40af
commit 2cfa1dd63f
5 changed files with 77 additions and 16 deletions

23
.github/workflows/cppcheck.yml vendored Normal file
View File

@ -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

View File

@ -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

54
.github/workflows/scripts/mass-cppcheck.sh vendored Executable file
View File

@ -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[@]}"

View File

@ -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

View File

@ -2,7 +2,6 @@ brew "autoconf"
brew "automake"
brew "cmake"
brew "coreutils"
brew "cppcheck"
brew "docbook2x"
brew "dos2unix"
brew "findutils"