| 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 |
| Marc Kupietz | f2aa92e | 2026-07-31 14:48:02 +0900 | [diff] [blame] | 34 | - apt-get update && apt-get -o dir::cache::archives="$APT_CACHE_DIR" -y install ccache cmake librocksdb-dev libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev libomp-dev |
| Marc Kupietz | 11df785 | 2026-08-09 14:59:09 +0200 | [diff] [blame] | 35 | # ccache only makes the build faster, it must never be able to make it |
| 36 | # fail, so it is wired in through compiler symlinks only when it is there |
| 37 | - if CCACHE=$(command -v ccache); then ln -sf "$CCACHE" /usr/local/sbin/gcc && ln -sf "$CCACHE" /usr/local/sbin/g++; else echo "ccache is not available - building without it"; fi |
| Marc Kupietz | 485be1c | 2022-04-10 14:21:45 +0200 | [diff] [blame] | 38 | - end_section install_linux_packages |
| 39 | |
| Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 40 | script: |
| Marc Kupietz | 11df785 | 2026-08-09 14:59:09 +0200 | [diff] [blame] | 41 | # Debian ships the static rocksdb in librocksdb-dev, so install.sh builds |
| 42 | # no rocksdb here. --static-binary keeps the artifact a completely static |
| 43 | # binary. ccache works through the compiler symlinks set up above. |
| Marc Kupietz | 2a93f3a | 2022-04-10 15:11:16 +0200 | [diff] [blame] | 44 | - start_section build_dereko2vec "Building and testing dereko2vec" |
| Marc Kupietz | 11df785 | 2026-08-09 14:59:09 +0200 | [diff] [blame] | 45 | - scripts/install.sh --skip-deps --static-binary |
| Marc Kupietz | f2aa92e | 2026-07-31 14:48:02 +0900 | [diff] [blame] | 46 | - command -v ccache > /dev/null && ccache --show-stats || true |
| Marc Kupietz | 2a93f3a | 2022-04-10 15:11:16 +0200 | [diff] [blame] | 47 | - end_section build_dereko2vec |
| Marc Kupietz | 485be1c | 2022-04-10 14:21:45 +0200 | [diff] [blame] | 48 | |
| Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 49 | artifacts: |
| 50 | paths: |
| 51 | - build/dereko2vec |
| Marc Kupietz | 97ada39 | 2022-04-10 14:06:00 +0200 | [diff] [blame] | 52 | |