From 0dbda754eb55ac57863fe5fc78bb84dccf38d8d6 Mon Sep 17 00:00:00 2001 From: Alexandre Plateau Date: Wed, 14 May 2025 18:23:48 +0200 Subject: [PATCH 1/2] feat(ci, benchmarks): adding CodSpeed action and cmake configuration --- .github/workflows/codspeed.yml | 42 ++++++++++++++++++++++++++++++++++ CMakeLists.txt | 10 +++++++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/codspeed.yml diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml new file mode 100644 index 00000000..00d8710d --- /dev/null +++ b/.github/workflows/codspeed.yml @@ -0,0 +1,42 @@ +name: CodSpeed + +on: + push: + branches: [ dev ] + + pull_request: + + # `workflow_dispatch` allows CodSpeed to trigger backtest + # performance analysis in order to generate initial data. + workflow_dispatch: + +jobs: + benchmarks: + name: Run benchmarks + runs-on: ubuntu-24.04 + steps: + - name: Checkout ArkScript + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup compilers and tools + shell: bash + run: | + sudo apt-get install -y clang-16 lld-16 libc++-16-dev libc++abi-16-dev clang-tools-16 + + - name: Build the benchmark target + run: | + cmake -Bbuild \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCODSPEED_MODE=instrumentation \ + -DARK_BENCHMARKS=On -DARK_BENCHMARKS_CODSPEED=On \ + -DCMAKE_C_COMPILER=clang-16 -DCMAKE_CXX_COMPILER=clang++-16 \ + -DARK_SANITIZERS=Off -DARK_BUILD_EXE=Off -DARK_BUILD_MODULES=Off \ + -DARK_UNITY_BUILD=On + cmake --build build --config RelWithDebInfo -- -j 4 + + - name: Run the benchmarks + uses: CodSpeedHQ/action@0010eb0ca6e89b80c88e8edaaa07cfe5f3e6664d # v3.5.0 + with: + run: ./build/bench + token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 03411465..aef6c445 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -243,7 +243,15 @@ endif () if (ARK_BENCHMARKS) set(BENCHMARK_ENABLE_GTEST_TESTS Off) set(BENCHMARK_ENABLE_TESTING Off) - CPMAddPackage("gh:google/benchmark@1.8.3") + + if (ARK_BENCHMARKS_CODSPEED) + set(BENCHMARK_DOWNLOAD_DEPENDENCIES ON) + CPMAddPackage( + URI "gh:CodSpeedHQ/codspeed-cpp#5324618a1a14e0aa9a99dcfb467b9c2a57957e19@1.1.1" + SOURCE_SUBDIR google_benchmark) + else() + CPMAddPackage("gh:google/benchmark@1.8.3") + endif () add_executable(bench tests/benchmarks/main.cpp) target_link_libraries(bench PUBLIC ArkReactor benchmark::benchmark) From a7edb9ab43705f2f4cf9dc4f15554a7ac5439b32 Mon Sep 17 00:00:00 2001 From: Alexandre Plateau Date: Wed, 14 May 2025 18:38:39 +0200 Subject: [PATCH 2/2] fix(cmake): do not add -Werror when building benchmarks --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aef6c445..04edbf55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,6 @@ if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG OR APPLE) -Wall -Wextra -pedantic -Wstrict-aliasing -Wshadow -Wconversion - -Werror # Allow deprecation warnings to not be treated as errors -Wno-error=deprecated-declarations # We use pragmas to disable warnings we understand. @@ -82,6 +81,10 @@ if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG OR APPLE) -fvisibility=hidden -fno-semantic-interposition ) + if (NOT ARK_BENCHMARKS) + target_compile_options(ArkReactor PUBLIC -Werror) + endif() + # set fmtlib visibility to default target_compile_definitions(ArkReactor PUBLIC FMT_SHARED)