diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 55b228be5197bc5b929b073c8b8cfa7a41ecbe08..0d97fc385c46b1a8f8ff1002801c2c65214bdbbe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,14 +1,12 @@ image: rocker/verse:latest variables: - GIT_DEPTH: 10 - REPO_NAME: "https://packagemanager.rstudio.com/all/__linux__/focal/latest" - R_LIBS: "ci/lib" + R_LIBS_USER: "ci/lib" cache: key: global-cache paths: - - ${R_LIBS} + - ci/lib/ stages: - build @@ -20,13 +18,10 @@ stages: building: stage: build script: - - apt-get update -qq && apt-get install -y libharfbuzz-dev libfribidi-dev - - echo "Library path for packages :" $R_LIBS - - mkdir -p $R_LIBS - - Rscript -e 'install.packages("remotes")' - - Rscript -e 'install.packages("rcmdcheck")' - - Rscript -e 'remotes::install_local(upgrade = "never")' - - R -e 'rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")' + - mkdir -p -m777 $R_LIBS_USER + - Rscript -e '.libPaths(c(Sys.getenv("R_LIBS_USER"), .libPaths()));remotes::install_deps(dependencies = TRUE, upgrade = "always")' + - Rscript -e '.libPaths(c(Sys.getenv("R_LIBS_USER"), .libPaths()));remotes::install_cran(c("pkgdown"), upgrade = "always")' + - Rscript -e '.libPaths(c(Sys.getenv("R_LIBS_USER"), .libPaths()));devtools::check()' # To have the coverage percentage appear as a gitlab badge follow these # instructions: @@ -40,73 +35,46 @@ coverage: when: on_success only: - master - - production + - dev + - test-ci script: - - Rscript -e 'remotes::install_local(upgrade = "never")' - - Rscript -e 'remotes::install_cran(c("covr", "DT"), upgrade = "never")' - - Rscript -e 'covr::gitlab(quiet = FALSE)' + - Rscript -e '.libPaths(c(Sys.getenv("R_LIBS_USER"), .libPaths()));covr::gitlab(quiet = FALSE);' artifacts: paths: - public expire_in: 30 days + # To produce a code coverage report as a GitLab page see # https://about.gitlab.com/2016/11/03/publish-code-coverage-report-with-gitlab-pages/ + + integration: stage: pkgdown allow_failure: true when: on_success only: - master - - production + - dev - test-ci script: - - Rscript -e 'remotes::install_cran(c("pkgdown"), upgrade = "never")' - - Rscript -e 'pkgdown::build_site()' + - Rscript -e '.libPaths(c(Sys.getenv("R_LIBS_USER"), .libPaths()));remotes::install_local();pkgdown::build_site()' artifacts: paths: - docs expire_in: 30 days -integration-test: - stage: pkgdown-move - dependencies: - - integration - only: - - test-ci - script: - - mkdir -p public/test - - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/master/download?job=pages" && - unzip artifacts.zip && - rm artifacts.zip && - echo "copied master artifacts" || - echo "copied master artifacts failed"' - - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/production/download?job=pages" && - unzip artifacts.zip && - rm artifacts.zip && - echo "copied production artifacts" || - echo "copied production artifacts failed"' - - cp -r docs/* public/test - artifacts: - paths: - - public - expire_in: 30 days -integration-production: +integration-dev: stage: pkgdown-move dependencies: - integration only: - - production + - dev script: - - mkdir -p public/production - - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/master/download?job=pages" && - unzip artifacts.zip && - rm artifacts.zip && - echo "copied master artifacts" || - echo "copied master artifacts failed"' - - cp -r docs/* public/production + - mkdir -p public/dev + - cp -r docs/* public/dev artifacts: paths: - public @@ -120,11 +88,6 @@ integration-master: - master script: - mkdir -p public - - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/production/download?job=pages" && - unzip artifacts.zip && - rm artifacts.zip && - echo "copied production artifacts" || - echo "copied production artifacts failed"' - cp -r docs/* public artifacts: paths: @@ -134,11 +97,11 @@ integration-master: pages: stage: deploy script: - - echo "deployment with cache" + - echo "deployment with cache ?" artifacts: paths: - public only: - master - - production + - dev - test-ci