.gitlab-ci.yml 3.64 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
Jean-Francois Rey committed
32
33
  rules:
    allow_failure: true
34

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

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

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

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

jfuser's avatar
jfuser committed
94
release-Mac:
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
95
  stage: packages
jfuser's avatar
jfuser committed
96
97
98
99
  tags:
    - "Mac"  
    - "R"
  script:
jfuser's avatar
jfuser committed
100
    - "R CMD INSTALL --build $(ls -rt landsepiDev_*.tar.gz |tail -1)"
jfuser's avatar
jfuser committed
101
102
  artifacts:
    paths:
jfuser's avatar
jfuser committed
103
      - "$(ls -rt landsepiDev_*.tgz | tail -1)"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
104
105
  rules:
    - if: $CI_COMMIT_TAG != ""
Jean-Loup Gaussen's avatar
Jean-Loup Gaussen committed
106
107
  dependencies:
    - r-Mac-build_test
jfuser's avatar
jfuser committed
108

Jean-Francois Rey's avatar
Jean-Francois Rey committed
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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
129
130
  rules:
    - if: $CI_COMMIT_BRANCH == "master"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
131
132
133
134
135
136
137

deploy:
  image: debian
  stage: deploy
  environment:
    name: shinyproxy
    url: https://shiny.biosp.inra.fr/
Jean-Francois Rey's avatar
Jean-Francois Rey committed
138
139
  rules:
    - if: $CI_COMMIT_BRANCH == "master"
Jean-Francois Rey's avatar
Jean-Francois Rey committed
140
141
142
143
144
145
  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"