@@ -19,152 +19,19 @@ jobs:
1919
2020 name : Collect deps
2121
22- env :
23- R_REMOTES_NO_ERRORS_FROM_WARNINGS : true
24- RSPM : https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
25- GITHUB_PAT : ${{ secrets.GITHUB_TOKEN }}
26- # prevent rgl issues because no X11 display is available
27- RGL_USE_NULL : true
28- # Begin custom: env vars
29- # End custom: env vars
30-
3122 steps :
32- - name : Check rate limits
33- run : |
34- curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit
35- shell : bash
36-
3723 - uses : actions/checkout@v2
3824
39- - uses : r-lib/actions/setup-r@v1
25+ - uses : ./.github/workflows/rate-limit
26+ with :
27+ token : ${{ secrets.GITHUB_TOKEN }}
28+
29+ - uses : r-lib/actions/setup-r@v2
4030 with :
4131 install-r : false
4232
4333 - id : set-matrix
44- run : |
45- # Determine package dependencies
46- # From remotes
47- read_dcf <- function(path) {
48- fields <- colnames(read.dcf(path))
49- as.list(read.dcf(path, keep.white = fields)[1, ])
50- }
51-
52- re_match <- function(text, pattern, perl = TRUE, ...) {
53-
54- stopifnot(is.character(pattern), length(pattern) == 1, !is.na(pattern))
55- text <- as.character(text)
56-
57- match <- regexpr(pattern, text, perl = perl, ...)
58-
59- start <- as.vector(match)
60- length <- attr(match, "match.length")
61- end <- start + length - 1L
62-
63- matchstr <- substring(text, start, end)
64- matchstr[ start == -1 ] <- NA_character_
65-
66- res <- data.frame(
67- stringsAsFactors = FALSE,
68- .text = text,
69- .match = matchstr
70- )
71-
72- if (!is.null(attr(match, "capture.start"))) {
73-
74- gstart <- attr(match, "capture.start")
75- glength <- attr(match, "capture.length")
76- gend <- gstart + glength - 1L
77-
78- groupstr <- substring(text, gstart, gend)
79- groupstr[ gstart == -1 ] <- NA_character_
80- dim(groupstr) <- dim(gstart)
81-
82- res <- cbind(groupstr, res, stringsAsFactors = FALSE)
83- }
84-
85- names(res) <- c(attr(match, "capture.names"), ".text", ".match")
86- class(res) <- c("tbl_df", "tbl", class(res))
87- res
88- }
89-
90- dev_split_ref <- function(x) {
91- re_match(x, "^(?<pkg>[^@#]+)(?<ref>[@#].*)?$")
92- }
93-
94- has_dev_dep <- function(package) {
95- cran_url <- "https://cloud.r-project.org"
96-
97- refs <- dev_split_ref(package)
98- url <- file.path(cran_url, "web", "packages", refs[["pkg"]], "DESCRIPTION")
99-
100- f <- tempfile()
101- on.exit(unlink(f))
102-
103- utils::download.file(url, f)
104- desc <- read_dcf(f)
105-
106- url_fields <- c(desc$URL, desc$BugReports)
107-
108- if (length(url_fields) == 0) {
109- return(FALSE)
110- }
111-
112- pkg_urls <- unlist(strsplit(url_fields, "[[:space:]]*,[[:space:]]*"))
113-
114- # Remove trailing "/issues" from the BugReports URL
115- pkg_urls <- sub("/issues$", "", pkg_urls)
116-
117- valid_domains <- c("github[.]com", "gitlab[.]com", "bitbucket[.]org")
118-
119- parts <-
120- re_match(pkg_urls,
121- sprintf("^https?://(?<domain>%s)/(?<username>%s)/(?<repo>%s)(?:/(?<subdir>%s))?",
122- domain = paste0(valid_domains, collapse = "|"),
123- username = "[^/]+",
124- repo = "[^/@#]+",
125- subdir = "[^/@$ ]+"
126- )
127- )[c("domain", "username", "repo", "subdir")]
128-
129- # Remove cases which don't match and duplicates
130-
131- parts <- unique(stats::na.omit(parts))
132-
133- nrow(parts) == 1
134- }
135-
136- if (!requireNamespace("desc", quietly = TRUE)) {
137- install.packages("desc")
138- }
139-
140- deps_df <- desc::desc_get_deps()
141- deps_df <- deps_df[deps_df$type %in% c("Depends", "Imports", "LinkingTo", "Suggests"), ]
142-
143- packages <- sort(deps_df$package)
144- packages <- intersect(packages, rownames(available.packages()))
145-
146- valid_dev_dep <- vapply(packages, has_dev_dep, logical(1))
147-
148- # https://github.com/r-lib/remotes/issues/576
149- valid_dev_dep[packages %in% c("igraph", "duckdb", "logging")] <- FALSE
150-
151- deps <- packages[valid_dev_dep]
152- if (any(!valid_dev_dep)) {
153- msg <- paste0(
154- "Could not determine development repository for packages: ",
155- paste(packages[!valid_dev_dep], collapse = ", ")
156- )
157- writeLines(paste0("::warning::", msg))
158- }
159-
160- json <- paste0(
161- '{"package":[',
162- paste0('"', deps, '"', collapse = ","),
163- ']}'
164- )
165- writeLines(json)
166- writeLines(paste0("::set-output name=matrix::", json))
167- shell : Rscript {0}
34+ uses : ./.github/workflows/dep-matrix
16835
16936 check-matrix :
17037 runs-on : ubuntu-18.04
@@ -195,72 +62,24 @@ jobs:
19562 fail-fast : false
19663 matrix : ${{fromJson(needs.matrix.outputs.matrix)}}
19764
198- env :
199- R_REMOTES_NO_ERRORS_FROM_WARNINGS : true
200- RSPM : https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
201- GITHUB_PAT : ${{ secrets.GITHUB_TOKEN }}
202- # prevent rgl issues because no X11 display is available
203- RGL_USE_NULL : true
204- # Begin custom: env vars
205- # End custom: env vars
206-
20765 steps :
208- - name : Check rate limits
209- run : |
210- curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit
211- shell : bash
212-
21366 - uses : actions/checkout@v2
21467
215- # Begin custom: before install
216- # End custom: before install
68+ - uses : ./.github/workflows/custom/before-install
21769
218- - uses : r-lib/actions/setup-r@v1
70+ - uses : ./.github/workflows/install
21971 with :
22072 install-r : false
73+ cache-version : rcc-dev-${{ matrix.package }}-1
74+ needs : check
75+ extra-packages : " any::rcmdcheck any::remotes"
76+ token : ${{ secrets.GITHUB_TOKEN }}
22177
222- - uses : r-lib/actions/setup-pandoc@v1
223-
224- - name : Install remotes
225- run : |
226- if (!requireNamespace("curl", quietly = TRUE)) install.packages("curl")
227- if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")
228- shell : Rscript {0}
229-
230- - name : Prepare cache keys
231- if : runner.os != 'Windows'
232- id : date
233- run : echo "::set-output name=date::$(date -Ihours)"
234-
235- - name : Cache R packages
236- if : runner.os != 'Windows'
237- uses : actions/cache@v2
238- with :
239- path : ${{ env.R_LIBS_USER }}
240- key : ubuntu-20.04-r-dev-release-${{ matrix.package }}-1-${{steps.date.outputs.date}}
241- restore-keys : ubuntu-20.04-r-dev-release-${{ matrix.package }}-1-
242-
243- - name : Install system dependencies
244- if : runner.os == 'Linux'
245- run : |
246- sudo apt-get update -y
247- while read -r cmd
248- do
249- eval sudo $cmd
250- done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "18.04"))')
251-
252- - name : Add fake qpdf and checkbashisms
253- if : runner.os == 'Linux'
254- run : |
255- sudo ln -s $(which true) /usr/local/bin/qpdf
256- sudo ln -s $(which true) /usr/local/bin/checkbashisms
257-
258- - name : Install dependencies
78+ - name : Install dev version of ${{ matrix.package }}
79+ env :
80+ GITHUB_PAT : ${{ secrets.GITHUB_TOKEN }}
25981 run : |
260- remotes::install_deps(dependencies = TRUE)
261- update.packages(.libPaths()[[1]], ask = FALSE)
26282 remotes::install_dev("${{ matrix.package }}", "https://cloud.r-project.org", upgrade = "always")
263- remotes::install_cran("rcmdcheck")
26483 shell : Rscript {0}
26584
26685 - name : Session info
@@ -271,37 +90,8 @@ jobs:
27190 sessioninfo::session_info(pkgs, include_base = TRUE)
27291 shell : Rscript {0}
27392
274- # Begin custom: after install
275- # End custom: after install
93+ - uses : ./.github/workflows/custom/after-install
27694
277- - name : Check
278- env :
279- _R_CHECK_CRAN_INCOMING_ : false
280- _R_CHECK_SYSTEM_CLOCK_ : false
281- _R_CHECK_FUTURE_FILE_TIMESTAMPS_ : false
282- run : |
283- options(crayon.enabled = TRUE)
284- error_on <- "note"
285- # Begin custom: rcmdcheck error_on
286- # End custom: rcmdcheck error_on
287- rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = error_on, check_dir = "check")
288- shell : Rscript {0}
289-
290- - name : Show test output
291- if : always()
292- run : |
293- find check -name '*.Rout*' -exec head -n 1000000 '{}' \; || true
294- shell : bash
295-
296- - name : Upload check results
297- if : failure()
298- uses : actions/upload-artifact@main
95+ - uses : ./.github/workflows/check
29996 with :
300- name : ${{ matrix.package }}-results
301- path : check
302-
303- - name : Check rate limits
304- if : always()
305- run : |
306- curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit
307- shell : bash
97+ results : ${{ matrix.package }}
0 commit comments