-
Notifications
You must be signed in to change notification settings - Fork 3
202 lines (177 loc) · 6 KB
/
ci.yml
File metadata and controls
202 lines (177 loc) · 6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
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
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