-
Johannes Boog authored
running ogs as singularity container in the gitlab ci requires to run the ci-container (docker) with elevated priviliges. this is accomplished via a manual login.
Johannes Boog authoredrunning ogs as singularity container in the gitlab ci requires to run the ci-container (docker) with elevated priviliges. this is accomplished via a manual login.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
.gitlab-ci.yml 2.99 KiB
# helpful Links:
# https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
# https://www.youtube.com/watch?v=7I6tHw68DMQ
stages:
- test
- test-benchmarks
test:
image: $CI_REGISTRY_IMAGE:09092022
stage: test
tags:
- envinf2
variables:
R_LIBS_USER: "$CI_PROJECT_DIR/ci/lib/"
RETICULATE_MINICONDA_PATH: "/root/.local/share/r-miniconda/" #default path
RETICULATE_PYTHON_ENV: "/root/.local/share/r-miniconda/envs/r-reticulate/"
script:
- if [ ! -d "$R_LIBS_USER" ]; then mkdir -p "$R_LIBS_USER"; fi
- R -e 'withr::with_libpaths(new = Sys.getenv("R_LIBS_USER"), devtools::install_deps(dependencies = T))'
# checks if the packages from the Imports, Suggests, LinkinTo field
# are already installed in the cache
- R -e '.libPaths(new = Sys.getenv("R_LIBS_USER"))'
- R -e 'withr::with_libpaths(new = Sys.getenv("R_LIBS_USER"), {install.packages("BiocManager"); BiocManager::install("rhdf5")})'
# Build and Check r2ogs6
- R CMD build . --no-build-vignettes --no-manual
- R CMD check $(ls -1t *.tar.gz | head -n 1) --no-build-vignettes --no-manual
after_script:
- R -e 'covr::package_coverage(type = c("tests", "examples"), quiet = F)'
coverage: '/Coverage: \d+\.\d+\%/'
cache:
key: "$CI_COMMIT_REF_SLUG"
untracked: true
paths:
- "$R_LIBS_USER"
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "web"'
- if: '$CI_COMMIT_BRANCH == "master"'
benchmark:ref:
stage: test-benchmarks
tags:
- envinf3-shell
variables:
DOCKER_TAG: "$CI_PROJECT_NAME-$CI_COMMIT_BRANCH-ref-$OGS_VERSION"
OGS_VERSION: "6.4.1"
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
- when: on_success
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# in case remove old container
- docker ps -q --filter name=$DOCKER_TAG | grep -q . && docker rm $DOCKER_TAG -f
# create and start container
- docker container create --privileged -e OGS_VERSION=$OGS_VERSION --env-file $CI_PROJECT_DIR/ci/env.list --name $DOCKER_TAG $CI_REGISTRY_IMAGE:09092022
- docker container start $DOCKER_TAG
# configure R and start bm-script
- docker cp $CI_PROJECT_DIR $DOCKER_TAG:/root/r2ogs6
- docker exec $DOCKER_TAG bash -c 'if [ ! -d "$R_LIBS_USER" ]; then mkdir -p "$R_LIBS_USER"; fi'
- docker exec $DOCKER_TAG bash -c 'echo $R_LIBS_USER && ls $R_LIBS_USER'
- docker exec $DOCKER_TAG bash -c 'cd /root/r2ogs6 && R -e "devtools::install_deps(dependencies = T)"'
- docker exec $DOCKER_TAG bash -c 'cd /root/r2ogs6 && R -e "install.packages(\"BiocManager\"); BiocManager::install(\"rhdf5\")"'
- docker exec $DOCKER_TAG bash -c 'cd /root/r2ogs6 && Rscript ci/test_bm_script.R "$OGS_VERSION" "ref"'
- docker exec $DOCKER_TAG bash -c 'cd /root/r2ogs6 && Rscript ci/test_bm_script.R "$OGS_VERSION" "r2ogs6"'
- docker exec $DOCKER_TAG bash -c 'cd /root/r2ogs6 && Rscript ci/test_bm_script.R "$OGS_VERSION" "test"'
after_script:
- docker container rm $DOCKER_TAG -f