@@ -237,3 +237,58 @@ jobs:
237237 build/profile.jsonl
238238 build/lock_test_profile.jsonl
239239 retention-days : 7
240+
241+ build-macos :
242+ runs-on : macos-latest
243+
244+ steps :
245+ - uses : actions/checkout@v4
246+
247+ - name : Install dependencies
248+ run : |
249+ # cmake is preinstalled on the runner; make sure pkg-config and sqlite
250+ # (needed to configure the benchmark tree) are available. coreutils
251+ # provides gtimeout, since macOS has no GNU `timeout`.
252+ brew install pkg-config sqlite coreutils || true
253+
254+ - name : Build coz
255+ run : |
256+ mkdir build
257+ cd build
258+ cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
259+ make -j$(sysctl -n hw.ncpu)
260+
261+ - name : Build benchmarks
262+ run : |
263+ cd build
264+ cmake .. -DBUILD_BENCHMARKS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
265+ make -j$(sysctl -n hw.ncpu) toy lock_test kmeans
266+
267+ - name : Verify build artifacts
268+ run : |
269+ # On macOS the injectable library keeps the .so suffix (see
270+ # libcoz/CMakeLists.txt) so it can be used with DYLD_INSERT_LIBRARIES.
271+ test -f build/libcoz/libcoz.so
272+ test -x build/benchmarks/toy/toy
273+ test -x build/benchmarks/lock_test/lock_test
274+ test -x build/benchmarks/kmeans/kmeans
275+ echo "Build artifacts verified"
276+
277+ - name : Run unit tests
278+ run : |
279+ cd build
280+ # Includes test_run_kmeans, which profiles kmeans live via kperf and so
281+ # also validates that macOS sampling actually collects samples.
282+ ctest --output-on-failure -j$(sysctl -n hw.ncpu)
283+ echo "Unit tests passed"
284+
285+ - name : Run toy benchmark with coz
286+ run : |
287+ cd build
288+ gtimeout 30 ../coz run -o profile.jsonl --- ./benchmarks/toy/toy || true
289+ if [ ! -s profile.jsonl ]; then
290+ echo "ERROR: profile.jsonl was not created"
291+ exit 1
292+ fi
293+ echo "Profile created:"
294+ cat profile.jsonl
0 commit comments