Skip to content

Commit 6fe62be

Browse files
authored
Merge pull request #285 from plasma-umass/ci-macos-build
ci: add macOS build job
2 parents bc6cd09 + 2bb5dae commit 6fe62be

2 files changed

Lines changed: 58 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

benchmarks/check-output.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ $@
77

88
grep -q '"time":' profile.jsonl || { echo failure: valid profile.jsonl not generated; exit 1; }
99
grep -q '"throughput-point"' profile.jsonl || { echo failure: throughput-point not found in profile; exit 1; }
10-
grep -q -P '{"type":"samples","location":' profile.jsonl || { echo failure: samples not found in profile; exit 1; }
10+
# Use -F (fixed string) rather than -P: the pattern is a literal substring and
11+
# BSD grep (macOS) has no -P, which otherwise made this fail on macOS.
12+
grep -q -F '{"type":"samples","location":' profile.jsonl || { echo failure: samples not found in profile; exit 1; }
1113
echo success: benchmark generated valid profile.jsonl

0 commit comments

Comments
 (0)