Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 1 | image: gcc |
| 2 | |
Marc Kupietz | f3b1db0 | 2023-12-21 13:13:16 +0100 | [diff] [blame^] | 3 | variables: |
| 4 | # Set `CCACHE_BASEDIR` and `CCACHE_DIR` to point `ccache` towards the cached |
| 5 | # path on the gitlab-runner. This enables to cache the output of `ccache` |
| 6 | # between various runs. |
| 7 | CCACHE_BASEDIR: "${CI_PROJECT_DIR}" |
| 8 | CCACHE_DIR: "${CI_PROJECT_DIR}/ccache" |
| 9 | # Set `ccache` to `content` to prevent rebuilding of the CI/CD containers to |
| 10 | # trigger a recreate of the cache. By using `content` the compiler's `mtime` |
| 11 | # is not considered as part of the hash. |
| 12 | CCACHE_COMPILERCHECK: "content" |
| 13 | # Enable caching for `apt-get`. |
| 14 | APT_CACHE_DIR: "${CI_PROJECT_DIR}/apt-cache" |
| 15 | # Export `noninteractive` frontend to prevent requesting user input. |
| 16 | DEBIAN_FRONTEND: "noninteractive" |
| 17 | |
Marc Kupietz | 2a93f3a | 2022-04-10 15:11:16 +0200 | [diff] [blame] | 18 | build-and-test: |
Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 19 | stage: build |
Marc Kupietz | 2a0c25a | 2022-04-13 12:41:59 +0200 | [diff] [blame] | 20 | cache: |
Marc Kupietz | f3b1db0 | 2023-12-21 13:13:16 +0100 | [diff] [blame^] | 21 | # Cache is shared between branches, but has a unique cache per job. |
| 22 | key: dereko2vec |
| 23 | paths: |
| 24 | # Note: directories should align with `$APT_CACHE_DIR` and `$CCACHE_DIR`. |
| 25 | - apt-cache/ |
| 26 | - ccache/ |
| 27 | |
Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 28 | before_script: |
Marc Kupietz | 485be1c | 2022-04-10 14:21:45 +0200 | [diff] [blame] | 29 | - pwd |
| 30 | - source `find .. -name section_helper.sh` |
| 31 | |
| 32 | - start_section install_linux_packages "Installing missing Linux packages" |
Marc Kupietz | f3b1db0 | 2023-12-21 13:13:16 +0100 | [diff] [blame^] | 33 | - mkdir -pv $APT_CACHE_DIR ccache |
| 34 | - apt-get update && apt-get -o dir::cache::archives="$APT_CACHE_DIR" -y install ccache cmake libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev libomp-dev |
| 35 | - ln -s $(which ccache) /usr/local/sbin/gcc |
| 36 | - ln -s $(which ccache) /usr/local/sbin/g++ |
Marc Kupietz | 485be1c | 2022-04-10 14:21:45 +0200 | [diff] [blame] | 37 | - end_section install_linux_packages |
| 38 | |
| 39 | - start_section install_rocksdb_static "Building and installing rocksdb-static" |
Marc Kupietz | 6eab2f4 | 2023-12-21 11:15:14 +0100 | [diff] [blame] | 40 | - git clone --branch 5.11.fb https://github.com/facebook/rocksdb.git |
| 41 | - cd rocksdb |
| 42 | - for f in db/compaction_iteration_stats.h include/rocksdb/utilities/checkpoint.h util/string_util.h; do echo $f; sed -Ei 's|^#pragma once|\0\n#include <cstdint>|' "$f"; done |
| 43 | - export PROCS=$(nproc) |
Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 44 | - make -j $PROCS static_lib DISABLE_WARNING_AS_ERROR=1 WARNING_FLAGS=-w |
Marc Kupietz | f3b1db0 | 2023-12-21 13:13:16 +0100 | [diff] [blame^] | 45 | - ccache --show-stats |
Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 46 | - make install-static DISABLE_WARNING_AS_ERROR=1 WARNING_FLAGS=-w |
Marc Kupietz | 485be1c | 2022-04-10 14:21:45 +0200 | [diff] [blame] | 47 | - end_section install_rocksdb_static |
| 48 | |
| 49 | - start_section install_rocksdb_shared "Building and installing rocksdb-shared" |
Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 50 | - make -j $PROCS shared_lib DISABLE_WARNING_AS_ERROR=1 WARNING_FLAGS=-w |
| 51 | - make install-shared DISABLE_WARNING_AS_ERROR=1 WARNING_FLAGS=-w |
Marc Kupietz | 2a0c25a | 2022-04-13 12:41:59 +0200 | [diff] [blame] | 52 | - ldconfig |
Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 53 | - cd .. |
Marc Kupietz | 485be1c | 2022-04-10 14:21:45 +0200 | [diff] [blame] | 54 | - end_section rocksdb_shared |
| 55 | |
| 56 | - start_section install_collocatordb "Building and installing collocatordb" |
Marc Kupietz | b738ec7 | 2022-04-13 12:42:17 +0200 | [diff] [blame] | 57 | - git clone "https://korap.ids-mannheim.de/gerrit/ids-kl/collocatordb" |
Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 58 | - cd collocatordb |
| 59 | - mkdir -p build |
| 60 | - cd build |
Marc Kupietz | f3b1db0 | 2023-12-21 13:13:16 +0100 | [diff] [blame^] | 61 | - cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache .. |
Marc Kupietz | 485be1c | 2022-04-10 14:21:45 +0200 | [diff] [blame] | 62 | - make |
Marc Kupietz | f3b1db0 | 2023-12-21 13:13:16 +0100 | [diff] [blame^] | 63 | - ccache --show-stats |
Marc Kupietz | 485be1c | 2022-04-10 14:21:45 +0200 | [diff] [blame] | 64 | - make install # && ctest --extra-verbose |
Marc Kupietz | 2a0c25a | 2022-04-13 12:41:59 +0200 | [diff] [blame] | 65 | - ldconfig |
Marc Kupietz | 485be1c | 2022-04-10 14:21:45 +0200 | [diff] [blame] | 66 | - end_section install_collocatordb |
| 67 | - cd ../.. |
| 68 | |
Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 69 | script: |
Marc Kupietz | 2a93f3a | 2022-04-10 15:11:16 +0200 | [diff] [blame] | 70 | - start_section build_dereko2vec "Building and testing dereko2vec" |
Marc Kupietz | 485be1c | 2022-04-10 14:21:45 +0200 | [diff] [blame] | 71 | - pwd |
Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 72 | - mkdir build |
| 73 | - cd build |
Marc Kupietz | f3b1db0 | 2023-12-21 13:13:16 +0100 | [diff] [blame^] | 74 | - cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache .. |
Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 75 | - make |
Marc Kupietz | f3b1db0 | 2023-12-21 13:13:16 +0100 | [diff] [blame^] | 76 | - ccache --show-stats |
Marc Kupietz | 2a93f3a | 2022-04-10 15:11:16 +0200 | [diff] [blame] | 77 | - ctest --extra-verbose |
| 78 | - end_section build_dereko2vec |
Marc Kupietz | 485be1c | 2022-04-10 14:21:45 +0200 | [diff] [blame] | 79 | |
Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 80 | artifacts: |
| 81 | paths: |
| 82 | - build/dereko2vec |
Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 83 | |