1# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
2# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
3name: address sanitizer
4
5on: [push, pull_request]
6
7jobs:
8  build:
9
10    runs-on: ubuntu-20.04
11
12    env:
13      ASAN_OPTIONS: detect_stack_use_after_return=1
14
15    steps:
16      - uses: actions/checkout@v2
17
18      - name: Install missing software on ubuntu
19        run: |
20          sudo apt-get update
21          sudo apt-get install libz3-4 libz3-dev
22
23      - name: Build
24        run: make -j$(nproc) cppcheck testrunner USE_Z3=yes HAVE_RULES=yes MATCHCOMPILER=yes VERIFY=1
25        env:
26          CC: clang
27          CXX: clang++
28          CXXFLAGS: "-fsanitize=address -O1 -g3 -DCPPCHK_GLIBCXX_DEBUG"
29          CPPFLAGS: "-DCHECK_INTERNAL"
30
31      - name: Run tests
32        run: ./testrunner
33
34# Does not work
35#      - name: Self check
36#        run: |
37#          ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings cli lib
38#          ./cppcheck -q -j$(nproc) --std=c++11 --template=selfcheck -D__CPPCHECK__ -DQT_VERSION=0x050000 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --enable=style,performance,portability,warning,internal --exception-handling --debug-warnings gui/*.cpp
39#          ./cppcheck -q -j$(nproc) --std=c++11 --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
40
41# This takes too long time right now
42#      - name: Bughunting lib
43#        run: ./cppcheck -D__CPPCHECK__ --bug-hunting -j$(nproc) lib
44
45