Skip to content
Snippets Groups Projects
Select Git revision
  • 6a93a3ee853f3fdd8cc1fdbc56f75d18556805e2
  • main default protected
  • dev protected
  • 1.2.2
  • 1.2.1
  • 1.2.0
  • 1.1.0
  • 1.0.0
  • 0.3.0
  • 0.2.0
  • 0.1.0
11 results

.gitlab-ci.yml

Blame
  • .gitlab-ci.yml 2.17 KiB
    image: rocker/geospatial:latest
    
    variables:
      GIT_DEPTH: 10
      REPO_NAME: "https://packagemanager.rstudio.com/all/__linux__/focal/latest"
      R_LIBS: "ci/lib"
    
    cache:
      key: global-cache
      paths:
          - ${R_LIBS}
    
    stages:
      - build
      - pkgdown
      - pkgdown-move
      - deploy
    
    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")'
        - Rscript -e 'remotes::install_git("https://gitlab-forge.din.developpement-durable.gouv.fr/dreal-pdl/csd/data.nitrates.git")'
        - R -e 'rcmdcheck::rcmdcheck(args = c("--no-manual"), error_on = "warning", check_dir = "check")'
        - ls -la
        - mkdir -p public
        - ls -la public
        - ls -la $R_LIBS
    
    integration:
        stage: pkgdown
        allow_failure: true
        when: on_success
        only:
            - master
        script:
            - Rscript -e 'remotes::install_cran(c("pkgdown"), upgrade = "never")'
            - Rscript -e 'pkgdown::build_site()'
        artifacts:
            paths:
                - docs
            expire_in: 30 days
    
    integration-master:
        stage: pkgdown-move
        dependencies:
            - integration
        only:
            - master
        script:
            - mkdir -p public
            - echo "test file" > public/test.txt
            - '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"'
            - ls -la docs || echo "Docs directory does not exist or is empty"
            - cp -r docs/* public || echo "No files to copy"
            - ls -la public
        artifacts:
            paths:
                - public
            expire_in: 30 days