Add wasm overhead benchmarks #39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sanitizers | |
| on: | |
| push: | |
| paths-ignore: | |
| - "docs/**" | |
| - "Doxyfile" | |
| - "README.md" | |
| - "CHANGELOG.md" | |
| - "RELEASE_NOTES.md" | |
| - "SESSION.md" | |
| - "REVIEW.md" | |
| - "benchmark/**" | |
| - "imgs/**" | |
| - "**.md" | |
| pull_request: | |
| paths-ignore: | |
| - "docs/**" | |
| - "Doxyfile" | |
| - "README.md" | |
| - "CHANGELOG.md" | |
| - "RELEASE_NOTES.md" | |
| - "SESSION.md" | |
| - "REVIEW.md" | |
| - "benchmark/**" | |
| - "imgs/**" | |
| - "**.md" | |
| workflow_dispatch: | |
| jobs: | |
| asan-ubsan: | |
| name: ASan + UBSan (ubuntu-gcc) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Download Boost headers | |
| run: | | |
| set -euo pipefail | |
| boost_version="1.86.0" | |
| boost_tag="${boost_version//./_}" | |
| boost_archive="boost_${boost_tag}.tar.gz" | |
| boost_url="https://archives.boost.io/release/${boost_version}/source/${boost_archive}" | |
| boost_root="$RUNNER_TEMP/boost_${boost_tag}" | |
| boost_cmake_dir="$RUNNER_TEMP/boost-cmake/lib/cmake/Boost-${boost_version}" | |
| if [ ! -d "$boost_root/boost" ]; then | |
| curl -fsSL "$boost_url" -o "$RUNNER_TEMP/$boost_archive" | |
| tar -xzf "$RUNNER_TEMP/$boost_archive" -C "$RUNNER_TEMP" | |
| fi | |
| mkdir -p "$boost_cmake_dir" | |
| cat > "$boost_cmake_dir/BoostConfig.cmake" <<EOF | |
| if(NOT TARGET Boost::headers) | |
| add_library(Boost::headers INTERFACE IMPORTED) | |
| set_target_properties(Boost::headers PROPERTIES | |
| INTERFACE_INCLUDE_DIRECTORIES "$boost_root" | |
| ) | |
| endif() | |
| if(NOT TARGET Boost::boost) | |
| add_library(Boost::boost INTERFACE IMPORTED) | |
| target_link_libraries(Boost::boost INTERFACE Boost::headers) | |
| endif() | |
| set(Boost_FOUND TRUE) | |
| set(Boost_INCLUDE_DIRS "$boost_root") | |
| EOF | |
| cat > "$boost_cmake_dir/BoostConfigVersion.cmake" <<EOF | |
| set(PACKAGE_VERSION "$boost_version") | |
| if(PACKAGE_FIND_VERSION VERSION_LESS_EQUAL PACKAGE_VERSION) | |
| set(PACKAGE_VERSION_COMPATIBLE TRUE) | |
| if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) | |
| set(PACKAGE_VERSION_EXACT TRUE) | |
| endif() | |
| endif() | |
| EOF | |
| echo "BOOST_ROOT=$boost_root" >> "$GITHUB_ENV" | |
| echo "Boost_ROOT=$boost_root" >> "$GITHUB_ENV" | |
| echo "CMAKE_PREFIX_PATH=$RUNNER_TEMP/boost-cmake${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}" >> "$GITHUB_ENV" | |
| - name: Configure with ASan and UBSan | |
| run: | | |
| cmake -S . -B build-san \ | |
| -DNXPP_BUILD_TESTS=ON \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_CXX_COMPILER=g++ \ | |
| -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \ | |
| -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" \ | |
| -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined" | |
| - name: Build | |
| run: | | |
| cmake --build build-san | |
| - name: Run tests under sanitizers | |
| id: sanitizer_tests | |
| env: | |
| ASAN_OPTIONS: halt_on_error=1:detect_leaks=1 | |
| UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1 | |
| run: | | |
| set +e | |
| ctest --test-dir build-san --output-on-failure | tee sanitizer-output.txt | |
| status=${PIPESTATUS[0]} | |
| echo "exit_code=$status" >> "$GITHUB_OUTPUT" | |
| exit "$status" | |
| - name: Publish sanitizer summary | |
| if: always() | |
| env: | |
| TEST_EXIT_CODE: ${{ steps.sanitizer_tests.outputs.exit_code }} | |
| run: | | |
| if [ "${TEST_EXIT_CODE:-1}" = "0" ]; then | |
| status_word="SUCCESS" | |
| else | |
| status_word="FAILURE" | |
| fi | |
| if [ -f sanitizer-output.txt ]; then | |
| perl -pe 's/\e\[[0-9;]*[A-Za-z]//g' sanitizer-output.txt > sanitizer-output-clean.txt | |
| fi | |
| { | |
| echo "## Sanitizers" | |
| echo | |
| echo "- Runner: \`ubuntu-latest\`" | |
| echo "- Compiler: \`g++\`" | |
| echo "- Sanitizers: \`address,undefined\`" | |
| echo "- Status: ${status_word}" | |
| echo "- Command: \`ctest --test-dir build-san --output-on-failure\`" | |
| if [ -f sanitizer-output-clean.txt ]; then | |
| echo | |
| echo "### Output" | |
| echo | |
| echo '```text' | |
| cat sanitizer-output-clean.txt | |
| echo '```' | |
| fi | |
| } >> "$GITHUB_STEP_SUMMARY" |