-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
48 lines (41 loc) · 1.59 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
#image: agoradigital/r-scrapper-cicd:latest
image: docker:latest
services:
- docker:dind
stages:
- build
- test
- deploy
variables:
DOCKER_HOST: tcp://docker:2375/
CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:gitlab-ci-dev
COMPOSE_CMD: docker-compose -f docker-compose.yml
before_script:
- apk --no-cache add curl
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- source $HOME/.cargo/env
- apk add python3-dev py3-pip docker-cli libffi-dev openssl-dev gcc libc-dev make && pip3 --no-cache install python-dotenv docker-compose
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- export PKG_IMAGE_TAG=$CONTAINER_TEST_IMAGE
build:
stage: build
script:
- $COMPOSE_CMD pull || true
- $COMPOSE_CMD build
- $COMPOSE_CMD push
tests:
stage: test
script:
- $COMPOSE_CMD pull
- $COMPOSE_CMD run rmod sh -c 'Rscript -e "tryCatch(stopifnot(length(devtools::check(check_dir = \".\", args = c(\"--no-examples\", \"--as-cran\", \"--no-manual\", \"--no-tests\"))$errors) == 0),error = function(error_message) {print(paste(\"Exception when checking code:\",error_message))})"'
- $COMPOSE_CMD run rmod sh -c 'Rscript -e "devtools::test()"'
- $COMPOSE_CMD run -e CODECOV_TOKEN=$CODECOV_TOKEN rmod sh -c 'Rscript -e "library(covr);codecov()"'
pages:
stage: deploy
script:
- $COMPOSE_CMD pull
- $COMPOSE_CMD run rmod sh -c 'Rscript -e "install.packages(\"pkgdown\"); devtools::document(); pkgdown::build_site(override = list(destination = \"public\"))"; mv docs public/'
- $COMPOSE_CMD push
artifacts:
paths:
- public