-
Notifications
You must be signed in to change notification settings - Fork 8
/
.gitlab-ci.yml
72 lines (60 loc) · 1.79 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
image: docker:stable
services:
- docker:stable-dind
stages:
- build-base
- build-others
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs"
IMAGE_NAME: ${CI_REGISTRY_IMAGE}/${CI_BUILD_NAME}
before_script:
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
.rel:
stage: build-base
script:
- apk add jq curl
- R_VERSION=$(curl -s "https://rversions.r-pkg.org/r-${CI_BUILD_NAME}" | jq -r '.[].version')
- docker pull ${IMAGE_NAME} || true
- docker build --cache-from ${IMAGE_NAME}
--tag ${IMAGE_NAME}
--build-arg R_VERSION=${R_VERSION} .
- docker run ${IMAGE_NAME} R --version
- docker tag ${IMAGE_NAME} ${IMAGE_NAME}:${R_VERSION}
- docker tag ${IMAGE_NAME} ${IMAGE_NAME}:${R_VERSION:0:1}
- docker push ${IMAGE_NAME}
- docker push ${IMAGE_NAME}:${R_VERSION}
- docker push ${IMAGE_NAME}:${R_VERSION:0:1}
.dev:
stage: build-base
script:
- docker build --tag ${IMAGE_NAME}
--build-arg R_VERSION=${CI_BUILD_NAME} .
- docker run ${IMAGE_NAME} R --version
- docker push ${IMAGE_NAME}
.pkg:
stage: build-others
dependencies:
- release
script:
- docker build --tag ${IMAGE_NAME}
--build-arg APK_PKG="${APK_PKG}"
--build-arg R_CRAN_PKG="${R_CRAN_PKG}"
--build-arg R_GITHUB_PKG="${R_GITHUB_PKG}"
--file Dockerfile-rpkg .
- docker run ${IMAGE_NAME} Rscript -e "packageVersion('${CI_BUILD_NAME}')"
- docker push ${IMAGE_NAME}
release:
extends: .rel
oldrel:
extends: .rel
devel:
extends: .dev
patched:
extends: .dev
tidyverse:
extends: .pkg
variables:
APK_PKG: libxml2-dev libressl-dev
R_GITHUB_PKG: tidyverse/readxl
R_CRAN_PKG: tidyverse data.table dtplyr