@@ -10,35 +10,35 @@ jobs:
1010 tests :
1111 runs-on : ubuntu-latest
1212 steps :
13- - name : Checkout code
14- uses : actions/checkout@v3
15-
16- - name : Cache build
17- uses : actions/cache@v3
18- with :
19- path : core/build-tests
20- key : ${{ runner.os }}-build-tests-${{ hashFiles('**/CMakeLists.txt', '**/examples/google_benchmark/** ') }}
21-
22- - name : Create build directory
23- run : mkdir -p core/build-tests
24-
25- - name : Build tests
26- run : |
27- cd core/build-tests
28- cmake .. -DENABLE_TESTS=ON
29- make -j
30-
31- - name : Run tests
32- run : |
33- cd core/build-tests
34- GTEST_OUTPUT=json:test-results/ ctest
35-
36- - name : Upload test results
37- uses : actions/upload-artifact@v4
38- if : failure()
39- with :
40- name : test_results
41- path : ${{runner.workspace}}/core/build-tests/test/test-results/**/*.json
13+ - name : Checkout code
14+ uses : actions/checkout@v3
15+
16+ - name : Cache build
17+ uses : actions/cache@v3
18+ with :
19+ path : core/build-tests
20+ key : ${{ runner.os }}-build-tests-${{ hashFiles('**/CMakeLists.txt') }}
21+
22+ - name : Create build directory
23+ run : mkdir -p core/build-tests
24+
25+ - name : Build tests
26+ run : |
27+ cd core/build-tests
28+ cmake .. -DENABLE_TESTS=ON
29+ make -j
30+
31+ - name : Run tests
32+ run : |
33+ cd core/build-tests
34+ GTEST_OUTPUT=json:test-results/ ctest
35+
36+ - name : Upload test results
37+ uses : actions/upload-artifact@v4
38+ if : failure()
39+ with :
40+ name : test_results
41+ path : ${{runner.workspace}}/core/build-tests/test/test-results/**/*.json
4242
4343 cmake-integration-tests :
4444 strategy :
@@ -49,94 +49,91 @@ jobs:
4949 runs-on : ubuntu-latest
5050
5151 steps :
52- - name : Checkout code
53- uses : actions/checkout@v3
52+ - name : Checkout code
53+ uses : actions/checkout@v3
5454
55- - name : Cache build
56- uses : actions/cache@v3
57- with :
58- path : examples/google_benchmark_cmake/build
59- key : ${{ runner.os }}-build-${{ matrix.codspeed-mode }}-${{ hashFiles('**/CMakeLists.txt', '**/examples/google_benchmark_cmake/**') }}
55+ - name : Cache build
56+ uses : actions/cache@v3
57+ with :
58+ path : examples/google_benchmark_cmake/build
59+ key : ${{ runner.os }}-build-${{ matrix.codspeed-mode }}-${{ hashFiles('**/CMakeLists.txt', '**/examples/google_benchmark_cmake/**') }}
6060
61- - name : Build and run benchmarks
62- run : |
63- bazel run //examples/google_benchmark:my_benchmark
64-
65- instrumentation :
66- runs-on : ubuntu-latest
61+ - name : Create build directory
62+ run : mkdir -p examples/google_benchmark_cmake/build
6763
64+ - name : Build benchmark example
65+ run : |
66+ cd examples/google_benchmark_cmake/build
67+ cmake -DCODSPEED_MODE=${{ matrix.codspeed-mode }} ..
68+ make -j
69+
70+ - name : Run the benchmarks
71+ uses : CodSpeedHQ/action@main
72+ if : matrix.codspeed-mode != 'off'
73+ with :
74+ run : examples/google_benchmark_cmake/build/benchmark_example
75+ token : ${{ secrets.CODSPEED_TOKEN }}
76+
77+ cmake-integration-tests-walltime :
78+ strategy :
79+ matrix :
80+ codspeed-mode :
81+ - " walltime"
82+ runs-on : ${{ matrix.codspeed-mode == 'walltime' ? 'codspeed-macos' : 'ubuntu-latest' }}
6883 steps :
69- - name : Checkout code
70- uses : actions/checkout@v3
71-
72- - name : Cache build
73- uses : actions/cache@v3
74- with :
75- path : examples/google_benchmark/build-instrumentation
76- key : ${{ runner.os }}-build-instrumentation-${{ hashFiles('**/CMakeLists.txt', '**/examples/google_benchmark/**') }}
84+ - name : Checkout code
85+ uses : actions/checkout@v3
7786
78- - name : Create build directory
79- run : mkdir -p examples/google_benchmark/build-instrumentation
87+ - name : Cache build
88+ uses : actions/cache@v3
89+ with :
90+ path : examples/google_benchmark_cmake/build
91+ key : ${{ runner.os }}-build-${{ matrix.codspeed-mode }}-${{ hashFiles('**/CMakeLists.txt', '**/examples/google_benchmark_cmake/**') }}
8092
81- - name : Build instrumentation benchmark example
82- run : |
83- cd examples/google_benchmark/build-instrumentation
84- cmake -DCODSPEED_MODE=instrumentation ..
85- make -j
86-
87- - name : Run the benchmarks
88- uses : CodSpeedHQ/action@main
89- with :
90- run : examples/google_benchmark/build-instrumentation/benchmark_example
91- token : ${{ secrets.CODSPEED_TOKEN }}
92-
93- walltime :
94- runs-on : codspeed-macro
93+ - name : Create build directory
94+ run : mkdir -p examples/google_benchmark_cmake/build
9595
96+ - name : Build benchmark example
97+ run : |
98+ cd examples/google_benchmark_cmake/build
99+ cmake -DCODSPEED_MODE=${{ matrix.codspeed-mode }} ..
100+ make -j
101+
102+ - name : Run the benchmarks
103+ uses : CodSpeedHQ/action@main
104+ if : matrix.codspeed-mode != 'off'
105+ with :
106+ run : examples/google_benchmark_cmake/build/benchmark_example
107+ token : ${{ secrets.CODSPEED_TOKEN }}
108+
109+ bazel-integration-tests :
110+ strategy :
111+ matrix :
112+ codspeed-mode :
113+ - " instrumentation"
114+ - " walltime"
115+ - " off"
116+ runs-on : ${{ matrix.codspeed-mode == 'walltime' ? 'codspeed-macos' : 'ubuntu-latest' }}
96117 steps :
97- - name : Checkout code
98- uses : actions/checkout@v3
99-
100- - name : Cache build
101- uses : actions/cache@v3
102- with :
103- path : examples/google_benchmark/build-walltime
104- key : ${{ runner.os }}-build-walltime-${{ hashFiles('**/CMakeLists.txt', '**/examples/google_benchmark/**') }}
105-
106- - name : Create build directory
107- run : mkdir -p examples/google_benchmark/build-walltime
108-
109- - name : Build walltime benchmark example
110- run : |
111- cd examples/google_benchmark/build-walltime
112- cmake -DCODSPEED_MODE=walltime ..
113- make -j
118+ - uses : actions/checkout@v4
119+
120+ - name : Set up Bazel
121+ uses :
bazel-contrib/[email protected] 122+ with :
123+ # Avoid downloading Bazel every time.
124+ bazelisk-cache : true
125+ # Store build cache per workflow.
126+ disk-cache : ${{ github.workflow }}
127+ # Share repository cache between workflows.
128+ repository-cache : true
114129
115- - name : Run the benchmarks
116- uses : CodSpeedHQ/action@main
117- with :
118- run : examples/google_benchmark/build-walltime/benchmark_example
119- token : ${{ secrets.CODSPEED_TOKEN }}
120-
121-
122- build-no-codspeed :
123- runs-on : ubuntu-latest
124-
125- steps :
126- - name : Checkout code
127- uses : actions/checkout@v3
128-
129- - name : Cache build
130- uses : actions/cache@v3
131- with :
132- path : examples/google_benchmark/build-no-codspeed
133- key : ${{ runner.os }}-build-no-codspeed-${{ hashFiles('**/CMakeLists.txt', '**/examples/google_benchmark/**') }}
134-
135- - name : Create build directory
136- run : mkdir -p examples/google_benchmark/build-no-codspeed
137-
138- - name : Build benchmark example without codspeed
139- run : |
140- cd examples/google_benchmark/build-no-codspeed
141- cmake ..
142- make -j
130+ - name : Build and run benchmarks
131+ run : |
132+ bazel build //examples/google_benchmark_bazel:my_benchmark --//core:codspeed_mode=${{ matrix.codspeed-mode }}
133+
134+ - name : Run the benchmarks
135+ uses : CodSpeedHQ/action@main
136+ if : matrix.codspeed-mode != 'off'
137+ with :
138+ run : bazel run //examples/google_benchmark_bazel:my_benchmark --//core:codspeed_mode=${{ matrix.codspeed-mode }}
139+ token : ${{ secrets.CODSPEED_TOKEN }}
0 commit comments