| Marc Kupietz | 1d76ed9 | 2026-08-02 09:50:17 +0200 | [diff] [blame] | 1 | name: build |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | pull_request: |
| 6 | workflow_dispatch: |
| 7 | |
| 8 | jobs: |
| 9 | build: |
| 10 | name: ${{ matrix.os }} |
| 11 | runs-on: ${{ matrix.os }} |
| 12 | strategy: |
| 13 | fail-fast: false |
| 14 | matrix: |
| 15 | os: [ubuntu-latest, macos-latest] |
| 16 | |
| 17 | steps: |
| 18 | - uses: actions/checkout@v4 |
| 19 | |
| 20 | - name: Install dependencies (Linux) |
| 21 | if: runner.os == 'Linux' |
| 22 | run: | |
| 23 | sudo apt-get update |
| 24 | sudo apt-get install -y cmake librocksdb-dev libgflags-dev libsnappy-dev \ |
| 25 | zlib1g-dev libbz2-dev liblz4-dev libzstd-dev |
| 26 | |
| 27 | - name: Install dependencies (macOS) |
| 28 | if: runner.os == 'macOS' |
| 29 | run: brew install cmake rocksdb snappy lz4 zstd gflags |
| 30 | |
| 31 | - name: Show the rocksdb that will be used |
| 32 | run: | |
| 33 | if [ "$RUNNER_OS" = "Linux" ]; then |
| 34 | dpkg-query -W -f='${Package} ${Version}\n' librocksdb-dev |
| 35 | else |
| 36 | brew list --versions rocksdb |
| 37 | fi |
| 38 | |
| 39 | # The build directory has to be build/ inside the sources, the tests look |
| 40 | # for the collocatordb_query tool and their data relative to it. |
| 41 | - name: Configure |
| 42 | run: | |
| 43 | EXTRA="" |
| 44 | [ "$RUNNER_OS" = "macOS" ] && EXTRA="-DCMAKE_PREFIX_PATH=$(brew --prefix)" |
| 45 | cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr/local $EXTRA |
| 46 | |
| 47 | - name: Build |
| 48 | run: cmake --build build -j |
| 49 | |
| 50 | # Before the tests: one of them calls collocatordb_query, which is built |
| 51 | # with the rpath of its install location. |
| 52 | - name: Install |
| 53 | run: | |
| 54 | sudo cmake --install build |
| 55 | if [ "$RUNNER_OS" = "Linux" ]; then sudo ldconfig; fi |
| 56 | |
| 57 | - name: Test |
| 58 | run: ctest --test-dir build --output-on-failure |