Moved some stuff from Travis to GitHub Actions / Cleanups (#3715)

This commit is contained in:
Oliver Stöneberg 2022-05-31 19:53:50 +02:00 committed by GitHub
parent 40bcbd47d6
commit 5e2afacdb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 71 deletions

View File

@ -59,19 +59,17 @@ jobs:
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | run: |
mkdir cmake.output mkdir cmake.output
cd cmake.output pushd cmake.output
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On .. cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On ..
cmake --build . -- -j$(nproc) cmake --build . -- -j$(nproc)
cd ..
- name: CMake build on macos (with GUI) - name: CMake build on macos (with GUI)
if: contains(matrix.os, 'macos') if: contains(matrix.os, 'macos')
run: | run: |
mkdir cmake.output mkdir cmake.output
cd cmake.output pushd cmake.output
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5 .. cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5 ..
cmake --build . -- -j$(nproc) cmake --build . -- -j$(nproc)
cd ..
- name: Run CMake test - name: Run CMake test
run: | run: |
@ -79,16 +77,28 @@ jobs:
- name: Run CTest - name: Run CTest
run: | run: |
cd cmake.output pushd cmake.output
ctest -j$(nproc) ctest -j$(nproc)
cd ..
- name: Build and test with Unsigned char - name: Build with Unsigned char
run: | run: |
make clean make clean
make -j$(nproc) CXXFLAGS=-funsigned-char testrunner make -j$(nproc) CXXFLAGS=-funsigned-char testrunner
- name: Test with Unsigned char
run: |
./testrunner TestSymbolDatabase ./testrunner TestSymbolDatabase
- name: Build with TEST_MATHLIB_VALUE
run: |
make clean
touch lib/mathlib.cpp test/testmathlib.cpp
make -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE all
- name: Test with TEST_MATHLIB_VALUE
run: |
make -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE check
- name: Check syntax with NONNEG - name: Check syntax with NONNEG
run: | run: |
ls lib/*.cpp | xargs -n 1 -P $(nproc) g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG ls lib/*.cpp | xargs -n 1 -P $(nproc) g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG
@ -112,6 +122,7 @@ jobs:
run: | run: |
tools/generate_and_run_more_tests.sh tools/generate_and_run_more_tests.sh
# do not use pushd in this step since we go below the working directory
- name: Run test/cli - name: Run test/cli
run: | run: |
cd test/cli cd test/cli
@ -149,14 +160,33 @@ jobs:
run: | run: |
make -j$(nproc) checkCWEEntries validateXML make -j$(nproc) checkCWEEntries validateXML
# TODO: move to scriptcheck.yml so these are tested with all Python versions?
- name: Test addons - name: Test addons
run: | run: |
./cppcheck --addon=threadsafety addons/test/threadsafety ./cppcheck --addon=threadsafety addons/test/threadsafety
./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety ./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety
./cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons/test/misra/misra-ctu-*-test.c ./cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons/test/misra/misra-ctu-*-test.c
cd addons/test pushd addons/test
../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test.c --std=c89 --platform=unix64 && python3 ../misra.py -verify misra/misra-test.c.dump # We'll force C89 standard to enable an additional verification for
# rules 5.4 and 5.5 which have standard-dependent options.
../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test.c --std=c89 --platform=unix64
python3 ../misra.py -verify misra/misra-test.c.dump
# TODO: do we need to verify something here?
../../cppcheck --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.h
../../cppcheck --dump misra/misra-test.cpp
python3 ../misra.py -verify misra/misra-test.cpp.dump
python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_ascii.txt -verify misra/misra-test.cpp.dump
python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_utf8.txt -verify misra/misra-test.cpp.dump
python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump
../../cppcheck --addon=misra --platform=avr8 --error-exitcode=1 misra/misra-test-avr8.c ../../cppcheck --addon=misra --platform=avr8 --error-exitcode=1 misra/misra-test-avr8.c
../../cppcheck --dump misc-test.cpp
python3 ../misc.py -verify misc-test.cpp.dump
../../cppcheck --dump naming_test.c
python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump
../../cppcheck --dump naming_test.cpp
python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump
../../cppcheck --dump namingng_test.c
python3 ../namingng.py --configfile ../naming.json --verify namingng_test.c.dump
- name: Ensure misra addon does not crash - name: Ensure misra addon does not crash
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')

View File

@ -178,7 +178,29 @@ jobs:
- name: Test addons - name: Test addons
if: matrix.qt_ver == '' if: matrix.qt_ver == ''
run: | run: |
.\cppcheck.exe --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c .\cppcheck --addon=threadsafety addons\test\threadsafety || exit /b !errorlevel!
.\cppcheck --addon=threadsafety --std=c++03 addons\test\threadsafety || exit /b !errorlevel!
.\cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons\test\misra\misra-ctu-*-test.c || exit /b !errorlevel!
cd addons\test cd addons\test
..\..\cppcheck.exe --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 && python3 ..\misra.py -verify misra\misra-test.c.dump rem We'll force C89 standard to enable an additional verification for
rem rules 5.4 and 5.5 which have standard-dependent options.
..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra\misra-test.c --std=c89 --platform=unix64 || exit /b !errorlevel!
python3 ..\misra.py -verify misra\misra-test.c.dump || exit /b !errorlevel!
rem TODO: do we need to verify something here?
..\..\cppcheck --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra\misra-test.h || exit /b !errorlevel!
..\..\cppcheck --dump misra\misra-test.cpp || exit /b !errorlevel!
python3 ..\misra.py -verify misra\misra-test.cpp.dump || exit /b !errorlevel!
python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_ascii.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel!
python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_utf8.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel!
python3 ..\misra.py --rule-texts=misra\misra2012_rules_dummy_windows1250.txt -verify misra\misra-test.cpp.dump || exit /b !errorlevel!
..\..\cppcheck --addon=misra --platform=avr8 --error-exitcode=1 misra\misra-test-avr8.c || exit /b !errorlevel!
..\..\cppcheck --dump misc-test.cpp || exit /b !errorlevel!
python3 ..\misc.py -verify misc-test.cpp.dump || exit /b !errorlevel!
..\..\cppcheck --dump naming_test.c || exit /b !errorlevel!
rem TODO: fix this - does not fail on Linux
rem python3 ..\naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump || exit /b !errorlevel!
..\..\cppcheck --dump naming_test.cpp || exit /b !errorlevel!
python3 ..\naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump || exit /b !errorlevel!
..\..\cppcheck --dump namingng_test.c || exit /b !errorlevel!
python3 ..\namingng.py --configfile ..\naming.json --verify namingng_test.c.dump || exit /b !errorlevel!

View File

@ -16,19 +16,9 @@ env:
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" MATCHCOMPILER=yes VERIFY=1 - CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" MATCHCOMPILER=yes VERIFY=1
before_install: before_install:
# Python 2 modules # install needed deps
- travis_retry python2 -m pip install --user pytest==4.6.4 - travis_retry sudo apt-get update -qq
- travis_retry python2 -m pip install --user unittest2 - travis_retry sudo apt-get install -qq libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet liblua5.3-dev libcurl3 libcairo2-dev libsigc++-2.0-dev tidy libopencv-dev
- travis_retry python2 -m pip install --user pexpect # imported by tools/ci.py
- travis_retry python2 -m pip install --user pygments
# Python 3 modules
- travis_retry python3 -m pip install --user setuptools --upgrade
- travis_retry python3 -m pip install --user pytest
- travis_retry python3 -m pip install --user unittest2
- travis_retry python3 -m pip install --user pexpect # imported by tools/ci.py
- travis_retry python3 -m pip install --user requests # imported by tools/pr.py
- travis_retry python3 -m pip install --user pygments
- travis_retry python3 -m pip install --user natsort
matrix: matrix:
# do notify immediately about it when a job of a build fails. # do notify immediately about it when a job of a build fails.
@ -51,50 +41,3 @@ matrix:
- echo $CXXFLAGS - echo $CXXFLAGS
- make -s MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck -j$(nproc) - make -s MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck -j$(nproc)
- sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck install - sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck install
# check if it actually works:
- /usr/bin/cppcheck -j$(nproc) ./cli
# check addons/misc.py
- cd addons/test
- ${CPPCHECK} --dump misc-test.cpp
- python3 ../misc.py -verify misc-test.cpp.dump
- cd ../../
# check addons/misra.py
- cd addons/test
# We'll force C89 standard to enable an additional verification for
# rules 5.4 and 5.5 which have standard-dependent options.
- ${CPPCHECK} --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.c
- ${CPPCHECK} --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.h
- python3 ../misra.py -verify misra/misra-test.c.dump
- ${CPPCHECK} --dump misra/misra-test.cpp
- python3 ../misra.py -verify misra/misra-test.cpp.dump
- python ../misra.py --rule-texts=misra/misra2012_rules_dummy_ascii.txt -verify misra/misra-test.cpp.dump
- python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_ascii.txt -verify misra/misra-test.cpp.dump
- python ../misra.py --rule-texts=misra/misra2012_rules_dummy_utf8.txt -verify misra/misra-test.cpp.dump
- python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_utf8.txt -verify misra/misra-test.cpp.dump
- python ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump
- python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump
- cd ../../
# check addons/naming.py
- cd addons/test
- ${CPPCHECK} --dump naming_test.c
- python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump
- ${CPPCHECK} --dump naming_test.cpp
- python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump
- cd ../..
# check addons/namingng.py
- cd addons/test
- ${CPPCHECK} --dump namingng_test.c
- python3 ../namingng.py --configfile ../naming.json --verify namingng_test.c.dump
- cd ../..
script:
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
- set -e
# check with TEST_MATHLIB_VALUE enabled
- touch lib/mathlib.cpp test/testmathlib.cpp
- echo $CXXFLAGS
- make -s check -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE
- touch lib/mathlib.cpp test/testmathlib.cpp
# compile cppcheck, default build
- echo $CXXFLAGS
- make -s check -j$(nproc)