diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce9eac9..d56c7ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: make -j - name: Run tests - run: | + run: | cd core/build-tests GTEST_OUTPUT=json:test-results/ ctest @@ -133,7 +133,7 @@ jobs: - name: Build benchmark example run: | bazel build //examples/google_benchmark_bazel:my_benchmark --@codspeed_core//:codspeed_mode=${{ matrix.codspeed-mode }} --@codspeed_core//:strict_warnings=on - + - name: Run the benchmarks uses: CodSpeedHQ/action@main if: matrix.codspeed-mode != 'off' @@ -207,3 +207,59 @@ jobs: - name: Build benchmark example run: | bazel build //examples/google_benchmark_bazel:my_benchmark --@codspeed_core//:codspeed_mode=${{ matrix.codspeed-mode }} --@codspeed_core//:strict_warnings=on + + macos-walltime-cmake-test: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: "recursive" + + - name: Build benchmark example + run: | + mkdir -p examples/google_benchmark_cmake/build + cd examples/google_benchmark_cmake/build + cmake -DCODSPEED_MODE=walltime .. + make -j + + - name: Run the benchmarks + uses: CodSpeedHQ/action@main + env: + CODSPEED_SKIP_UPLOAD: "true" + with: + run: examples/google_benchmark_cmake/build/benchmark_example --benchmark_filter=Fibo + mode: walltime + # TODO: Drop this + runner-version: branch:cod-2459-be-able-to-run-all-integrations-on-macos + + macos-walltime-bazel-test: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: "recursive" + + - name: Set up Bazel + uses: bazel-contrib/setup-bazel@0.14.0 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + + - name: Build benchmark example + run: | + bazel build //examples/google_benchmark_bazel:my_benchmark --@codspeed_core//:codspeed_mode=walltime --@codspeed_core//:strict_warnings=on + + - name: Run the benchmarks + uses: CodSpeedHQ/action@main + env: + CODSPEED_SKIP_UPLOAD: "true" + with: + # Note: using bazel run directly fails with a permission error on `/var/tmp/_bazel_codspeed/` + # This is because bazel does not like the user switch between running `bazel build` as a user then running `bazel run` as sudo and refuses to run. + # For now, `$USER` remains the original user, but the program is ran with uid 0 with `sudo --preserve-env` + # This problem is temporary because the runner does not YET do the same uid/gid spoofing on macos as it does on linux. + run: ./bazel-bin/examples/google_benchmark_bazel/my_benchmark --benchmark_filter=Fibo + mode: walltime + # TODO: Drop this + runner-version: branch:cod-2459-be-able-to-run-all-integrations-on-macos diff --git a/core/BUILD b/core/BUILD index 0e1a575..ee3abf3 100644 --- a/core/BUILD +++ b/core/BUILD @@ -8,6 +8,11 @@ config_setting( constraint_values = ["@platforms//os:windows"], ) +config_setting( + name = "macos", + constraint_values = ["@platforms//os:macos"], +) + # Strict warnings mode string_flag( name = "strict_warnings", @@ -100,6 +105,9 @@ cc_library( copts = select({ ":windows": ["/std:c++17"], "//conditions:default": ["-std=c++17"], + }) + select({ + ":macos": ["-mmacosx-version-min=10.15"], + "//conditions:default": [], }), defines = [ "CODSPEED_VERSION=\\\"{}\\\"".format(CODSPEED_VERSION), diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 5d69b44..f7fd6c4 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -15,7 +15,7 @@ include(FetchContent) FetchContent_Declare( instrument_hooks_repo GIT_REPOSITORY https://github.com/CodSpeedHQ/instrument-hooks - GIT_TAG 0c971823b17cb5a3bbd0cce4411cbee2c6fe4317 + GIT_TAG 4376be3e1e2d0e0c82d690bcb8e54bde98b7805c ) FetchContent_MakeAvailable(instrument_hooks_repo) FetchContent_GetProperties(instrument_hooks_repo) diff --git a/core/include/measurement.hpp b/core/include/measurement.hpp index ae773db..17d24e9 100644 --- a/core/include/measurement.hpp +++ b/core/include/measurement.hpp @@ -65,7 +65,7 @@ ALWAYS_INLINE void measurement_stop() { } ALWAYS_INLINE void measurement_set_executed_benchmark(const std::string& name) { - auto current_pid = getpid(); + auto current_pid = static_cast(getpid()); instrument_hooks_executed_benchmark(g_hooks, current_pid, name.c_str()); } diff --git a/core/instrument-hooks b/core/instrument-hooks index 0c97182..4376be3 160000 --- a/core/instrument-hooks +++ b/core/instrument-hooks @@ -1 +1 @@ -Subproject commit 0c971823b17cb5a3bbd0cce4411cbee2c6fe4317 +Subproject commit 4376be3e1e2d0e0c82d690bcb8e54bde98b7805c