.gitlab-ci.yml 5.94 KB
Newer Older
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
1
2
stages: 
  - build_test
jfuser's avatar
jfuser committed
3
  - packages
Jean-Francois Rey's avatar
Jean-Francois Rey committed
4
5
  - build_img
  - deploy
jfuser's avatar
jfuser committed
6

Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
7
8
r-build_test:
  stage: build_test
jfuser's avatar
jfuser committed
9
10
11
  tags:
    - "r-base-biosp"
  script:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
12
    - "Rscript -e \"pkgbuild::compile_dll()\""
jfuser's avatar
jfuser committed
13
    - "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
14
    - "R CMD build . --resave-data --compact-vignettes=both"
Loup Rimbaud's avatar
Loup Rimbaud committed
15
    - "R CMD check --as-cran $(ls -rt landsepi_* |tail -1)"
jfuser's avatar
jfuser committed
16
17
18
  artifacts:
    paths:
      - "$(ls -rt landsepi_*.tar.gz |tail -1)"
jfuser's avatar
jfuser committed
19

Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
20
21
r-devel-build_test:
  stage: build_test
jfuser's avatar
jfuser committed
22
23
24
  tags:
    - "r-devel-biosp"  
  script:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
25
    - "Rscript -e \"pkgbuild::compile_dll()\""
jfuser's avatar
jfuser committed
26
    - "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
27
    - "R CMD build . --resave-data --compact-vignettes=both"
Loup Rimbaud's avatar
Loup Rimbaud committed
28
    - "R CMD check --as-cran $(ls -rt landsepi_* |tail -1)"
jfuser's avatar
jfuser committed
29
  artifacts:
jfuser's avatar
up    
jfuser committed
30
    paths:
jfuser's avatar
jfuser committed
31
      - "$(ls -rt landsepi_*.tar.gz |tail -1)"
Jean-Francois Rey's avatar
up CI    
Jean-Francois Rey committed
32
  allow_failure: true
jfuser's avatar
jfuser committed
33

Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
34
35
r-Mac-build_test:
  stage: build_test
jfuser's avatar
jfuser committed
36
  tags:
37
38
39
    - "MacOS"  
    - "R4.1"
    - "vmr"
jfuser's avatar
jfuser committed
40
  script:
41
    - Rscript -e "install.packages(c('roxygen2', 'rmarkdown', 'Rcpp','sp','Matrix', 'mvtnorm','maptools','fields','splancs','sf','DBI','RSQLite', 'foreach','parallel','doParallel', 'shiny', 'shinyjs', 'DT'), repos='https://cloud.r-project.org', type='mac.binary')"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
42
    - 'TMPDIR="/tmp" && Rscript -e "pkgbuild::compile_dll()"'
43
    - "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
44
    - "R CMD build . --resave-data --compact-vignettes=both"
Loup Rimbaud's avatar
Loup Rimbaud committed
45
    - "R CMD check --as-cran $(ls -rt landsepi_* |tail -1)"
jfuser's avatar
jfuser committed
46
  artifacts:
jfuser's avatar
up    
jfuser committed
47
    paths:
jfuser's avatar
jfuser committed
48
      - "$(ls -rt landsepi_*.tar.gz |tail -1)"
jfuser's avatar
jfuser committed
49

Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
50
51
r-windows-build_test:
  stage: build_test
52
53
  tags:
    - "win10"
54
55
    - "R4.1"
    - "vmr"
Jean-Francois Rey's avatar
up CI    
Jean-Francois Rey committed
56
57
  before_script:
    - pacman --noconfirm -yS mingw-w64-{i686,x86_64}-gsl
58
    - Rscript -e "install.packages(c('roxygen2', 'rmarkdown', 'Rcpp','sp','Matrix', 'mvtnorm','maptools','fields','splancs','sf','DBI','RSQLite', 'foreach','parallel','doParallel', 'shiny', 'shinyjs', 'DT'), repos='https://cloud.r-project.org')"
59
  script:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
60
61
    - "Rscript -e \"pkgbuild::compile_dll()\""
    - "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
62
    - "R CMD build . --resave-data --compact-vignettes=both"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
63
    - "R CMD check --as-cran $(ls -rt landsepi_* |tail -1)"
jfuser's avatar
jfuser committed
64
  artifacts:
jfuser's avatar
up    
jfuser committed
65
    paths:
jfuser's avatar
jfuser committed
66
67
      - "$(ls -rt landsepi_*.tar.gz |tail -1)"

Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
68
69
release-r:
  stage: packages
jfuser's avatar
jfuser committed
70
  tags:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
71
    - "r-base-biosp"
jfuser's avatar
jfuser committed
72
  script:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
73
    - "echo \"Nothing to do\""
jfuser's avatar
jfuser committed
74
  artifacts:
jfuser's avatar
up    
jfuser committed
75
    paths:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
76
      - "$(ls -rt landsepi_* |tail -1)"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
77
  rules:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
78
    - if: $CI_COMMIT_TAG != null
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
79
80
  dependencies:
    - r-build_test
81
82

release-win:
jfuser's avatar
jfuser committed
83
  stage: packages
84
85
86
87
88
  tags:
    - "win10"
    - "R"
    - "binaries"
  script:
Loup Rimbaud's avatar
Loup Rimbaud committed
89
    - "R CMD INSTALL --build --force-biarch $(ls -rt landsepi_*.tar.gz |tail -1)"
90
91
  artifacts:
    paths:
Loup Rimbaud's avatar
Loup Rimbaud committed
92
      - "$(ls -rt landsepi_*.zip |tail -1)"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
93
  rules:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
94
    - if: $CI_COMMIT_TAG != null
jfuser's avatar
jfuser committed
95
  dependencies:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
96
    - r-windows-build_test
97

Jean-Francois Rey's avatar
Jean-Francois Rey committed
98
release-winR4:
jfuser's avatar
jfuser committed
99
  stage: packages
100
  tags:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
101
    - "win10"
102
103
104
105
106
    - "R4.1"
    - "vmr"
  before_script:
    - pacman --noconfirm -yS mingw-w64-{i686,x86_64}-gsl
    - Rscript -e "install.packages(c('roxygen2', 'rmarkdown', 'Rcpp','sp','Matrix', 'mvtnorm','maptools','fields','splancs','sf','DBI','RSQLite', 'foreach','parallel','doParallel', 'shiny', 'shinyjs', 'DT'), repos='https://cloud.r-project.org')"
jfuser's avatar
up    
jfuser committed
107
  script:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
108
    - "R CMD INSTALL --build --force-biarch $(ls -rt landsepi_*.tar.gz |tail -1)"
109
110
  artifacts:
    paths:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
111
      - "$(ls -rt landsepi_*.zip |tail -1)"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
112
113
  rules:
    - if: $CI_COMMIT_TAG != null
jfuser's avatar
jfuser committed
114
  dependencies:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
115
    - r-windows-build_test
116

jfuser's avatar
jfuser committed
117
release-Mac:
jfuser's avatar
jfuser committed
118
  stage: packages
jfuser's avatar
jfuser committed
119
  tags:
120
121
122
    - "MacOS"  
    - "R4.1"
    - "vmr"
jfuser's avatar
jfuser committed
123
  script:
124
    - Rscript -e "install.packages(c('roxygen2', 'rmarkdown', 'Rcpp','sp','Matrix', 'mvtnorm','maptools','fields','splancs','sf','DBI','RSQLite', 'foreach','parallel','doParallel', 'shiny', 'shinyjs', 'DT'), repos='https://cloud.r-project.org', type='mac.binary')"
Loup Rimbaud's avatar
Loup Rimbaud committed
125
    - "R CMD INSTALL --build $(ls -rt landsepi_*.tar.gz |tail -1)"
jfuser's avatar
jfuser committed
126
127
  artifacts:
    paths:
Loup Rimbaud's avatar
Loup Rimbaud committed
128
      - "$(ls -rt landsepi_*.tgz | tail -1)"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
129
  rules:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
130
    - if: $CI_COMMIT_TAG != null
jfuser's avatar
jfuser committed
131
  dependencies:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
132
    - r-Mac-build_test
jfuser's avatar
jfuser committed
133

Jean-Francois Rey's avatar
Jean-Francois Rey committed
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
buildDocker:
  tags:
    - "dind"
    - "docker"
  variables:
    DOCKER_TLS_CERTDIR: ""
    DOCKER_HOST: tcp://docker:2375/
    DOCKER_DRIVER: overlay2
  services:
    - docker:19.03.0-dind
  before_script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  stage: build_img
  script:
    - docker pull $CI_REGISTRY_IMAGE:latest || true
    - docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:latest -f inst/shiny-landsepi/Dockerfile .
    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
    - docker push $CI_REGISTRY_IMAGE:latest
  after_script:
    - docker logout $CI_REGISTRY
Jean-Francois Rey's avatar
Jean-Francois Rey committed
154
  rules:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
155
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
Jean-Francois Rey's avatar
Jean-Francois Rey committed
156
157
158

deploy:
  image: debian
Jean-Francois Rey's avatar
up CI    
Jean-Francois Rey committed
159
  stage: deploy
Jean-Francois Rey's avatar
Jean-Francois Rey committed
160
161
  environment:
    name: shinyproxy
162
    url: https://shiny.biosp.inrae.fr/
Jean-Francois Rey's avatar
Jean-Francois Rey committed
163
  rules:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
164
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
Jean-Francois Rey's avatar
Jean-Francois Rey committed
165
166
167
168
169
  before_script:
    - apt-get update && apt-get install -y sshpass openssh-client
    - export SSHPASS=$DEPLOY_PWD
  script:
    - sshpass -e ssh -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_IP "./launch.sh $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $CI_REGISTRY_IMAGE latest"
jfuser's avatar
jfuser committed
170

171
pages:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
172
  stage: deploy
Jean-Francois Rey's avatar
Jean-Francois Rey committed
173
  image: rocker/tidyverse:4.0.1
174
175
  before_script:
    - apt-get update
Jean-Francois Rey's avatar
up ci    
Jean-Francois Rey committed
176
    - apt-get install -y --no-install-recommends libgsl-dev libudunits2-dev libproj-dev libgdal-dev libharfbuzz-dev libfribidi-dev 
177
  script:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
178
179
    - Rscript -e 'install.packages(c("devtools", "pkgdown"), repos="cloud.r-project.org")'
    - Rscript -e 'devtools::install()'
180
    - Rscript -e 'pkgdown::build_site(override = list(destination = "public"))'
181
182
183
184
    - mkdir -p public/inst/
    - cp -r inst/logos public/inst/
    - cp vignettes/listofparameters.pdf public/articles/
    - cp vignettes/landsepiposter.pdf public/articles/
185
186
187
188
  artifacts:
    paths:
      - public
  rules:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
189
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
Jean-Francois Rey's avatar
Jean-Francois Rey committed
190
      when: always