2020-02-13 09:16:53 +01:00
|
|
|
# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
|
|
|
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
|
2020-04-16 21:37:32 +02:00
|
|
|
name: CI-unixish
|
2020-02-13 09:16:53 +01:00
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
2020-02-20 22:00:14 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-05-21 09:07:14 +02:00
|
|
|
os: [ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11, macos-12]
|
2020-12-09 09:46:23 +01:00
|
|
|
fail-fast: false # Prefer quick result
|
2020-02-20 22:00:14 +01:00
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
2020-02-13 09:16:53 +01:00
|
|
|
|
|
|
|
steps:
|
2020-02-20 22:00:14 +01:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2022-01-24 21:55:48 +01:00
|
|
|
- name: Install missing software on ubuntu
|
|
|
|
if: contains(matrix.os, 'ubuntu')
|
2020-02-20 22:00:14 +01:00
|
|
|
run: |
|
2020-04-07 20:30:10 +02:00
|
|
|
sudo apt-get update
|
2020-02-20 22:00:14 +01:00
|
|
|
sudo apt-get install libxml2-utils
|
2022-04-11 07:30:55 +02:00
|
|
|
sudo apt-get install libtinyxml2-dev
|
2022-01-24 21:55:48 +01:00
|
|
|
sudo apt-get install qtbase5-dev qttools5-dev libqt5charts5-dev qt5-default
|
2020-02-20 22:00:14 +01:00
|
|
|
|
2022-05-10 13:03:58 +02:00
|
|
|
# packages for strict cfg checks
|
|
|
|
- name: Install missing software on ubuntu 20.04
|
|
|
|
if: matrix.os == 'ubuntu-20.04'
|
|
|
|
run: |
|
|
|
|
sudo apt-get install libcairo2-dev libcurl4-openssl-dev liblua5.3-dev libssl-dev libsqlite3-dev libcppunit-dev libsigc++-2.0-dev libgtk-3-dev libboost-all-dev libwxgtk3.0-gtk3-dev xmlstarlet
|
|
|
|
|
2020-02-20 22:00:14 +01:00
|
|
|
- name: Install missing software on macos
|
2020-12-09 09:46:23 +01:00
|
|
|
if: contains(matrix.os, 'macos')
|
2020-02-20 22:00:14 +01:00
|
|
|
run: |
|
2022-04-11 07:30:55 +02:00
|
|
|
brew install coreutils python3 qt@5
|
2021-04-03 21:22:39 +02:00
|
|
|
|
|
|
|
- name: Install missing Python packages
|
|
|
|
run: |
|
2022-02-11 19:37:32 +01:00
|
|
|
python3 -m pip install pip --upgrade
|
|
|
|
python3 -m pip install pytest
|
2021-12-16 17:45:34 +01:00
|
|
|
|
2022-02-06 13:02:52 +01:00
|
|
|
- name: CMake build on ubuntu (with GUI / system tinyxml2)
|
|
|
|
if: contains(matrix.os, 'ubuntu')
|
|
|
|
run: |
|
|
|
|
mkdir cmake.output.tinyxml2
|
|
|
|
cd cmake.output.tinyxml2
|
2022-04-11 07:30:55 +02:00
|
|
|
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off ..
|
2022-02-06 13:02:52 +01:00
|
|
|
cmake --build . -- -j$(nproc)
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
- name: Run CMake test (system tinyxml2)
|
|
|
|
if: contains(matrix.os, 'ubuntu')
|
|
|
|
run: |
|
|
|
|
cmake --build cmake.output.tinyxml2 --target check -- -j$(nproc)
|
|
|
|
|
2022-01-24 21:55:48 +01:00
|
|
|
- name: CMake build on ubuntu (with GUI)
|
2021-12-17 13:06:50 +01:00
|
|
|
if: contains(matrix.os, 'ubuntu')
|
2020-09-05 18:29:19 +02:00
|
|
|
run: |
|
|
|
|
mkdir cmake.output
|
|
|
|
cd cmake.output
|
2022-04-11 07:30:55 +02:00
|
|
|
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On ..
|
2021-12-15 19:36:34 +01:00
|
|
|
cmake --build . -- -j$(nproc)
|
|
|
|
cd ..
|
|
|
|
|
2022-01-24 21:55:48 +01:00
|
|
|
- name: CMake build on macos (with GUI)
|
2021-12-16 17:45:34 +01:00
|
|
|
if: contains(matrix.os, 'macos')
|
|
|
|
run: |
|
|
|
|
mkdir cmake.output
|
|
|
|
cd cmake.output
|
2022-04-11 07:30:55 +02:00
|
|
|
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 ..
|
2021-12-16 17:45:34 +01:00
|
|
|
cmake --build . -- -j$(nproc)
|
|
|
|
cd ..
|
|
|
|
|
2021-12-15 19:36:34 +01:00
|
|
|
- name: Run CMake test
|
|
|
|
run: |
|
|
|
|
cmake --build cmake.output --target check -- -j$(nproc)
|
|
|
|
|
|
|
|
- name: Run CTest
|
|
|
|
run: |
|
|
|
|
cd cmake.output
|
|
|
|
ctest -j$(nproc)
|
2020-09-05 18:29:19 +02:00
|
|
|
cd ..
|
|
|
|
|
2020-10-23 11:58:25 +02:00
|
|
|
- name: Build and test with Unsigned char
|
2020-09-05 18:29:19 +02:00
|
|
|
run: |
|
|
|
|
make clean
|
|
|
|
make -j$(nproc) CXXFLAGS=-funsigned-char testrunner
|
|
|
|
./testrunner TestSymbolDatabase
|
|
|
|
|
2021-02-21 14:17:02 +01:00
|
|
|
- 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
|
|
|
|
|
2020-02-20 22:00:14 +01:00
|
|
|
- name: Build cppcheck
|
|
|
|
run: |
|
2020-09-05 18:29:19 +02:00
|
|
|
make clean
|
2022-04-11 07:30:55 +02:00
|
|
|
make -j$(nproc) HAVE_RULES=yes
|
2020-02-20 22:00:14 +01:00
|
|
|
|
|
|
|
- name: Build test
|
|
|
|
run: |
|
2022-04-11 07:30:55 +02:00
|
|
|
make -j$(nproc) testrunner HAVE_RULES=yes
|
2020-02-20 22:00:14 +01:00
|
|
|
|
2020-05-03 10:10:39 +02:00
|
|
|
- name: Run test
|
2020-02-20 22:00:14 +01:00
|
|
|
run: |
|
2022-04-11 07:30:55 +02:00
|
|
|
make -j$(nproc) check HAVE_RULES=yes
|
2020-02-20 22:00:14 +01:00
|
|
|
|
2021-04-03 21:22:39 +02:00
|
|
|
# the script uses sed parameters not supported by MacOS
|
|
|
|
- name: Run extra tests
|
2021-03-01 18:49:59 +01:00
|
|
|
if: contains(matrix.os, 'ubuntu')
|
|
|
|
run: |
|
2021-04-03 21:22:39 +02:00
|
|
|
tools/generate_and_run_more_tests.sh
|
|
|
|
|
|
|
|
- name: Run test/cli
|
|
|
|
run: |
|
|
|
|
cd test/cli
|
2022-02-11 19:37:32 +01:00
|
|
|
python3 -m pytest test-*.py
|
2021-04-03 21:22:39 +02:00
|
|
|
cd ../../..
|
|
|
|
ln -s cppcheck 'cpp check'
|
|
|
|
cd 'cpp check/test/cli'
|
2022-02-11 19:37:32 +01:00
|
|
|
python3 -m pytest test-*.py
|
2021-03-01 18:49:59 +01:00
|
|
|
|
2021-04-09 07:47:11 +02:00
|
|
|
# fails on macos since some includes (e.g. sys/epoll.h) are not available
|
|
|
|
- name: Run cfg tests
|
2022-05-10 13:03:58 +02:00
|
|
|
if: contains(matrix.os, 'ubuntu') && matrix.os != 'ubuntu-20.04'
|
|
|
|
run: |
|
|
|
|
make -j$(nproc) checkcfg
|
|
|
|
|
|
|
|
- name: Run cfg tests (strict)
|
|
|
|
if: matrix.os == 'ubuntu-20.04'
|
2021-04-09 07:47:11 +02:00
|
|
|
run: |
|
|
|
|
make -j$(nproc) checkcfg
|
2022-05-10 13:03:58 +02:00
|
|
|
env:
|
|
|
|
STRICT: 1
|
2021-04-09 07:47:11 +02:00
|
|
|
|
|
|
|
# it seems macos has no "wc" command
|
|
|
|
- name: Run showtimetop5 tests
|
|
|
|
if: contains(matrix.os, 'ubuntu')
|
|
|
|
run: |
|
|
|
|
./tools/test_showtimetop5.sh
|
|
|
|
|
|
|
|
- name: Run --dump test
|
|
|
|
run: |
|
|
|
|
./cppcheck test/testpreprocessor.cpp --dump
|
|
|
|
xmllint --noout test/testpreprocessor.cpp.dump
|
|
|
|
|
2020-02-20 22:00:14 +01:00
|
|
|
- name: Validate
|
|
|
|
run: |
|
2021-02-21 14:17:02 +01:00
|
|
|
make -j$(nproc) checkCWEEntries validateXML
|
|
|
|
|
2020-10-23 11:58:25 +02:00
|
|
|
- name: Test addons
|
|
|
|
run: |
|
|
|
|
./cppcheck --addon=threadsafety addons/test/threadsafety
|
|
|
|
./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety
|
2021-07-17 22:36:03 +02:00
|
|
|
./cppcheck --addon=misra --inline-suppr --enable=information --error-exitcode=1 addons/test/misra/misra-ctu-*-test.c
|
2021-07-11 17:23:33 +02:00
|
|
|
cd addons/test
|
2021-07-22 08:46:28 +02:00
|
|
|
../../cppcheck --dump -DDUMMY --suppress=uninitvar --inline-suppr misra/misra-test.c --std=c89 --platform=unix64 && python3 ../misra.py -verify misra/misra-test.c.dump
|
2021-09-17 14:21:25 +02:00
|
|
|
../../cppcheck --addon=misra --platform=avr8 --error-exitcode=1 misra/misra-test-avr8.c
|
2020-09-05 18:29:19 +02:00
|
|
|
|
2022-05-17 22:15:49 +02:00
|
|
|
- name: Ensure misra addon does not crash
|
|
|
|
if: contains(matrix.os, 'ubuntu')
|
|
|
|
run: |
|
|
|
|
./cppcheck --addon=misra addons/test/misra/crash1.c | ( ! grep 'Bailing out from checking' )
|
|
|
|
|
2020-05-03 10:10:39 +02:00
|
|
|
- name: Build GUI on ubuntu
|
2020-12-09 09:46:23 +01:00
|
|
|
if: contains(matrix.os, 'ubuntu')
|
2020-05-03 10:10:39 +02:00
|
|
|
run: |
|
|
|
|
pushd gui
|
2021-12-19 12:36:11 +01:00
|
|
|
qmake CONFIG+=debug HAVE_QCHART=yes
|
2020-07-30 10:36:06 +02:00
|
|
|
make -j$(nproc)
|
|
|
|
|
2020-09-05 18:29:19 +02:00
|
|
|
- name: Run GUI tests on ubuntu
|
2020-12-09 09:46:23 +01:00
|
|
|
if: contains(matrix.os, 'ubuntu')
|
2020-09-05 18:29:19 +02:00
|
|
|
run: |
|
2021-12-19 12:36:11 +01:00
|
|
|
pushd gui/test/cppchecklibrarydata
|
|
|
|
qmake CONFIG+=debug
|
|
|
|
make -j$(nproc)
|
|
|
|
./test-cppchecklibrarydata
|
|
|
|
popd
|
|
|
|
pushd gui/test/filelist
|
|
|
|
qmake CONFIG+=debug
|
|
|
|
make -j$(nproc)
|
|
|
|
# TODO: requires X session
|
|
|
|
#./test-filelist
|
|
|
|
popd
|
2020-09-05 18:29:19 +02:00
|
|
|
pushd gui/test/projectfile
|
2021-12-19 12:36:11 +01:00
|
|
|
qmake CONFIG+=debug
|
2020-09-05 18:29:19 +02:00
|
|
|
make -j$(nproc)
|
|
|
|
./test-projectfile
|
2021-01-18 19:10:53 +01:00
|
|
|
popd
|
2021-12-19 12:36:11 +01:00
|
|
|
pushd gui/test/translationhandler
|
|
|
|
qmake CONFIG+=debug
|
2021-01-18 19:10:53 +01:00
|
|
|
make -j$(nproc)
|
2021-12-19 12:36:11 +01:00
|
|
|
# TODO: requires X session
|
|
|
|
#./test-translationhandler
|
|
|
|
popd
|
|
|
|
pushd gui/test/xmlreportv2
|
|
|
|
qmake CONFIG+=debug
|
|
|
|
make -j$(nproc)
|
|
|
|
# TODO: requires X session
|
|
|
|
#./test-xmlreportv2
|
2020-09-05 18:29:19 +02:00
|
|
|
|
2022-01-24 21:55:48 +01:00
|
|
|
- name: Generate Qt help file on ubuntu 18.04
|
|
|
|
if: matrix.os == 'ubuntu-18.04'
|
|
|
|
run: |
|
|
|
|
pushd gui/help
|
|
|
|
qcollectiongenerator online-help.qhcp -o online-help.qhc
|
|
|
|
|
|
|
|
- name: Generate Qt help file on ubuntu 20.04
|
|
|
|
if: matrix.os == 'ubuntu-20.04'
|
2020-10-11 03:48:34 +02:00
|
|
|
run: |
|
|
|
|
pushd gui/help
|
|
|
|
qhelpgenerator online-help.qhcp -o online-help.qhc
|
|
|
|
|
2021-12-19 12:36:11 +01:00
|
|
|
- name: Build triage on ubuntu
|
|
|
|
if: matrix.os == 'ubuntu-20.04'
|
|
|
|
run: |
|
|
|
|
pushd tools/triage
|
|
|
|
qmake CONFIG+=debug
|
|
|
|
make -j$(nproc)
|
|
|
|
|
|
|
|
- name: Build Fuzzer
|
|
|
|
if: matrix.os == 'ubuntu-20.04'
|
|
|
|
run: |
|
|
|
|
pushd oss-fuzz
|
|
|
|
make -j$(nproc) CXX=clang++ CXXFLAGS="-fsanitize=address" fuzz-client translate
|
|
|
|
|
2021-12-17 21:52:55 +01:00
|
|
|
- name: Self check (build)
|
2020-12-15 10:59:09 +01:00
|
|
|
if: matrix.os == 'ubuntu-20.04'
|
2020-09-05 18:29:19 +02:00
|
|
|
run: |
|
|
|
|
# compile with verification and ast matchers
|
|
|
|
make clean
|
|
|
|
make -j$(nproc) -s CPPFLAGS="-DCHECK_INTERNAL" CXXFLAGS="-g -O2" MATCHCOMPILER=yes VERIFY=1
|
2021-12-17 21:52:55 +01:00
|
|
|
|
|
|
|
# Run self check after "Build GUI" to include generated headers in analysis
|
|
|
|
- name: Self check
|
|
|
|
if: matrix.os == 'ubuntu-20.04'
|
|
|
|
run: |
|
2022-05-13 06:52:20 +02:00
|
|
|
ec=0
|
2020-09-05 18:29:19 +02:00
|
|
|
# self check lib/cli
|
|
|
|
mkdir b1
|
2022-05-13 06:52:20 +02:00
|
|
|
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b1 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings cli lib || ec=1
|
2020-09-05 18:29:19 +02:00
|
|
|
# check gui with qt settings
|
|
|
|
mkdir b2
|
2022-05-13 06:52:20 +02:00
|
|
|
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings gui/*.cpp gui/temp/*.cpp || ec=1
|
2020-09-05 18:29:19 +02:00
|
|
|
# self check test and tools
|
2022-05-13 06:52:20 +02:00
|
|
|
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings test/*.cpp tools/*.cpp || ec=1
|
2022-03-11 21:42:46 +01:00
|
|
|
# triage
|
2022-05-13 06:52:20 +02:00
|
|
|
./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQ_MOC_OUTPUT_REVISION=67 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Igui --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings tools/triage || ec=1
|
|
|
|
exit $ec
|