Skip to content

Commit

Permalink
Merge branch 'main' into f-250-ellipsis
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Dec 23, 2021
2 parents 4e73530 + 2439a2e commit a391fc9
Show file tree
Hide file tree
Showing 42 changed files with 723 additions and 655 deletions.
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.html
R-version
depends.rds
/pkg.lock
246 changes: 18 additions & 228 deletions .github/workflows/R-CMD-check-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,152 +19,19 @@ jobs:

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
- uses: ./.github/workflows/rate-limit
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: r-lib/actions/setup-r@v2
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}
uses: ./.github/workflows/dep-matrix

check-matrix:
runs-on: ubuntu-18.04
Expand Down Expand Up @@ -195,72 +62,24 @@ jobs:
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
# End custom: before install
- uses: ./.github/workflows/custom/before-install

- uses: r-lib/actions/setup-r@v1
- uses: ./.github/workflows/install
with:
install-r: false
cache-version: rcc-dev-${{ matrix.package }}-1
needs: check
extra-packages: "any::rcmdcheck any::remotes"
token: ${{ secrets.GITHUB_TOKEN }}

- 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
- name: Install dev version of ${{ matrix.package }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
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
Expand All @@ -271,37 +90,8 @@ jobs:
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

# Begin custom: after install
# End custom: after install
- uses: ./.github/workflows/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
# 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
- uses: ./.github/workflows/check
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
results: ${{ matrix.package }}
Loading

0 comments on commit a391fc9

Please sign in to comment.