2022-08-23 20:30:45 +02: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
|
|
|
|
name: thread sanitizer
|
|
|
|
|
2023-09-01 18:52:20 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
- 'releases/**'
|
|
|
|
tags:
|
|
|
|
- '2.*'
|
|
|
|
pull_request:
|
2022-08-23 20:30:45 +02:00
|
|
|
|
2022-08-26 23:25:07 +02:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-08-23 20:30:45 +02:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
|
|
|
|
env:
|
2023-04-01 09:40:10 +02:00
|
|
|
QT_VERSION: 5.15.2
|
2022-08-23 20:30:45 +02:00
|
|
|
TSAN_OPTIONS: halt_on_error=1
|
2023-04-01 09:40:10 +02:00
|
|
|
# TODO: figure out why there are cache misses with PCH enabled
|
|
|
|
CCACHE_SLOPPINESS: pch_defines,time_macros
|
2022-08-23 20:30:45 +02:00
|
|
|
|
|
|
|
steps:
|
2022-10-11 19:50:59 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-08-23 20:30:45 +02:00
|
|
|
|
2023-04-01 09:40:10 +02:00
|
|
|
- name: ccache
|
|
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
|
|
with:
|
|
|
|
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
|
|
|
|
|
2023-10-04 10:09:49 +02:00
|
|
|
- name: Set up Python 3.12
|
2022-10-11 19:50:59 +02:00
|
|
|
uses: actions/setup-python@v4
|
2022-08-23 20:30:45 +02:00
|
|
|
with:
|
2023-10-04 10:09:49 +02:00
|
|
|
python-version: '3.12'
|
2022-10-25 21:53:02 +02:00
|
|
|
check-latest: true
|
2022-08-23 20:30:45 +02:00
|
|
|
|
|
|
|
- name: Install missing software on ubuntu
|
|
|
|
run: |
|
2022-08-23 21:40:31 +02:00
|
|
|
sudo apt-get update
|
2023-12-16 17:03:03 +01:00
|
|
|
sudo apt-get install -y cmake make libpcre3-dev libboost-container-dev libxml2-utils
|
2022-08-23 21:40:31 +02:00
|
|
|
|
|
|
|
- name: Install clang
|
|
|
|
run: |
|
2023-08-01 14:28:13 +02:00
|
|
|
sudo apt-get purge --auto-remove llvm python3-lldb-14 llvm-14
|
2022-08-23 21:40:31 +02:00
|
|
|
wget https://apt.llvm.org/llvm.sh
|
|
|
|
chmod +x llvm.sh
|
2023-08-09 12:45:15 +02:00
|
|
|
sudo ./llvm.sh 17
|
2022-08-23 20:30:45 +02:00
|
|
|
|
2023-04-01 09:40:10 +02:00
|
|
|
- name: Install Qt ${{ env.QT_VERSION }}
|
|
|
|
if: false
|
|
|
|
uses: jurplel/install-qt-action@v3
|
|
|
|
with:
|
|
|
|
version: ${{ env.QT_VERSION }}
|
|
|
|
modules: 'qtcharts'
|
|
|
|
cache: true
|
|
|
|
|
2023-12-16 17:03:03 +01:00
|
|
|
- name: Install missing Python packages
|
|
|
|
run: |
|
|
|
|
python3 -m pip install pip --upgrade
|
|
|
|
python3 -m pip install pytest
|
|
|
|
python3 -m pip install pytest-timeout
|
|
|
|
|
2022-08-23 20:30:45 +02:00
|
|
|
- name: CMake
|
|
|
|
run: |
|
2023-04-01 09:40:10 +02:00
|
|
|
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=Off -DWITH_QCHART=Off -DUSE_MATCHCOMPILER=Verify -DANALYZE_THREAD=On -DUSE_THREADS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=Off -DDISABLE_DMAKE=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
2022-08-23 20:30:45 +02:00
|
|
|
env:
|
2023-08-09 12:45:15 +02:00
|
|
|
CC: clang-17
|
|
|
|
CXX: clang++-17
|
2022-08-23 20:30:45 +02:00
|
|
|
|
|
|
|
- name: Build cppcheck
|
|
|
|
run: |
|
|
|
|
cmake --build cmake.output --target cppcheck -- -j $(nproc)
|
|
|
|
|
|
|
|
- name: Build test
|
|
|
|
run: |
|
|
|
|
cmake --build cmake.output --target testrunner -- -j $(nproc)
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
run: ./cmake.output/bin/testrunner
|
|
|
|
|
2023-12-16 17:03:03 +01:00
|
|
|
- name: Run cfg tests
|
|
|
|
run: |
|
|
|
|
cmake --build cmake.output --target checkcfg -- -j $(nproc)
|
|
|
|
|
|
|
|
# TODO: we should use CTest instead to parallelize tests but the start-up overhead will slow things down
|
|
|
|
- name: Run CTest
|
|
|
|
if: false
|
|
|
|
run: |
|
|
|
|
ctest --test-dir cmake.output --output-on-failure -j$(nproc)
|
|
|
|
|
|
|
|
- name: Run test/cli
|
|
|
|
run: |
|
|
|
|
pwd=$(pwd)
|
|
|
|
cd test/cli
|
|
|
|
TEST_CPPCHECK_EXE_LOOKUP_PATH="$pwd/cmake.output" python3 -m pytest -Werror --strict-markers -vv test-*.py
|
|
|
|
|
2023-04-01 09:40:10 +02:00
|
|
|
- name: Generate dependencies
|
|
|
|
if: false
|
|
|
|
run: |
|
|
|
|
# make sure auto-generated GUI files exist
|
|
|
|
make -C cmake.output autogen
|
|
|
|
make -C cmake.output gui-build-deps triage-build-ui-deps
|
|
|
|
|
2022-08-23 20:30:45 +02:00
|
|
|
# TODO: disabled for now as it takes around 40 minutes to finish
|
2022-09-06 23:11:39 +02:00
|
|
|
# set --error-exitcode=0 so we only fail on sanitizer issues - since it uses threads for execution it will exit the whole process on the first issue
|
2022-08-23 20:30:45 +02:00
|
|
|
- name: Self check
|
|
|
|
if: false
|
|
|
|
run: |
|
2023-10-26 10:52:44 +02:00
|
|
|
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5_summary -D__GNUC__ --error-exitcode=0 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=gnu --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings --check-level=exhaustive"
|
|
|
|
cppcheck_options="-D__CPPCHECK__ -DCHECK_INTERNAL -DHAVE_RULES --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2"
|
2022-08-23 20:30:45 +02:00
|
|
|
ec=0
|
2023-10-26 10:52:44 +02:00
|
|
|
./cmake.output/bin/cppcheck $selfcheck_options externals/simplecpp || ec=1
|
|
|
|
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1
|
2023-10-26 14:55:59 +02:00
|
|
|
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1
|
2023-10-26 10:52:44 +02:00
|
|
|
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -Icli test/*.cpp tools/*.cpp || ec=1
|
2023-10-26 14:55:59 +02:00
|
|
|
./cmake.output/bin/cppcheck $selfcheck_options $cppcheck_options -DQ_MOC_OUTPUT_REVISION=68 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1
|
2022-08-23 20:30:45 +02:00
|
|
|
exit $ec
|