Fix date #1220
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow calls the GitHub API very frequently. | |
# Can't be run as part of commits | |
on: | |
schedule: | |
- cron: '5 0 * * *' # 05:00 UTC every day only run on main branch | |
push: | |
branches: | |
- "cran-*" | |
tags: | |
- "v*" | |
name: rcc dev | |
jobs: | |
matrix: | |
runs-on: ubuntu-20.04 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
name: Collect deps | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
# prevent rgl issues because no X11 display is available | |
RGL_USE_NULL: true | |
# Begin custom: env vars | |
# End custom: env vars | |
steps: | |
- name: Check rate limits | |
run: | | |
curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit | |
shell: bash | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v1 | |
with: | |
install-r: false | |
- id: set-matrix | |
run: | | |
# Determine package dependencies | |
# From remotes | |
read_dcf <- function(path) { | |
fields <- colnames(read.dcf(path)) | |
as.list(read.dcf(path, keep.white = fields)[1, ]) | |
} | |
re_match <- function(text, pattern, perl = TRUE, ...) { | |
stopifnot(is.character(pattern), length(pattern) == 1, !is.na(pattern)) | |
text <- as.character(text) | |
match <- regexpr(pattern, text, perl = perl, ...) | |
start <- as.vector(match) | |
length <- attr(match, "match.length") | |
end <- start + length - 1L | |
matchstr <- substring(text, start, end) | |
matchstr[ start == -1 ] <- NA_character_ | |
res <- data.frame( | |
stringsAsFactors = FALSE, | |
.text = text, | |
.match = matchstr | |
) | |
if (!is.null(attr(match, "capture.start"))) { | |
gstart <- attr(match, "capture.start") | |
glength <- attr(match, "capture.length") | |
gend <- gstart + glength - 1L | |
groupstr <- substring(text, gstart, gend) | |
groupstr[ gstart == -1 ] <- NA_character_ | |
dim(groupstr) <- dim(gstart) | |
res <- cbind(groupstr, res, stringsAsFactors = FALSE) | |
} | |
names(res) <- c(attr(match, "capture.names"), ".text", ".match") | |
class(res) <- c("tbl_df", "tbl", class(res)) | |
res | |
} | |
dev_split_ref <- function(x) { | |
re_match(x, "^(?<pkg>[^@#]+)(?<ref>[@#].*)?$") | |
} | |
has_dev_dep <- function(package) { | |
cran_url <- "https://cloud.r-project.org" | |
refs <- dev_split_ref(package) | |
url <- file.path(cran_url, "web", "packages", refs[["pkg"]], "DESCRIPTION") | |
f <- tempfile() | |
on.exit(unlink(f)) | |
utils::download.file(url, f) | |
desc <- read_dcf(f) | |
url_fields <- c(desc$URL, desc$BugReports) | |
if (length(url_fields) == 0) { | |
return(FALSE) | |
} | |
pkg_urls <- unlist(strsplit(url_fields, "[[:space:]]*,[[:space:]]*")) | |
# Remove trailing "/issues" from the BugReports URL | |
pkg_urls <- sub("/issues$", "", pkg_urls) | |
valid_domains <- c("github[.]com", "gitlab[.]com", "bitbucket[.]org") | |
parts <- | |
re_match(pkg_urls, | |
sprintf("^https?://(?<domain>%s)/(?<username>%s)/(?<repo>%s)(?:/(?<subdir>%s))?", | |
domain = paste0(valid_domains, collapse = "|"), | |
username = "[^/]+", | |
repo = "[^/@#]+", | |
subdir = "[^/@$ ]+" | |
) | |
)[c("domain", "username", "repo", "subdir")] | |
# Remove cases which don't match and duplicates | |
parts <- unique(stats::na.omit(parts)) | |
nrow(parts) == 1 | |
} | |
if (!requireNamespace("desc", quietly = TRUE)) { | |
install.packages("desc") | |
} | |
deps_df <- desc::desc_get_deps() | |
deps_df <- deps_df[deps_df$type %in% c("Depends", "Imports", "LinkingTo", "Suggests"), ] | |
packages <- sort(deps_df$package) | |
packages <- intersect(packages, rownames(available.packages())) | |
valid_dev_dep <- vapply(packages, has_dev_dep, logical(1)) | |
# https://github.com/r-lib/remotes/issues/576 | |
valid_dev_dep[packages %in% c("igraph", "duckdb", "logging")] <- FALSE | |
deps <- packages[valid_dev_dep] | |
if (any(!valid_dev_dep)) { | |
msg <- paste0( | |
"Could not determine development repository for packages: ", | |
paste(packages[!valid_dev_dep], collapse = ", ") | |
) | |
writeLines(paste0("::warning::", msg)) | |
} | |
json <- paste0( | |
'{"package":[', | |
paste0('"', deps, '"', collapse = ","), | |
']}' | |
) | |
writeLines(json) | |
writeLines(paste0("::set-output name=matrix::", json)) | |
shell: Rscript {0} | |
check-matrix: | |
runs-on: ubuntu-18.04 | |
needs: matrix | |
steps: | |
- name: Install json2yaml | |
run: | | |
sudo npm install -g json2yaml | |
- name: Check matrix definition | |
run: | | |
matrix='${{ needs.matrix.outputs.matrix }}' | |
echo $matrix | |
echo $matrix | jq . | |
echo $matrix | json2yaml | |
R-CMD-check-dev: | |
needs: matrix | |
runs-on: ubuntu-18.04 | |
name: ${{ matrix.package }} | |
# Begin custom: services | |
# End custom: services | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.matrix.outputs.matrix)}} | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
# prevent rgl issues because no X11 display is available | |
RGL_USE_NULL: true | |
# Begin custom: env vars | |
# End custom: env vars | |
steps: | |
- name: Check rate limits | |
run: | | |
curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit | |
shell: bash | |
- uses: actions/checkout@v2 | |
# Begin custom: before install | |
- name: Install libgit2 | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgit2-dev | |
# End custom: before install | |
- uses: r-lib/actions/setup-r@v1 | |
with: | |
install-r: false | |
- uses: r-lib/actions/setup-pandoc@v1 | |
- name: Install remotes | |
run: | | |
if (!requireNamespace("curl", quietly = TRUE)) install.packages("curl") | |
if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes") | |
shell: Rscript {0} | |
- name: Prepare cache keys | |
if: runner.os != 'Windows' | |
id: date | |
run: echo "::set-output name=date::$(date -Ihours)" | |
- name: Cache R packages | |
if: runner.os != 'Windows' | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ubuntu-20.04-r-dev-release-${{ matrix.package }}-1-${{steps.date.outputs.date}} | |
restore-keys: ubuntu-20.04-r-dev-release-${{ matrix.package }}-1- | |
- name: Install system dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update -y | |
while read -r cmd | |
do | |
eval sudo $cmd | |
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "18.04"))') | |
- name: Add fake qpdf and checkbashisms | |
if: runner.os == 'Linux' | |
run: | | |
sudo ln -s $(which true) /usr/local/bin/qpdf | |
sudo ln -s $(which true) /usr/local/bin/checkbashisms | |
- name: Install dependencies | |
run: | | |
remotes::install_deps(dependencies = TRUE) | |
update.packages(.libPaths()[[1]], ask = FALSE) | |
remotes::install_dev("${{ matrix.package }}", "https://cloud.r-project.org", upgrade = "always") | |
remotes::install_cran("rcmdcheck") | |
shell: Rscript {0} | |
- name: Session info | |
run: | | |
options(width = 100) | |
if (!requireNamespace("sessioninfo", quietly = TRUE)) install.packages("sessioninfo") | |
pkgs <- installed.packages()[, "Package"] | |
sessioninfo::session_info(pkgs, include_base = TRUE) | |
shell: Rscript {0} | |
# Begin custom: after install | |
# End custom: after install | |
- name: Check | |
env: | |
_R_CHECK_CRAN_INCOMING_: false | |
_R_CHECK_SYSTEM_CLOCK_: false | |
_R_CHECK_FUTURE_FILE_TIMESTAMPS_: false | |
run: | | |
options(crayon.enabled = TRUE) | |
error_on <- "note" | |
# Begin custom: rcmdcheck error_on | |
error_on <- "warning" | |
# End custom: rcmdcheck error_on | |
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = error_on, check_dir = "check") | |
shell: Rscript {0} | |
- name: Show test output | |
if: always() | |
run: | | |
find check -name '*.Rout*' -exec head -n 1000000 '{}' \; || true | |
shell: bash | |
- name: Upload check results | |
if: failure() | |
uses: actions/upload-artifact@main | |
with: | |
name: ${{ matrix.package }}-results | |
path: check | |
- name: Check rate limits | |
if: always() | |
run: | | |
curl -s --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit | |
shell: bash |