| Marc Kupietz | 23993b6 | 2026-08-02 09:58:00 +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 cpanminus libssl-dev librocksdb-dev libgflags-dev \ |
| 25 | libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev |
| 26 | |
| 27 | # The perl of homebrew, so that modules can be installed without sudo and |
| 28 | # without running into the system integrity protection. |
| 29 | - name: Install dependencies (macOS) |
| 30 | if: runner.os == 'macOS' |
| 31 | run: | |
| 32 | brew install cmake perl cpanminus rocksdb snappy lz4 zstd gflags |
| 33 | echo "$(brew --prefix)/opt/perl/bin" >> "$GITHUB_PATH" |
| 34 | |
| 35 | - name: Build and install collocatordb |
| 36 | run: | |
| 37 | EXTRA="" |
| 38 | [ "$RUNNER_OS" = "macOS" ] && EXTRA="-DCMAKE_PREFIX_PATH=$(brew --prefix)" |
| 39 | git clone --depth 1 https://korap.ids-mannheim.de/gerrit/ids-kl/collocatordb |
| 40 | cmake -S collocatordb -B collocatordb/build -DCMAKE_INSTALL_PREFIX=/usr/local $EXTRA |
| 41 | cmake --build collocatordb/build -j |
| 42 | sudo cmake --install collocatordb/build |
| 43 | if [ "$RUNNER_OS" = "Linux" ]; then sudo ldconfig; fi |
| 44 | |
| 45 | - name: Install perl dependencies |
| 46 | run: | |
| 47 | cpanm -n --local-lib=~/perl5 https://github.com/Akron/Mojolicious-Plugin-Localize.git |
| 48 | cpanm -n --local-lib=~/perl5 --installdeps . |
| 49 | |
| 50 | # make install, because the tests load the module from the perl library |
| 51 | # path, not from the build directory. local::lib sends it to ~/perl5. |
| 52 | - name: Build |
| 53 | run: | |
| 54 | eval "$(perl -I ~/perl5/lib/perl5 -Mlocal::lib=~/perl5)" |
| 55 | perl Makefile.PL |
| 56 | make |
| 57 | make install |
| 58 | |
| 59 | # Only test.t: server-test.t guesses the pids of the server it started and |
| 60 | # kills them, which has no business on a machine it does not own. |
| 61 | - name: Test |
| 62 | run: | |
| 63 | eval "$(perl -I ~/perl5/lib/perl5 -Mlocal::lib=~/perl5)" |
| 64 | prove --verbose t/test.t |