-
Notifications
You must be signed in to change notification settings - Fork 49
/
.gitlab-ci.yml
113 lines (102 loc) · 2.74 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/rocker/geospatial:latest
default:
tags:
- chs-shared
- dind
stages:
- getready
- check
- test
- end
- deploy
variables:
_R_CHECK_CRAN_INCOMING_: "false"
_R_CHECK_SUGGESTS_ONLY: "false"
_R_CHECK_FORCE_SUGGESTS_: "true"
_R_CHECK_DONTTEST_EXAMPLES_: "false"
R_PROFILE: "$R_HOME/etc/Rprofile.site"
APT_CACHE: "$CI_PROJECT_DIR/ci/lib/apt-cache"
CRAN: "https://rpkg.chs.usgs.gov/prod-cran/latest"
R_LIBS_USER: "$CI_PROJECT_DIR/ci/lib"
R_LIBS: "$CI_PROJECT_DIR/ci/lib"
BUILD_LOGS_DIR: "$CI_PROJECT_DIR/ci/logs"
NOT_CRAN: "true"
CONNECT_API_KEY: $CONNECT_API_KEY
CONNECT_SERVER: $CONNECT_SERVER
PAGES_OUTDIR: "$CI_PROJECT_DIR/public"
cache:
paths:
- $R_LIBS_USER
getready:
stage: getready
script:
- mkdir -p $R_LIBS_USER
- mkdir -p $APT_CACHE
- echo "options(Ncpus=$(nproc --all), repos=c(CRAN='$CRAN'))" >> $R_PROFILE
- Rscript -e "install.packages(c('devtools', 'pkgdown', 'covr', 'connectapi', 'zoo', 'rsconnect', 'data.table'))"
- Rscript -e 'remotes::install_deps(dependencies=TRUE)'
cache:
paths:
- $R_LIBS_USER
artifacts:
paths:
- $R_LIBS_USER
buildcheck:
stage: check
script:
- mkdir -p $BUILD_LOGS_DIR
- apt-get update
- apt-get -o dir::cache::archives=${APT_CACHE} install -y --no-install-recommends qpdf pandoc pandoc-citeproc
- R CMD build . --no-manual
- R -e 'devtools::check(document = FALSE, args = "--no-tests", check_dir = Sys.getenv("BUILD_LOGS_DIR"))'
artifacts:
paths:
- $BUILD_LOGS_DIR
unittests:
stage: test
dependencies:
- getready
- buildcheck
script:
- R -e 'library(testthat); options(testthat.output_file = file.path(Sys.getenv("CI_PROJECT_DIR"), "test-out.xml")); devtools::test(reporter = "junit")'
artifacts:
when: always
paths:
- test-out.xml
reports:
junit: test-out.xml
covertests:
stage: test
dependencies:
- getready
- buildcheck
script:
- R -e 'x <- covr::package_coverage(); covr::to_cobertura(x); x; '
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: cobertura.xml
coverage: '/Coverage: \d+.\d+\%/'
pages:
stage: end
only:
- main
script:
- Rscript -e 'pkgdown::build_site(override = list(destination = "public"))'
- Rscript -e 'source("deploy_simple.R")'
artifacts:
paths:
- $PAGES_OUTDIR
expire_in: 1 week
Validate Inventory:
stage: end
image: ${INTERNAL_REGISTRY}software/software-management:latest
script:
- software-management review
--project "${CI_PROJECT_PATH}"
--ref "${CI_COMMIT_BRANCH}"
--type "provisional"
--token "${GIT_TOKEN_CUSTOM}"
tags:
- chs-shared