.gitlab-ci.yml 4.34 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
37
  tags:
    - "Mac"  
Jean-Francois Rey's avatar
Jean-Francois Rey committed
38
    - "R4"
jfuser's avatar
jfuser committed
39
  script:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
40
    - 'TMPDIR="/tmp" && Rscript -e "pkgbuild::compile_dll()"'
41
    - "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
42
    - "R CMD build . --resave-data --compact-vignettes=both"
Loup Rimbaud's avatar
Loup Rimbaud committed
43
    - "R CMD check --as-cran $(ls -rt landsepi_* |tail -1)"
jfuser's avatar
jfuser committed
44
  artifacts:
jfuser's avatar
up    
jfuser committed
45
    paths:
jfuser's avatar
jfuser committed
46
      - "$(ls -rt landsepi_*.tar.gz |tail -1)"
jfuser's avatar
jfuser committed
47

Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
48
49
r-windows-build_test:
  stage: build_test
50
51
52
53
54
  tags:
    - "win10"
    - "R"
    - "binaries"
  script:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
55
56
    - "Rscript -e \"pkgbuild::compile_dll()\""
    - "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
57
    - "R CMD build . --resave-data --compact-vignettes=both"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
58
    - "R CMD check --as-cran $(ls -rt landsepi_* |tail -1)"
jfuser's avatar
jfuser committed
59
  artifacts:
jfuser's avatar
up    
jfuser committed
60
    paths:
jfuser's avatar
jfuser committed
61
62
      - "$(ls -rt landsepi_*.tar.gz |tail -1)"

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

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

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

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

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

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

160
161
pages:
  stage: deploy
Jean-Francois Rey's avatar
Jean-Francois Rey committed
162
  image: rocker/tidyverse:4.0.1
163
164
165
166
167
168
169
170
  script:
    - Rscript -e 'install.packages("pkgdown", repos="cloud.r-project.org", ask=FALSE)'
    - Rscript -e 'pkgdown::build_site(override = list(destination = "public"))'
  artifacts:
    paths:
      - public
  rules:
    - if: '$CI_COMMIT_BRANCH == "master"'
Jean-Francois Rey's avatar
Jean-Francois Rey committed
171
      when: always
172
173