Skip to content

Enable LTO for release builds #290

Enable LTO for release builds

Enable LTO for release builds #290

Workflow file for this run

name: CMake
on:
workflow_dispatch:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.issue.number || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: self-hosted
timeout-minutes: 120
strategy:
matrix:
compiler: [/opt/gcc-12.4/bin/gcc;/opt/gcc-12.4/bin/g++;/opt/gcc-12.4/lib64, clang;clang++;]
spdlog: [ON, OFF]
opts: [Debug, Release]
sanitizer: [none, asan] #tsan not yet supported due to missing sanitizer implementation in GCC 10, 11. As well as false positives. See:
# - https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=80b4ce1a5190ebe764b1009afae57dcef45f92c2
# - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100655
# - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101978
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: "Set env"
run: |
echo "${{matrix.compiler}}" | cut -d ";" -f 1 | (echo -n CC= && cat) >> $GITHUB_ENV
echo "${{matrix.compiler}}" | cut -d ";" -f 2 | (echo -n CXX= && cat) >> $GITHUB_ENV
echo "${{matrix.compiler}}" | cut -d ";" -f 3 | (echo -n LD_LIBRARY_PATH= && cat) >> $GITHUB_ENV
- name: "Configure CMake (spdlog:${{matrix.spdlog}}, asan)"
if: ${{matrix.sanitizer == 'asan'}}
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -GNinja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.opts}} -DICHOR_USE_SPDLOG=${{matrix.spdlog}} -DICHOR_USE_BOOST_BEAST=ON -DICHOR_USE_SDEVENT=ON -DICHOR_USE_SANITIZERS=ON -DICHOR_USE_MOLD=ON -DICHOR_USE_LIBCPP=OFF -DICHOR_USE_LIBURING=ON
- name: "Configure CMake (spdlog:${{matrix.spdlog}}, no asan)"
if: ${{matrix.sanitizer == 'none'}}
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -GNinja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.opts}} -DICHOR_USE_SPDLOG=${{matrix.spdlog}} -DICHOR_USE_BOOST_BEAST=ON -DICHOR_USE_SDEVENT=ON -DICHOR_USE_SANITIZERS=OFF -DICHOR_USE_MOLD=ON -DICHOR_USE_LIBCPP=OFF -DICHOR_USE_LIBURING=ON
- name: "Configure CMake (spdlog:${{matrix.spdlog}}, tsan)"
if: ${{matrix.sanitizer == 'tsan'}}
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -GNinja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.opts}} -DICHOR_USE_SPDLOG=${{matrix.spdlog}} -DICHOR_USE_BOOST_BEAST=ON -DICHOR_USE_SDEVENT=ON -DICHOR_USE_SANITIZERS=OFF -DICHOR_USE_THREAD_SANITIZER=ON -DICHOR_USE_MOLD=ON -DICHOR_USE_LIBCPP=OFF -DICHOR_USE_LIBURING=ON
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{matrix.opts}}
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --output-on-failure -C ${{env.BUILD_TYPE}}
- name: Examples
working-directory: ${{github.workspace}}/bin
run: ../bin/ichor_etcd_example && ../bin/ichor_http_example && ../bin/ichor_multithreaded_example && ../bin/ichor_optional_dependency_example && ../bin/ichor_serializer_example && ../bin/ichor_tcp_example && ../bin/ichor_timer_example && ../bin/ichor_factory_example && ../bin/ichor_websocket_example && ../bin/ichor_websocket_example -t4 && ../bin/ichor_yielding_timer_example && ../bin/ichor_event_statistics_example && ../bin/ichor_introspection_example