| Marc Kupietz | 08b22ae | 2026-08-02 09:50:17 +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 | |
| Marc Kupietz | 11df785 | 2026-08-09 14:59:09 +0200 | [diff] [blame] | 20 | # 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 Kupietz | 08b22ae | 2026-08-02 09:50:17 +0200 | [diff] [blame] | 24 | if: runner.os == 'Linux' |
| Marc Kupietz | 11df785 | 2026-08-09 14:59:09 +0200 | [diff] [blame] | 25 | run: scripts/install.sh |
| Marc Kupietz | 08b22ae | 2026-08-02 09:50:17 +0200 | [diff] [blame] | 26 | |
| Marc Kupietz | 11df785 | 2026-08-09 14:59:09 +0200 | [diff] [blame] | 27 | # 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 Kupietz | 08b22ae | 2026-08-02 09:50:17 +0200 | [diff] [blame] | 31 | if: runner.os == 'macOS' |
| Marc Kupietz | 11df785 | 2026-08-09 14:59:09 +0200 | [diff] [blame] | 32 | run: scripts/install.sh --skip-tests |
| Marc Kupietz | 08b22ae | 2026-08-02 09:50:17 +0200 | [diff] [blame] | 33 | |
| Marc Kupietz | 11df785 | 2026-08-09 14:59:09 +0200 | [diff] [blame] | 34 | - name: Test (macOS) |
| 35 | if: runner.os == 'macOS' |
| Marc Kupietz | 08b22ae | 2026-08-02 09:50:17 +0200 | [diff] [blame] | 36 | run: ctest --test-dir build --output-on-failure |
| 37 | |
| Marc Kupietz | 11df785 | 2026-08-09 14:59:09 +0200 | [diff] [blame] | 38 | # 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 Kupietz | 592fc79 | 2026-08-02 11:45:47 +0200 | [diff] [blame] | 41 | - 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 Kupietz | 08b22ae | 2026-08-02 09:50:17 +0200 | [diff] [blame] | 52 | # 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 Kupietz | 11df785 | 2026-08-09 14:59:09 +0200 | [diff] [blame] | 65 | # install.sh has already installed; make sure the installed binaries run |
| 66 | - name: Smoke test of the installed binaries |
| Marc Kupietz | 08b22ae | 2026-08-02 09:50:17 +0200 | [diff] [blame] | 67 | run: | |
| Marc Kupietz | 08b22ae | 2026-08-02 09:50:17 +0200 | [diff] [blame] | 68 | dereko2vec 2>&1 | head -1 |
| 69 | vecs2mmap -h | head -1 |