| Marc Kupietz | 3839007 | 2024-01-25 13:33:23 +0100 | [diff] [blame] | 1 | image: ubuntu:rolling | 
|  | 2 |  | 
|  | 3 | stages: | 
|  | 4 | - build | 
|  | 5 |  | 
|  | 6 | build-job: | 
|  | 7 | stage: build | 
|  | 8 |  | 
|  | 9 | variables: | 
|  | 10 | # Set `CCACHE_BASEDIR` and `CCACHE_DIR` to point `ccache` towards the cached | 
|  | 11 | # path on the gitlab-runner. This enables to cache the output of `ccache` | 
|  | 12 | # between various runs. | 
|  | 13 | CCACHE_BASEDIR: ${CI_PROJECT_DIR} | 
|  | 14 | CCACHE_DIR: ${CI_PROJECT_DIR}/ccache | 
|  | 15 | # Set `ccache` to `content` to prevent rebuilding of the CI/CD containers to | 
|  | 16 | # trigger a recreate of the cache. By using `content` the compiler's `mtime` | 
|  | 17 | # is not considered as part of the hash. | 
|  | 18 | CCACHE_COMPILERCHECK: "content" | 
|  | 19 | # Enable caching for `apt-get`. | 
|  | 20 | APT_CACHE_DIR: ${CI_PROJECT_DIR}/apt-cache | 
|  | 21 | # Export `noninteractive` frontend to prevent requesting user input | 
|  | 22 | DEBIAN_FRONTEND: noninteractive | 
|  | 23 | R_LIBS_USER: ${CI_PROJECT_DIR}/rlib | 
|  | 24 |  | 
|  | 25 | cache: | 
|  | 26 | key: rkorapclient | 
|  | 27 | paths: | 
|  | 28 | - apt-cache/ | 
|  | 29 | - ccache/ | 
|  | 30 | - rlib/ | 
|  | 31 |  | 
| Marc Kupietz | 3839007 | 2024-01-25 13:33:23 +0100 | [diff] [blame] | 32 | before_script: | 
|  | 33 | - source `find .. -name section_helper.sh` | 
|  | 34 |  | 
|  | 35 | - start_section install_linux_packages "Installing missing Linux packages" | 
|  | 36 | - mkdir -pv $APT_CACHE_DIR ccache $R_LIBS_USER /usr/local/sbin ~/.ccache ~/.R | 
|  | 37 | - cp ci/Makevars ~/.R/Makevars | 
|  | 38 | - cp ci/ccache.conf ${CI_PROJECT_DIR}/ccache/ccache.conf | 
|  | 39 | - cp ci/ccache.conf ~/.ccache/ccache.conf | 
|  | 40 | - echo "R_LIBS='$R_LIBS_USER'" > .Renviron | 
|  | 41 | - echo "MAKEFLAGS=-j$(nproc)" >> ~/.R/Makevars | 
|  | 42 | - echo "MAKE=make -j$(nproc)" >> ~/.R/Makevars | 
|  | 43 | - apt-get update | 
|  | 44 | - apt-get install -y -o dir::cache::archives="$APT_CACHE_DIR" --no-install-recommends software-properties-common dirmngr ccache wget | 
|  | 45 | - wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc | 
|  | 46 | - add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" | 
|  | 47 | # - add-apt-repository ppa:c2d4u.team/c2d4u4.0+ | 
|  | 48 | - grep "sudo apt install" Readme.md | sed -e 's/.*sudo apt install/apt-get install --no-install-recommends -o dir::cache::archives="$APT_CACHE_DIR" -y /g' | sh | 
|  | 49 | - ln -s $(which ccache) /usr/local/sbin/gcc | 
|  | 50 | - ln -s $(which ccache) /usr/local/sbin/g++ | 
|  | 51 | - end_section install_linux_packages | 
|  | 52 |  | 
|  | 53 | script: | 
|  | 54 | - start_section installing "Installing RKorAPClient from CRAN" | 
|  | 55 | - export PATH=/usr/local/sbin:$PATH | 
|  | 56 | - R -q -e "install.packages(c('remotes', 'RKorAPClient'), dependencies = TRUE)" | 
|  | 57 | - R -q -e "update.packages(ask = FALSE)" | 
|  | 58 | - end_section installing | 
|  | 59 | - start_section linstalling "Installing RKorAPClient from source" | 
|  | 60 | - R -q -e 'remotes::install_local(force = TRUE, dependencies = TRUE)' | 
|  | 61 | - ccache -s | 
|  | 62 | - end_section linstalling |