# 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 name: CI-unixish on: [push, pull_request] jobs: build: strategy: matrix: os: [ubuntu-18.04, ubuntu-20.04, macos-10.15] fail-fast: false # Prefer quick result runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Set up Python 3.9 uses: actions/setup-python@v2 with: python-version: 3.9 - name: Install missing software on ubuntu 18.04 if: matrix.os == 'ubuntu-18.04' run: | sudo apt-get update sudo apt-get install libxml2-utils sudo apt-get install z3 libz3-dev cp externals/z3_version_old.h externals/z3_version.h - name: Install missing software on ubuntu 20.04 if: matrix.os == 'ubuntu-20.04' run: | sudo apt-get update sudo apt-get install libxml2-utils sudo apt-get install z3 libz3-dev - name: Install missing software on macos if: contains(matrix.os, 'macos') run: | brew install coreutils z3 cp externals/z3_version_old.h externals/z3_version.h - name: Install missing Python packages run: | python -m pip install pip --upgrade python -m pip install pytest - name: Install Qt if: contains(matrix.os, 'ubuntu') uses: jurplel/install-qt-action@v2 with: modules: 'qtcharts' - name: Test CMake build run: | mkdir cmake.output cd cmake.output cmake -G "Unix Makefiles" -DUSE_Z3=On -DHAVE_RULES=On -DBUILD_TESTS=On .. make -j$(nproc) check cd .. - name: Build and test with Unsigned char run: | make clean 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 make -j$(nproc) USE_Z3=yes HAVE_RULES=yes - name: Build test run: | make -j$(nproc) testrunner USE_Z3=yes HAVE_RULES=yes - name: Run test run: | make -j$(nproc) check USE_Z3=yes HAVE_RULES=yes # the script uses sed parameters not supported by MacOS - name: Run extra tests if: contains(matrix.os, 'ubuntu') run: | tools/generate_and_run_more_tests.sh - name: Run test/cli run: | cd test/cli pytest test-*.py cd ../../.. ln -s cppcheck 'cpp check' cd 'cpp check/test/cli' pytest test-*.py - name: Validate run: | make -j$(nproc) checkCWEEntries validateXML - name: Test addons run: | ./cppcheck --addon=threadsafety addons/test/threadsafety ./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety - name: Build GUI on ubuntu if: contains(matrix.os, 'ubuntu') run: | pushd gui qmake HAVE_QCHART=yes make -j$(nproc) - name: Run GUI tests on ubuntu if: contains(matrix.os, 'ubuntu') run: | pushd gui/test/projectfile qmake make -j$(nproc) ./test-projectfile popd pushd gui/test/cppchecklibrarydata qmake make -j$(nproc) ./test-cppchecklibrarydata - name: Generate Qt help file on ubuntu if: contains(matrix.os, 'ubuntu') run: | pushd gui/help qhelpgenerator online-help.qhcp -o online-help.qhc # Run self check after "Build GUI" to include generated headers in analysis - name: Self check if: matrix.os == 'ubuntu-20.04' run: | # compile with verification and ast matchers make clean make -j$(nproc) -s CPPFLAGS="-DCHECK_INTERNAL" CXXFLAGS="-g -O2" MATCHCOMPILER=yes VERIFY=1 # self check lib/cli mkdir b1 ./cppcheck -q -j$(nproc) --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,internal --exception-handling --debug-warnings cli lib # check gui with qt settings mkdir b2 ./cppcheck -q -j$(nproc) --template=selfcheck --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp # self check test and tools ./cppcheck -q -j$(nproc) --template=selfcheck -D__CPPCHECK__ --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,internal --exception-handling --debug-warnings test/*.cpp tools - name: Build triage on ubuntu if: matrix.os == 'ubuntu-20.04' run: | pushd tools/triage qmake 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