.gitlab-ci.yml 4.92 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:
Jean-Francois Rey's avatar
up ci    
Jean-Francois Rey committed
41
    - Rscript -e 'install.packages(c("roxygen2", "Rcpp","sp","Matrix","mvtnorm","maptools","fields","splancs","sf","DBI","RSQLite","foreach","parallel","doParallel"))'
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"
56
  script:
Jean-Francois Rey's avatar
up ci    
Jean-Francois Rey committed
57
    - Rscript -e 'install.packages(c("roxygen2", "Rcpp","sp","Matrix","mvtnorm","maptools","fields","splancs","sf","DBI","RSQLite","foreach","parallel","doParallel"))'
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
58
59
    - "Rscript -e \"pkgbuild::compile_dll()\""
    - "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
60
    - "R CMD build . --resave-data --compact-vignettes=both"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
61
    - "R CMD check --as-cran $(ls -rt landsepi_* |tail -1)"
jfuser's avatar
jfuser committed
62
  artifacts:
jfuser's avatar
up    
jfuser committed
63
    paths:
jfuser's avatar
jfuser committed
64
65
      - "$(ls -rt landsepi_*.tar.gz |tail -1)"

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

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

Jean-Francois Rey's avatar
Jean-Francois Rey committed
96
release-winR4:
jfuser's avatar
jfuser committed
97
  stage: packages
98
  tags:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
99
100
    - "win10"
    - "R4"
jfuser's avatar
up    
jfuser committed
101
  script:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
102
    - "R CMD INSTALL --build --force-biarch $(ls -rt landsepi_*.tar.gz |tail -1)"
103
104
  artifacts:
    paths:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
105
      - "$(ls -rt landsepi_*.zip |tail -1)"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
106
107
  rules:
    - if: $CI_COMMIT_TAG != null
jfuser's avatar
jfuser committed
108
  dependencies:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
109
    - r-windows-build_test
110

jfuser's avatar
jfuser committed
111
release-Mac:
jfuser's avatar
jfuser committed
112
  stage: packages
jfuser's avatar
jfuser committed
113
114
  tags:
    - "Mac"  
Jean-Francois Rey's avatar
Jean-Francois Rey committed
115
    - "R4"
jfuser's avatar
jfuser committed
116
  script:
Loup Rimbaud's avatar
Loup Rimbaud committed
117
    - "R CMD INSTALL --build $(ls -rt landsepi_*.tar.gz |tail -1)"
jfuser's avatar
jfuser committed
118
119
  artifacts:
    paths:
Loup Rimbaud's avatar
Loup Rimbaud committed
120
      - "$(ls -rt landsepi_*.tgz | tail -1)"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
121
  rules:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
122
    - if: $CI_COMMIT_TAG != null
jfuser's avatar
jfuser committed
123
  dependencies:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
124
    - r-Mac-build_test
jfuser's avatar
jfuser committed
125

Jean-Francois Rey's avatar
Jean-Francois Rey committed
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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
146
  rules:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
147
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
Jean-Francois Rey's avatar
Jean-Francois Rey committed
148
149
150

deploy:
  image: debian
Jean-Francois Rey's avatar
up CI    
Jean-Francois Rey committed
151
  stage: deploy
Jean-Francois Rey's avatar
Jean-Francois Rey committed
152
153
  environment:
    name: shinyproxy
154
    url: https://shiny.biosp.inrae.fr/
Jean-Francois Rey's avatar
Jean-Francois Rey committed
155
  rules:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
156
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
Jean-Francois Rey's avatar
Jean-Francois Rey committed
157
158
159
160
161
  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
162

163
pages:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
164
  stage: deploy
Jean-Francois Rey's avatar
Jean-Francois Rey committed
165
  image: rocker/tidyverse:4.0.1
166
167
  before_script:
    - apt-get update
Jean-Francois Rey's avatar
up ci    
Jean-Francois Rey committed
168
    - apt-get install -y --no-install-recommends libgsl-dev libudunits2-dev libproj-dev libgdal-dev libharfbuzz-dev libfribidi-dev 
169
  script:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
170
171
    - Rscript -e 'install.packages(c("devtools", "pkgdown"), repos="cloud.r-project.org")'
    - Rscript -e 'devtools::install()'
172
173
174
175
176
    - Rscript -e 'pkgdown::build_site(override = list(destination = "public"))'
  artifacts:
    paths:
      - public
  rules:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
177
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
Jean-Francois Rey's avatar
Jean-Francois Rey committed
178
      when: always