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:
|
2021-01-03 10:41:43 +01:00
|
|
|
os: [ubuntu-18.04, ubuntu-20.04, macos-10.15]
|
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
|
|
|
|
|
2021-04-03 21:22:39 +02:00
|
|
|
- name: Set up Python 3.9
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3.9
|
|
|
|
|
2020-12-09 09:46:23 +01:00
|
|
|
- name: Install missing software on ubuntu 18.04
|
|
|
|
if: matrix.os == 'ubuntu-18.04'
|
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
|
|
|
|
sudo apt-get install z3 libz3-dev
|
2020-05-13 05:03:32 +02:00
|
|
|
cp externals/z3_version_old.h externals/z3_version.h
|
2020-02-20 22:00:14 +01:00
|
|
|
|
2020-12-09 09:46:23 +01:00
|
|
|
- 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
|
|
|
|
|
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: |
|
2020-10-23 11:58:25 +02:00
|
|
|
brew install coreutils z3
|
2020-12-09 09:46:23 +01:00
|
|
|
cp externals/z3_version_old.h externals/z3_version.h
|
2021-04-03 21:22:39 +02:00
|
|
|
|
|
|
|
- name: Install missing Python packages
|
|
|
|
run: |
|
|
|
|
python -m pip install pip --upgrade
|
|
|
|
python -m pip install pytest
|
2020-05-03 10:10:39 +02:00
|
|
|
|
|
|
|
- name: Install Qt
|
2020-12-09 09:46:23 +01:00
|
|
|
if: contains(matrix.os, 'ubuntu')
|
2020-05-03 10:10:39 +02:00
|
|
|
uses: jurplel/install-qt-action@v2
|
|
|
|
with:
|
|
|
|
modules: 'qtcharts'
|
2020-02-20 22:00:14 +01:00
|
|
|
|
2020-09-05 18:29:19 +02:00
|
|
|
- name: Test CMake build
|
|
|
|
run: |
|
|
|
|
mkdir cmake.output
|
|
|
|
cd cmake.output
|
2021-02-20 13:23:57 +01:00
|
|
|
cmake -G "Unix Makefiles" -DUSE_Z3=On -DHAVE_RULES=On -DBUILD_TESTS=On ..
|
2020-09-05 18:29:19 +02:00
|
|
|
make -j$(nproc) check
|
|
|
|
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
|
2020-07-30 10:36:06 +02:00
|
|
|
make -j$(nproc) USE_Z3=yes HAVE_RULES=yes
|
2020-02-20 22:00:14 +01:00
|
|
|
|
|
|
|
- name: Build test
|
|
|
|
run: |
|
2020-07-30 10:36:06 +02:00
|
|
|
make -j$(nproc) testrunner USE_Z3=yes 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: |
|
2020-07-30 10:36:06 +02:00
|
|
|
make -j$(nproc) check USE_Z3=yes 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
|
|
|
|
pytest test-*.py
|
|
|
|
cd ../../..
|
|
|
|
ln -s cppcheck 'cpp check'
|
|
|
|
cd 'cpp check/test/cli'
|
|
|
|
pytest test-*.py
|
2021-03-01 18:49:59 +01:00
|
|
|
|
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
|
2020-09-05 18:29:19 +02:00
|
|
|
|
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
|
|
|
|
qmake 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: |
|
|
|
|
pushd gui/test/projectfile
|
|
|
|
qmake
|
|
|
|
make -j$(nproc)
|
|
|
|
./test-projectfile
|
2021-01-18 19:10:53 +01:00
|
|
|
popd
|
|
|
|
pushd gui/test/cppchecklibrarydata
|
|
|
|
qmake
|
|
|
|
make -j$(nproc)
|
|
|
|
./test-cppchecklibrarydata
|
2020-09-05 18:29:19 +02:00
|
|
|
|
2020-10-11 03:48:34 +02:00
|
|
|
- name: Generate Qt help file on ubuntu
|
2020-12-09 09:46:23 +01:00
|
|
|
if: contains(matrix.os, 'ubuntu')
|
2020-10-11 03:48:34 +02:00
|
|
|
run: |
|
|
|
|
pushd gui/help
|
|
|
|
qhelpgenerator online-help.qhcp -o online-help.qhc
|
|
|
|
|
2020-09-05 18:29:19 +02:00
|
|
|
# Run self check after "Build GUI" to include generated headers in analysis
|
|
|
|
- name: Self check
|
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
|
|
|
|
# self check lib/cli
|
|
|
|
mkdir b1
|
2021-01-21 18:29:08 +01:00
|
|
|
./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
|
2020-09-05 18:29:19 +02:00
|
|
|
# check gui with qt settings
|
|
|
|
mkdir b2
|
2021-01-21 18:29:08 +01:00
|
|
|
./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
|
2020-09-05 18:29:19 +02:00
|
|
|
# self check test and tools
|
2021-01-21 18:29:08 +01:00
|
|
|
./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
|
2020-09-05 18:29:19 +02:00
|
|
|
|
|
|
|
- name: Build triage on ubuntu
|
2020-12-15 10:59:09 +01:00
|
|
|
if: matrix.os == 'ubuntu-20.04'
|
2020-09-05 18:29:19 +02:00
|
|
|
run: |
|
|
|
|
pushd tools/triage
|
|
|
|
qmake
|
|
|
|
make -j$(nproc)
|
|
|
|
|
2020-10-23 11:58:25 +02:00
|
|
|
- name: Build Fuzzer
|
2020-12-15 10:59:09 +01:00
|
|
|
if: matrix.os == 'ubuntu-20.04'
|
2020-09-05 18:29:19 +02:00
|
|
|
run: |
|
2020-12-16 10:16:33 +01:00
|
|
|
pushd oss-fuzz
|
|
|
|
make -j$(nproc) CXX=clang++ CXXFLAGS="-fsanitize=address" fuzz-client translate
|