Support macos walltime without profiling in codspeed-cpp #474
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pre-commit/action@v3.0.1 | |
| with: | |
| extra_args: --all-files | |
| toolchain-detection-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run toolchain detection tests | |
| run: bash core/scripts/test_detect_toolchain.sh | |
| tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: "recursive" | |
| - name: Cache build | |
| uses: actions/cache@v3 | |
| with: | |
| path: core/build-tests | |
| key: ${{ runner.os }}-build-tests-${{ hashFiles('**/CMakeLists.txt') }} | |
| - name: Create build directory | |
| run: mkdir -p core/build-tests | |
| - name: Build tests | |
| run: | | |
| cd core/build-tests | |
| cmake .. -DENABLE_TESTS=ON -DCODSPEED_STRICT_WARNINGS=ON | |
| make -j | |
| - name: Run tests | |
| run: | | |
| cd core/build-tests | |
| GTEST_OUTPUT=json:test-results/ ctest | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: test_results | |
| path: ${{runner.workspace}}/core/build-tests/test/test-results/**/*.json | |
| cmake-integration-tests: | |
| strategy: | |
| matrix: | |
| include: | |
| - codspeed-mode: "simulation" | |
| runner: "ubuntu-latest" | |
| - codspeed-mode: "memory" | |
| runner: "ubuntu-latest" | |
| - codspeed-mode: "walltime" | |
| runner: "codspeed-macro" | |
| - codspeed-mode: "off" | |
| runner: "ubuntu-latest" | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: "recursive" | |
| - name: Cache build | |
| uses: actions/cache@v3 | |
| with: | |
| path: examples/google_benchmark_cmake/build | |
| key: ${{ runner.os }}-build-${{ matrix.codspeed-mode }}-${{ hashFiles('**/CMakeLists.txt') }} | |
| - name: Create build directory | |
| run: mkdir -p examples/google_benchmark_cmake/build | |
| - name: Build benchmark example | |
| run: | | |
| cd examples/google_benchmark_cmake/build | |
| cmake -DCODSPEED_MODE=${{ matrix.codspeed-mode }} -DCODSPEED_STRICT_WARNINGS=ON .. | |
| make -j | |
| - name: Run the benchmarks | |
| uses: CodSpeedHQ/action@main | |
| if: matrix.codspeed-mode != 'off' | |
| with: | |
| mode: ${{ matrix.codspeed-mode }} | |
| run: examples/google_benchmark_cmake/build/benchmark_example | |
| bazel-integration-tests: | |
| strategy: | |
| matrix: | |
| include: | |
| - codspeed-mode: "simulation" | |
| runner: "ubuntu-latest" | |
| - codspeed-mode: "memory" | |
| runner: "ubuntu-latest" | |
| - codspeed-mode: "walltime" | |
| runner: "codspeed-macro" | |
| - codspeed-mode: "off" | |
| runner: "ubuntu-latest" | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: "recursive" | |
| - name: Set up Bazel | |
| uses: bazel-contrib/setup-bazel@0.14.0 | |
| with: | |
| # Avoid downloading Bazel every time. | |
| bazelisk-cache: true | |
| # Store build cache per workflow. | |
| disk-cache: ${{ github.workflow }} | |
| # Share repository cache between workflows. | |
| repository-cache: true | |
| - 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' | |
| with: | |
| mode: ${{ matrix.codspeed-mode }} | |
| run: bazel run //examples/google_benchmark_bazel:my_benchmark --@codspeed_core//:codspeed_mode=${{ matrix.codspeed-mode }} --@codspeed_core//:strict_warnings=on | |
| cmake-build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| codspeed-mode: ["off", "walltime"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: "recursive" | |
| - name: Cache build | |
| uses: actions/cache@v3 | |
| with: | |
| path: examples/google_benchmark_cmake/build | |
| key: ${{ runner.os }}-cmake-build-${{ matrix.codspeed-mode }}-${{ hashFiles('**/CMakeLists.txt') }} | |
| - name: Build benchmark example (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| mkdir -p examples/google_benchmark_cmake/build | |
| cd examples/google_benchmark_cmake/build | |
| cmake -DCODSPEED_MODE=${{ matrix.codspeed-mode }} .. | |
| make -j | |
| - name: Build benchmark example (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| if (-not (Test-Path examples\google_benchmark_cmake\build)) { | |
| mkdir examples\google_benchmark_cmake\build | |
| } | |
| cd examples\google_benchmark_cmake\build | |
| cmake -DCODSPEED_MODE=${{ matrix.codspeed-mode }} .. | |
| cmake --build . --config Release | |
| shell: pwsh | |
| bazel-build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| codspeed-mode: ["off", "walltime"] | |
| bazel-version: ["7.6.2", "8.4.2", "9.0.0-pre.20250921.2"] | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| USE_BAZEL_VERSION: ${{ matrix.bazel-version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: "recursive" | |
| - name: Set up Bazel | |
| uses: bazel-contrib/setup-bazel@0.14.0 | |
| with: | |
| # Avoid downloading Bazel every time. | |
| bazelisk-cache: true | |
| # Store build cache per workflow. | |
| disk-cache: ${{ github.workflow }} | |
| # Share repository cache between workflows. | |
| repository-cache: true | |
| - 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 |