Skip to content

Commit cdc800f

Browse files
ci: add bazel integration tests
1 parent 44880b2 commit cdc800f

File tree

13 files changed

+38
-61
lines changed

13 files changed

+38
-61
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: actions/cache@v3
1818
with:
1919
path: core/build-tests
20-
key: ${{ runner.os }}-build-tests-${{ hashFiles('**/CMakeLists.txt', '**/examples/google_benchmark/**') }}
20+
key: ${{ runner.os }}-build-tests-${{ hashFiles('**/CMakeLists.txt') }}
2121

2222
- name: Create build directory
2323
run: mkdir -p core/build-tests
@@ -60,81 +60,36 @@ jobs:
6060
run: |
6161
bazel run //examples/google_benchmark:my_benchmark
6262
63-
instrumentation:
63+
cmake-integration-tests:
6464
runs-on: ubuntu-latest
65-
66-
steps:
67-
- name: Checkout code
68-
uses: actions/checkout@v3
69-
70-
- name: Cache build
71-
uses: actions/cache@v3
72-
with:
73-
path: examples/google_benchmark/build-instrumentation
74-
key: ${{ runner.os }}-build-instrumentation-${{ hashFiles('**/CMakeLists.txt', '**/examples/google_benchmark/**') }}
75-
76-
- name: Create build directory
77-
run: mkdir -p examples/google_benchmark/build-instrumentation
78-
79-
- name: Build instrumentation benchmark example
80-
run: |
81-
cd examples/google_benchmark/build-instrumentation
82-
cmake -DCODSPEED_MODE=instrumentation ..
83-
make -j
84-
85-
- name: Run the benchmarks
86-
uses: CodSpeedHQ/action@main
87-
with:
88-
run: examples/google_benchmark/build-instrumentation/benchmark_example
89-
token: ${{ secrets.CODSPEED_TOKEN }}
90-
91-
walltime:
92-
runs-on: codspeed-macro
93-
65+
strategy:
66+
matrix:
67+
codspeed-mode:
68+
- "instrumentation"
69+
- "walltime"
70+
- "off"
9471
steps:
9572
- name: Checkout code
9673
uses: actions/checkout@v3
9774

9875
- name: Cache build
9976
uses: actions/cache@v3
10077
with:
101-
path: examples/google_benchmark/build-walltime
102-
key: ${{ runner.os }}-build-walltime-${{ hashFiles('**/CMakeLists.txt', '**/examples/google_benchmark/**') }}
78+
path: examples/google_benchmark_cmake/build
79+
key: ${{ runner.os }}-build-${{ matrix.codspeed-mode }}-${{ hashFiles('**/CMakeLists.txt', '**/examples/google_benchmark_cmake/**') }}
10380

10481
- name: Create build directory
105-
run: mkdir -p examples/google_benchmark/build-walltime
82+
run: mkdir -p examples/google_benchmark_cmake/build
10683

107-
- name: Build walltime benchmark example
84+
- name: Build benchmark example
10885
run: |
109-
cd examples/google_benchmark/build-walltime
110-
cmake -DCODSPEED_MODE=walltime ..
86+
cd examples/google_benchmark_cmake/build
87+
cmake -DCODSPEED_MODE=${{ matrix.codspeed-mode }} ..
11188
make -j
11289
11390
- name: Run the benchmarks
11491
uses: CodSpeedHQ/action@main
92+
if: matrix.codspeed-mode != 'off'
11593
with:
116-
run: examples/google_benchmark/build-walltime/benchmark_example
94+
run: examples/google_benchmark/build/benchmark_example
11795
token: ${{ secrets.CODSPEED_TOKEN }}
118-
119-
120-
build-no-codspeed:
121-
runs-on: ubuntu-latest
122-
123-
steps:
124-
- name: Checkout code
125-
uses: actions/checkout@v3
126-
127-
- name: Cache build
128-
uses: actions/cache@v3
129-
with:
130-
path: examples/google_benchmark/build-no-codspeed
131-
key: ${{ runner.os }}-build-no-codspeed-${{ hashFiles('**/CMakeLists.txt', '**/examples/google_benchmark/**') }}
132-
133-
- name: Create build directory
134-
run: mkdir -p examples/google_benchmark/build-no-codspeed
135-
136-
- name: Build benchmark example without codspeed
137-
run: |
138-
cd examples/google_benchmark/build-no-codspeed
139-
cmake ..
140-
make -j
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build --//core:codspeed_mode=walltime
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.6.1
File renamed without changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
###############################################################################
2+
# Bazel now uses Bzlmod by default to manage external dependencies.
3+
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
4+
#
5+
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
6+
###############################################################################
7+
bazel_dep(name = "rules_cc", version = "0.0.17")
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
3+
http_archive(
4+
name = "codspeed_cpp",
5+
# urls = ["https://github.com/CodSpeedHQ/codspeed-cpp/archive/refs/heads/main.zip"],
6+
# strip_prefix = "codspeed-cpp-main",
7+
urls = ["https://github.com/CodSpeedHQ/codspeed-cpp/archive/refs/heads/cod-815-bazel-support-for-c-integration.zip"],
8+
strip_prefix = "codspeed-cpp-cod-815-bazel-support-for-c-integration",
9+
)
10+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../google_benchmark_cmake/fixture_bench.hpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../google_benchmark_cmake/main.cpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../google_benchmark_cmake/template_bench.hpp
File renamed without changes.

0 commit comments

Comments
 (0)