-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
97 lines (92 loc) · 3.89 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# helpful Links:
# https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
# https://www.youtube.com/watch?v=7I6tHw68DMQ
stages:
- test
- production
variables:
# RETICULATE_MINICONDA_PATH: "/root/.local/share/r-miniconda/"
# RETICULATE_PYTHON_ENV: "/root/.local/share/r-miniconda/envs/r-reticulate/"
RUN_PYTHON_CONFIG_TESTS: "true"
.before_script_templ: &before_script_templ
- apt-get update && apt-get upgrade -y
- apt-get install -y git
# Packages to build Python and R packages
- |
apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev curl libncursesw5-dev xz-utils tk-dev \
libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
libharfbuzz-dev libfribidi-dev libcurl4-openssl-dev \
libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev
- apt-get install -y python3.10-venv python3-pip
test:
image: rocker/r-ver:4.4.1
stage: test
tags:
- docker
variables:
RENV_CONFIG_EXTERNAL_LIBRARIES: "/usr/local/lib/R/library"
RENV_PATHS_CACHE: "/root/.cache/R/renv/cache" #"$CI_PROJECT_DIR/cache"
RENV_PATHS_LIBRARY: "/root/.cache/R/renv/library" #"$CI_PROJECT_DIR/renv/library"
R_LIBS: "/usr/local/lib/R/site-library:/usr/local/lib/R/library:$RENV_PATHS_LIBRARY"
before_script:
- *before_script_templ
- R -e "install.packages('renv', repos = c(CRAN = 'https://cloud.r-project.org'))"
- R -e "renv::restore()"
# Setup python and fix python virtual environment
- R -e 'reticulate::virtualenv_create(envname="r2ogs6", python="/usr/bin/python3", packages = c("numpy==1.26.4", "vtk==9.3.1"))'
- echo "RETICULATE_PYTHON=/root/.virtualenvs/r2ogs6/bin/python" > .Renviron
- R -e 'reticulate::py_config()'
#- R -e 'renv::status()'
# - R -e 'renv::install()'
# - R -e 'renv::install("bioc::rhdf5")'
script:
- R -e "devtools::test()"
- R -e "devtools::check(vignettes=FALSE)"
# - R CMD build . --no-manual --no-build-vignettes
# - R CMD check $(ls -1t *.tar.gz | head -n 1) --no-manual --no-build-vignettes
after_script:
- R -e "install.packages('covr', repos = c(CRAN = 'https://cloud.r-project.org'))"
- R -e 'covr::package_coverage(type = c("tests", "examples"), quiet = F)'
coverage: '/Coverage: \d+\.\d+\%/'
# Omit cache for now, ci always crashed the second time, dunno why
# cache:
# key: "$CI_COMMIT_REF_SLUG"
# untracked: true
# paths:
# - "$RENV_PATHS_CACHE"
# - "$RENV_PATHS_LIBRARY"
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "web"'
- if: '$CI_COMMIT_BRANCH == "master"'
test_install:
image: rocker/r-ver:4.4.1
stage: production
tags:
- docker
before_script:
- *before_script_templ
- mkdir ../test_r2ogs6 && cd ../test_r2ogs6 && ls . -ahl
script:
# Install r2ogs6
- R -e 'install.packages(c("remotes", "BiocManager"))'
- R -e "remotes::install_local(path=\"$CI_PROJECT_DIR\", dependencies='Imports', repos=BiocManager::repositories())"
- R -e 'reticulate::virtualenv_create(envname="r2ogs6", python="/usr/bin/python3", packages = c("numpy==1.26.4", "vtk==9.3.1"))'
#- R -e 'reticulate::use_virtualenv(virtualenv="r2ogs6")'
- echo "RETICULATE_PYTHON=/root/.virtualenvs/r2ogs6/bin/python" > .Renviron
- R -e 'reticulate::py_config()'
- R -e 'r2ogs6::install_ogs(ogs_version = "6.5.2", envname = "r2ogs6")'
- R -e 'reticulate::py_module_available("ogs")'
# Run benchmark
- |
R -e '
library(r2ogs6)
set_ogs6_bin_path();
prj_path <- system.file("extdata/benchmarks/flow_no_strain/flow_no_strain.prj", package = "r2ogs6");
sim_path <- tempdir();
exit_code <- r2ogs6:::run_benchmark(prj_path=prj_path, sim_path=sim_path);
assertthat::are_equal(exit_code, 0)
'
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "web"'
- if: '$CI_COMMIT_BRANCH == "master"'