blob: 6f634da96c62e5b98a938430539ec08ae9f0b7c0 [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
# Deps, collocatordb and dereko2vec, with rocksdb and collocatordb
# linked statically. The distribution brings the static rocksdb on both,
# so no rocksdb is built.
- name: Install everything (Linux)
if: runner.os == 'Linux'
run: scripts/install.sh
# The count based part of the test traps on MacOS, while it runs on
# Linux. So the tests are a step of their own there, with a backtrace
# below when they fail, instead of failing the installation.
- name: Install everything (macOS)
if: runner.os == 'macOS'
run: scripts/install.sh --skip-tests
- name: Test (macOS)
if: runner.os == 'macOS'
run: ctest --test-dir build --output-on-failure
# The count based part of the test traps on MacOS, while it runs on
# Linux with rocksdb 8.9, 10.2 and 11.0. Without a backtrace there is
# nothing to go by, so produce one.
- name: Backtrace of the crash (macOS)
if: failure() && runner.os == 'macOS'
run: |
D=$(mktemp -d)
./build/dereko2vec -train tests/data/wpd19_10000.w2vinput -output "$D/m.vecs" \
-type 3 -save-vocab "$D/m.vocab" -size 50 -window 5 -negative 5 \
-threads 4 -iter 1 -min-count 2 -binary 1 > /dev/null 2>&1
lldb --batch -o run -o 'bt all' -o quit -- ./build/dereko2vec \
-train tests/data/wpd19_10000.w2vinput -output "$D/m.rocksdb" \
-type 5 -read-vocab "$D/m.vocab" -threads 8 2>&1 | tail -80
# The training writes the memory mappable form of the model, which
# derekovecs maps. vecs2mmap does the same for models trained earlier.
- name: Check the memory mappable model form
run: |
./build/dereko2vec -train tests/data/wpd19_10000.w2vinput -output /tmp/m.vecs \
-type 3 -size 50 -window 5 -negative 5 -threads 2 -iter 1 -min-count 5 -binary 1
echo "written by the training:"
ls -l /tmp/m.vecs.vecs /tmp/m.vecs.words
rm /tmp/m.vecs.vecs /tmp/m.vecs.words
./build/vecs2mmap /tmp/m.vecs
echo "written by vecs2mmap:"
ls -l /tmp/m.vecs.vecs /tmp/m.vecs.words
# install.sh has already installed; make sure the installed binaries run
- name: Smoke test of the installed binaries
run: |
dereko2vec 2>&1 | head -1
vecs2mmap -h | head -1