Meta: Add GitHub Actions workflow for Lagom with Fuzzers

There are cases where Lagom will build with GCC but not Clang.
This often goes unnoticed for a while as we don't often build with
Clang.

However, this is now important to test in CI because of the
OSS-Fuzz integration.

Note that this only tests the build, it does not run any tests.
Note that it also only builds LagomCore, Lagom and the fuzzers.
It does not build the other programs that use Lagom.
This commit is contained in:
Luke 2020-11-29 19:01:40 +00:00 committed by Andreas Kling
parent d7455018eb
commit 5c911ad4b1
Notes: sideshowbarker 2024-07-19 01:11:26 +09:00
3 changed files with 32 additions and 2 deletions

View file

@ -105,3 +105,31 @@ jobs:
${{ toJSON(github.event) }}
]
EOF
build_lagom_with_fuzzers:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
# === OS SETUP ===
- name: Check versions
run: set +e; clang --version; clang++ --version
# === PREPARE FOR BUILDING ===
# TODO: ccache
# https://cristianadam.eu/20200113/speeding-up-c-plus-plus-github-actions-using-ccache/
# https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml
- name: Create build environment
working-directory: ${{ github.workspace }}/Meta/Lagom
run: |
mkdir -p Build
cd Build
cmake -DBUILD_LAGOM=ON -DENABLE_FUZZER_SANITIZER=ON -DENABLE_ADDRESS_SANITIZER=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
# === ACTUALLY BUILD ===
- name: Build Lagom with Fuzzers
working-directory: ${{ github.workspace }}/Meta/Lagom/Build
run: cmake --build . -j2

View file

@ -82,7 +82,7 @@ add_library(LagomCore ${LAGOM_CORE_SOURCES})
if (BUILD_LAGOM)
add_library(Lagom $<TARGET_OBJECTS:LagomCore> ${LAGOM_MORE_SOURCES})
if (NOT ENABLE_OSS_FUZZ)
if (NOT ENABLE_OSS_FUZZ AND NOT ENABLE_FUZZER_SANITIZER)
add_executable(TestApp TestApp.cpp)
target_link_libraries(TestApp Lagom)
target_link_libraries(TestApp stdc++)

View file

@ -31,8 +31,10 @@ add_simple_fuzzer(FuzzRegexECMA262)
add_simple_fuzzer(FuzzRegexPosixExtended)
add_simple_fuzzer(FuzzShell)
if (NOT ENABLE_OSS_FUZZ)
if (NOT ENABLE_OSS_FUZZ AND NOT ENABLE_FUZZER_SANITIZER)
add_executable(FuzzilliJs FuzzilliJs.cpp)
# FIXME: For some reason, these option overrides are ignored and FuzzilliJs gets treated
# as a regular fuzzer. Once fixed, please remove the "AND NOT ENABLE_FUZZER_SANITIZER" above.
target_compile_options(FuzzilliJs
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize-coverage=trace-pc-guard>
)