blob: 19685db1b9eb4ca5291148161597d52f78f0f3aa [file] [log] [blame]
Marc Kupietz08b22ae2026-08-02 09:50:17 +02001name: build
2
3on:
4 push:
5 pull_request:
6 workflow_dispatch:
7
8jobs:
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: Build and install collocatordb
32 run: |
33 EXTRA=""
34 [ "$RUNNER_OS" = "macOS" ] && EXTRA="-DCMAKE_PREFIX_PATH=$(brew --prefix)"
35 git clone --depth 1 https://korap.ids-mannheim.de/gerrit/ids-kl/collocatordb
36 cmake -S collocatordb -B collocatordb/build -DCMAKE_INSTALL_PREFIX=/usr/local $EXTRA
37 cmake --build collocatordb/build -j
38 sudo cmake --install collocatordb/build
39 if [ "$RUNNER_OS" = "Linux" ]; then sudo ldconfig; fi
40
41 # The build directory has to be build/ inside the sources, the test looks
42 # for the binary relative to it.
43 - name: Configure
44 run: |
45 EXTRA=""
46 [ "$RUNNER_OS" = "macOS" ] && EXTRA="-DCMAKE_PREFIX_PATH=$(brew --prefix)"
47 cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr/local $EXTRA
48
49 - name: Build
50 run: cmake --build build -j
51
52 - name: Test
53 run: ctest --test-dir build --output-on-failure
54
55 # The training writes the memory mappable form of the model, which
56 # derekovecs maps. vecs2mmap does the same for models trained earlier.
57 - name: Check the memory mappable model form
58 run: |
59 ./build/dereko2vec -train tests/data/wpd19_10000.w2vinput -output /tmp/m.vecs \
60 -type 3 -size 50 -window 5 -negative 5 -threads 2 -iter 1 -min-count 5 -binary 1
61 echo "written by the training:"
62 ls -l /tmp/m.vecs.vecs /tmp/m.vecs.words
63 rm /tmp/m.vecs.vecs /tmp/m.vecs.words
64 ./build/vecs2mmap /tmp/m.vecs
65 echo "written by vecs2mmap:"
66 ls -l /tmp/m.vecs.vecs /tmp/m.vecs.words
67
68 - name: Install
69 run: |
70 sudo cmake --install build
71 dereko2vec 2>&1 | head -1
72 vecs2mmap -h | head -1