various CI refactorings and cleanups (#3142)

This commit is contained in:
Oliver Stöneberg 2021-02-21 14:17:02 +01:00 committed by GitHub
parent dcf32563ea
commit e783df646a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 42 deletions

View File

@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
image: ["centos:7", "ubuntu:14.04", "ubuntu:21.04"]
image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:21.04"]
fail-fast: false # Prefer quick result
runs-on: ubuntu-20.04
@ -30,7 +30,7 @@ jobs:
if: matrix.image != 'centos:7'
run: |
apt-get update
apt-get install -y cmake g++ make
apt-get install -y cmake g++ make python libxml2-utils
apt-get install -y libpcre3-dev
# tests require CMake 3.4
@ -65,6 +65,10 @@ jobs:
run: |
make -j$(nproc) check HAVE_RULES=yes
- name: Validate
run: |
make -j$(nproc) checkCWEEntries validateXML
- name: Test addons
run: |
./cppcheck --addon=threadsafety addons/test/threadsafety

View File

@ -58,6 +58,10 @@ jobs:
make -j$(nproc) CXXFLAGS=-funsigned-char testrunner
./testrunner TestSymbolDatabase
- name: Check syntax with NONNEG
run: |
ls lib/*.cpp | xargs -n 1 -P $(nproc) g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG
- name: Build cppcheck
run: |
make clean
@ -73,8 +77,8 @@ jobs:
- name: Validate
run: |
make -j$(nproc) validateCFG validatePlatforms
make -j$(nproc) checkCWEEntries validateXML
- name: Test addons
run: |
./cppcheck --addon=threadsafety addons/test/threadsafety

View File

@ -19,7 +19,7 @@ jobs:
- name: Build
run: |
CC=clang CXX=clang++ CXXFLAGS="-fsanitize=address -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG" CPPFLAGS="-DCHECK_INTERNAL" make cppcheck testrunner -j$(nproc) USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
CC=clang CXX=clang++ CXXFLAGS="-fsanitize=address -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG" CPPFLAGS="-DCHECK_INTERNAL" make -j$(nproc) cppcheck testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
- name: Run tests
run: |

View File

@ -24,7 +24,7 @@ jobs:
- name: Compile instrumented
run: |
make test CXXFLAGS="-g -fprofile-arcs -ftest-coverage" USE_Z3=yes HAVE_RULES=yes -j$(nproc)
make -j$(nproc) test CXXFLAGS="-g -fprofile-arcs -ftest-coverage" USE_Z3=yes HAVE_RULES=yes
- name: Generate coverage report
run: |

View File

@ -29,7 +29,7 @@ jobs:
- name: Install missing software on ubuntu (Python 3)
if: matrix.python-version != '2.7'
run: |
sudo apt-get install shellcheck
sudo apt-get install shellcheck libxml2-utils
python -m pip install pip --upgrade
python -m pip install natsort
python -m pip install pexpect
@ -57,6 +57,11 @@ jobs:
run: |
find . -name '*.json' | xargs -n 1 python -m json.tool > /dev/null
- name: Validate
if: matrix.python-version == '3.8'
run: |
make -j$(nproc) validateCFG validatePlatforms validateRules
- name: check python syntax
if: matrix.python-version != '2.7'
run: |
@ -71,3 +76,9 @@ jobs:
run: |
make -j$(nproc) -s
PYTHONPATH=./addons python -m pytest addons/test/test-*.py
- name: dmake
if: matrix.python-version == '3.8'
run: |
make -j$(nproc) run-dmake
git diff --exit-code

View File

@ -19,7 +19,7 @@ jobs:
- name: Build
run: |
CC=clang CXX=clang++ CXXFLAGS="-fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG" CPPFLAGS="-DCHECK_INTERNAL" make cppcheck testrunner -j$(nproc) USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
CC=clang CXX=clang++ CXXFLAGS="-fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG" CPPFLAGS="-DCHECK_INTERNAL" make -j$(nproc) cppcheck testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
- name: Run tests
run: |

View File

@ -7,12 +7,10 @@ compiler:
env:
global:
- ORIGINAL_CXXFLAGS="-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar -D_GLIBCXX_DEBUG -g "
- ORIGINAL_CXXFLAGS="-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar -D_GLIBCXX_DEBUG -g"
# unfortunately we need this to stay within 50min timelimit given by travis.
- CXXFLAGS="${ORIGINAL_CXXFLAGS} -O2 -march=native -Wstrict-aliasing=2 -Werror=strict-aliasing"
- CPPCHECK=${TRAVIS_BUILD_DIR}/cppcheck
- ASAN_OPTIONS=detect_stack_use_after_return=1
- UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
matrix:
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL"
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" MATCHCOMPILER=yes VERIFY=1
@ -39,9 +37,6 @@ before_install:
matrix:
# do notify immediately about it when a job of a build fails.
fast_finish: true
allow_failures:
- name: "rerun dmake?"
compiler: clang
# defined extra jobs that run besides what is configured in the build matrix
include:
@ -56,12 +51,8 @@ matrix:
- make checkCWEEntries
# check cfg files
- make checkcfg
# check platform files
- make validatePlatforms
# Validate Result XML
- make validateXML
# Validate rule files
- make validateRules
# check htmlreport stuff
- python2 htmlreport/test_htmlreport.py
- python3 htmlreport/test_htmlreport.py
@ -147,18 +138,6 @@ matrix:
- cd -
- python3 test/bug-hunting/juliet.py
# check if dmake needs to be rerun (this job may fail)
- name: "rerun dmake?"
compiler: clang
# we don't need to install any deps for dmake so skip it explicitly
before_install:
- true
script:
- echo "If the following command fails, run 'make dmake; make run-dmake' and commit the resulting change."
- make -s dmake -j$(nproc)
- make -s run-dmake
- git diff --exit-code
script:
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
- set -e
@ -169,8 +148,6 @@ script:
- echo $CXXFLAGS
- make -s check -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE
- touch lib/mathlib.cpp test/testmathlib.cpp
# syntax checking of cppcheck source code with -DNONNEG
- ls lib/*.cpp | xargs -n 1 -P 2 g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG
# compile cppcheck, default build
- echo $CXXFLAGS
- make -s check -j$(nproc)
@ -182,12 +159,3 @@ script:
# Testing addons (disabled 2020-11-24 because Travis fails, TODO try to enable these)
# - PYTHONPATH=./addons python -m pytest addons/test/test-*.py
# - PYTHONPATH=./addons python3 -m pytest addons/test/test-*.py
notifications:
irc:
channels:
- "irc.freenode.org#cppcheck"
template:
- "[%{commit} : %{author}] %{message}"
- "%{build_url}"
skip_join: true

View File

@ -775,7 +775,7 @@ test/testunusedprivfunc.o: test/testunusedprivfunc.cpp externals/simplecpp/simpl
test/testunusedvar.o: test/testunusedvar.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkunusedvar.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testunusedvar.o test/testunusedvar.cpp
test/testutils.o: test/testutils.cpp lib/config.h lib/errorlogger.h lib/errortypes.h lib/suppressions.h lib/utils.h test/testsuite.h
test/testutils.o: test/testutils.cpp lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h test/testutils.h
$(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testutils.o test/testutils.cpp
test/testvaarg.o: test/testvaarg.cpp lib/check.h lib/checkvaarg.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h