.gitlab-ci.yml 3.95 KB
Newer Older
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
1
2
3
stages: 
  - build_test
  - packages
Jean-Francois Rey's avatar
Jean-Francois Rey committed
4
5
  - build_img
  - deploy
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
6
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
14
    - "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
    - "R CMD build . --resave-data"
jfuser's avatar
jfuser committed
15
    - "R CMD check --as-cran $(ls -rt landsepiDev_* |tail -1)"
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
16
17
18
  artifacts:
    paths:
      - "$(ls -rt landsepiDev_*.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
27
    - "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
    - "R CMD build . --resave-data"
jfuser's avatar
jfuser committed
28
    - "R CMD check --as-cran $(ls -rt landsepiDev_* |tail -1)"
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
29
30
31
  artifacts:
    paths:
      - "$(ls -rt landsepiDev_*.tar.gz |tail -1)"
Jean-Francois Rey's avatar
up CI    
Jean-Francois Rey committed
32
  allow_failure: true
33

Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
34
35
r-Mac-build_test:
  stage: build_test
36
37
  tags:
    - "Mac"  
Jean-Francois Rey's avatar
Jean-Francois Rey committed
38
    - "R4"
39
  script:
Jean-Francois Rey's avatar
Jean-Francois Rey committed
40
    - 'TMPDIR="/tmp" && Rscript -e "pkgbuild::compile_dll()"'
41
42
    - "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
    - "R CMD build . --resave-data"
jfuser's avatar
jfuser committed
43
    - "R CMD check --as-cran $(ls -rt landsepiDev_* |tail -1)"
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
44
45
46
  artifacts:
    paths:
      - "$(ls -rt landsepiDev_*.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"
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
58
59
60
61
    - "R CMD check --as-cran $(ls -rt landsepiDev_* |tail -1)"
  artifacts:
    paths:
      - "$(ls -rt landsepiDev_*.tar.gz |tail -1)"
62

Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
63
64
release-r:
  stage: packages
65
  tags:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
66
    - "r-base-biosp"
67
  script:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
68
    - "echo \"Nothing to do\""
69
70
  artifacts:
    paths:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
71
      - "$(ls -rt landsepiDev_* |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

Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
77
78
release-win:
  stage: packages
79
  tags:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
80
81
82
    - "win10"
    - "R"
    - "binaries"
83
  script:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
84
    - "R CMD INSTALL --build --force-biarch $(ls -rt landsepiDev_*.tar.gz |tail -1)"
85
86
  artifacts:
    paths:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
87
      - "$(ls -rt landsepiDev_*.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
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
90
91
  dependencies:
    - r-windows-build_test
92

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

jfuser's avatar
jfuser committed
108
release-Mac:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen 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:
jfuser's avatar
jfuser committed
114
    - "R CMD INSTALL --build $(ls -rt landsepiDev_*.tar.gz |tail -1)"
jfuser's avatar
jfuser committed
115
116
  artifacts:
    paths:
jfuser's avatar
jfuser committed
117
      - "$(ls -rt landsepiDev_*.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
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
120
121
  dependencies:
    - 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
159
  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"