blob: 0ecf48cb258cc3ad608f23da9ac217ce74f8da1a [file] [log] [blame]
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 cpanminus libssl-dev librocksdb-dev libgflags-dev \
libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
# The perl of homebrew, so that modules can be installed without sudo and
# without running into the system integrity protection.
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install cmake perl cpanminus rocksdb snappy lz4 zstd gflags
echo "$(brew --prefix)/opt/perl/bin" >> "$GITHUB_PATH"
- name: Build and install collocatordb
run: |
EXTRA=""
[ "$RUNNER_OS" = "macOS" ] && EXTRA="-DCMAKE_PREFIX_PATH=$(brew --prefix)"
git clone --depth 1 https://korap.ids-mannheim.de/gerrit/ids-kl/collocatordb
cmake -S collocatordb -B collocatordb/build -DCMAKE_INSTALL_PREFIX=/usr/local $EXTRA
cmake --build collocatordb/build -j
sudo cmake --install collocatordb/build
if [ "$RUNNER_OS" = "Linux" ]; then sudo ldconfig; fi
- name: Install perl dependencies
run: |
cpanm -n --local-lib=~/perl5 https://github.com/Akron/Mojolicious-Plugin-Localize.git
cpanm -n --local-lib=~/perl5 --installdeps .
# make install, because the tests load the module from the perl library
# path, not from the build directory. local::lib sends it to ~/perl5.
- name: Build
run: |
eval "$(perl -I ~/perl5/lib/perl5 -Mlocal::lib=~/perl5)"
perl Makefile.PL
make
make install
# Only test.t: server-test.t guesses the pids of the server it started and
# kills them, which has no business on a machine it does not own.
- name: Test
run: |
eval "$(perl -I ~/perl5/lib/perl5 -Mlocal::lib=~/perl5)"
prove --verbose t/test.t