blob: 6f634da96c62e5b98a938430539ec08ae9f0b7c0 [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
Marc Kupietz11df7852026-08-09 14:59:09 +020020 # Deps, collocatordb and dereko2vec, with rocksdb and collocatordb
21 # linked statically. The distribution brings the static rocksdb on both,
22 # so no rocksdb is built.
23 - name: Install everything (Linux)
Marc Kupietz08b22ae2026-08-02 09:50:17 +020024 if: runner.os == 'Linux'
Marc Kupietz11df7852026-08-09 14:59:09 +020025 run: scripts/install.sh
Marc Kupietz08b22ae2026-08-02 09:50:17 +020026
Marc Kupietz11df7852026-08-09 14:59:09 +020027 # The count based part of the test traps on MacOS, while it runs on
28 # Linux. So the tests are a step of their own there, with a backtrace
29 # below when they fail, instead of failing the installation.
30 - name: Install everything (macOS)
Marc Kupietz08b22ae2026-08-02 09:50:17 +020031 if: runner.os == 'macOS'
Marc Kupietz11df7852026-08-09 14:59:09 +020032 run: scripts/install.sh --skip-tests
Marc Kupietz08b22ae2026-08-02 09:50:17 +020033
Marc Kupietz11df7852026-08-09 14:59:09 +020034 - name: Test (macOS)
35 if: runner.os == 'macOS'
Marc Kupietz08b22ae2026-08-02 09:50:17 +020036 run: ctest --test-dir build --output-on-failure
37
Marc Kupietz11df7852026-08-09 14:59:09 +020038 # The count based part of the test traps on MacOS, while it runs on
39 # Linux with rocksdb 8.9, 10.2 and 11.0. Without a backtrace there is
40 # nothing to go by, so produce one.
Marc Kupietz592fc792026-08-02 11:45:47 +020041 - name: Backtrace of the crash (macOS)
42 if: failure() && runner.os == 'macOS'
43 run: |
44 D=$(mktemp -d)
45 ./build/dereko2vec -train tests/data/wpd19_10000.w2vinput -output "$D/m.vecs" \
46 -type 3 -save-vocab "$D/m.vocab" -size 50 -window 5 -negative 5 \
47 -threads 4 -iter 1 -min-count 2 -binary 1 > /dev/null 2>&1
48 lldb --batch -o run -o 'bt all' -o quit -- ./build/dereko2vec \
49 -train tests/data/wpd19_10000.w2vinput -output "$D/m.rocksdb" \
50 -type 5 -read-vocab "$D/m.vocab" -threads 8 2>&1 | tail -80
51
Marc Kupietz08b22ae2026-08-02 09:50:17 +020052 # The training writes the memory mappable form of the model, which
53 # derekovecs maps. vecs2mmap does the same for models trained earlier.
54 - name: Check the memory mappable model form
55 run: |
56 ./build/dereko2vec -train tests/data/wpd19_10000.w2vinput -output /tmp/m.vecs \
57 -type 3 -size 50 -window 5 -negative 5 -threads 2 -iter 1 -min-count 5 -binary 1
58 echo "written by the training:"
59 ls -l /tmp/m.vecs.vecs /tmp/m.vecs.words
60 rm /tmp/m.vecs.vecs /tmp/m.vecs.words
61 ./build/vecs2mmap /tmp/m.vecs
62 echo "written by vecs2mmap:"
63 ls -l /tmp/m.vecs.vecs /tmp/m.vecs.words
64
Marc Kupietz11df7852026-08-09 14:59:09 +020065 # install.sh has already installed; make sure the installed binaries run
66 - name: Smoke test of the installed binaries
Marc Kupietz08b22ae2026-08-02 09:50:17 +020067 run: |
Marc Kupietz08b22ae2026-08-02 09:50:17 +020068 dereko2vec 2>&1 | head -1
69 vecs2mmap -h | head -1