CI: add a github workflow that also builds on MacOS

Builds, installs and tests on ubuntu-latest and macos-latest, with the rocksdb
of the distribution and of homebrew. cmake gets the homebrew prefix on MacOS,
which it does not search by itself on Apple Silicon.

Verified on Linux by running the steps of the job as they are: builds against
rocksdb 8.9.1 of ubuntu and passes both tests. The MacOS job has not run yet,
that is what it is for.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Change-Id: I76a58da6e0f9b27cdf0f548aed313bc0b9f84cee
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..f96ff5e
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,58 @@
+name: build
+
+on:
+  push:
+  pull_request:
+  workflow_dispatch:
+
+jobs:
+  build:
+    name: ${{ matrix.os }}
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        os: [ubuntu-latest, macos-latest]
+
+    steps:
+      - uses: actions/checkout@v4
+
+      - name: Install dependencies (Linux)
+        if: runner.os == 'Linux'
+        run: |
+          sudo apt-get update
+          sudo apt-get install -y cmake librocksdb-dev libgflags-dev libsnappy-dev \
+                                  zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
+
+      - name: Install dependencies (macOS)
+        if: runner.os == 'macOS'
+        run: brew install cmake rocksdb snappy lz4 zstd gflags
+
+      - name: Show the rocksdb that will be used
+        run: |
+          if [ "$RUNNER_OS" = "Linux" ]; then
+            dpkg-query -W -f='${Package} ${Version}\n' librocksdb-dev
+          else
+            brew list --versions rocksdb
+          fi
+
+      # The build directory has to be build/ inside the sources, the tests look
+      # for the collocatordb_query tool and their data relative to it.
+      - name: Configure
+        run: |
+          EXTRA=""
+          [ "$RUNNER_OS" = "macOS" ] && EXTRA="-DCMAKE_PREFIX_PATH=$(brew --prefix)"
+          cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr/local $EXTRA
+
+      - name: Build
+        run: cmake --build build -j
+
+      # Before the tests: one of them calls collocatordb_query, which is built
+      # with the rpath of its install location.
+      - name: Install
+        run: |
+          sudo cmake --install build
+          if [ "$RUNNER_OS" = "Linux" ]; then sudo ldconfig; fi
+
+      - name: Test
+        run: ctest --test-dir build --output-on-failure