Skip to content

Commit

Permalink
Merge branch 'main' into md-in-family
Browse files Browse the repository at this point in the history
  • Loading branch information
salim-b committed Jul 2, 2024
2 parents afe1dbb + 9855db3 commit 69ea710
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 31 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:

name: R-CMD-check

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
Expand All @@ -25,24 +27,22 @@ jobs:
- {os: macos-latest, r: 'release'}

- {os: windows-latest, r: 'release'}
# Use 3.6 to trigger usage of RTools35
- {os: windows-latest, r: '3.6'}
# use 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: '4.1'}

- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'oldrel-4'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'oldrel-4'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -60,3 +60,4 @@ jobs:
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
6 changes: 4 additions & 2 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:

name: pkgdown

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
Expand All @@ -22,7 +24,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -41,7 +43,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:

name: Commands

permissions: read-all

jobs:
document:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
Expand All @@ -14,7 +16,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down Expand Up @@ -51,7 +53,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down
21 changes: 16 additions & 5 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,54 @@ on:

name: test-coverage

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
covr::codecov(
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: roxygen2
Title: In-Line Documentation for R
Version: 7.3.1.9000
Version: 7.3.2.9000
Authors@R: c(
person("Hadley", "Wickham", , "[email protected]", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0003-4757-117X")),
Expand Down Expand Up @@ -53,4 +53,4 @@ Config/testthat/parallel: TRUE
Encoding: UTF-8
Language: en-GB
Roxygen: list(markdown = TRUE, load = "installed")
RoxygenNote: 7.3.0.9000
RoxygenNote: 7.3.1.9000
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* Custom [`@family`
titles](https://roxygen2.r-lib.org/articles/index-crossref.html) now support
Markdown syntax (#1608, @salim-b).
# roxygen2 7.3.2

* `@includeRmd` now additionally sets `options(cli.hyperlink = FALSE)` to make
code run in included `.Rmd`s even more consistent across sessions (#1620).

# roxygen2 7.3.1

Expand Down
2 changes: 1 addition & 1 deletion R/block.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' A `roxy_block` represents a single roxygen2 block.
#'
#' The `block_*` functions provide a few helpers for common operations:
#' * `block_has_tag(blocks, tags)`: does `block` contain any of these `tags`?
#' * `block_has_tags(blocks, tags)`: does `block` contain any of these `tags`?
#' * `block_get_tags(block, tags)`: get all instances of `tags`
#' * `block_get_tag(block, tag)`: get single tag. Returns `NULL` if 0,
#' throws warning if more than 1.
Expand Down
1 change: 1 addition & 0 deletions R/rd-eval.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ local_reproducible_output <- function(.envir = parent.frame()) {
crayon.enabled = FALSE,
cli.unicode = FALSE,
cli.dynamic = FALSE,
cli.hyperlink = FALSE,
rlang_interactive = FALSE,
width = 80,
.local_envir = .envir
Expand Down
6 changes: 3 additions & 3 deletions R/rd.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ roclet_output.roclet_rd <- function(x, results, base_path, ..., is_first = FALSE

names <- unname(map_chr(results, ~ .$get_name()[[1]]))
if (length(names) > 0) {
hrefs <- paste0("ide:run:pkgload::dev_help('", names, "')")
commands <- paste0("pkgload::dev_help('", names, "')")
} else {
hrefs <- character()
commands <- character()
}

# Always check for roxygen2 header before overwriting NAMESPACE (#436),
# even when running for the first time
mapply(write_if_different, paths, contents, href = hrefs)
mapply(write_if_different, paths, contents, command = commands)

if (!is_first) {
# Automatically delete any files in man directory that were generated
Expand Down
8 changes: 5 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ nice_name <- function(x) {
x
}

write_if_different <- function(path, contents, href = NULL, check = TRUE) {
write_if_different <- function(path, contents, command = NULL, check = TRUE) {
if (!file.exists(dirname(path))) {
dir.create(dirname(path), showWarnings = FALSE)
}
Expand All @@ -87,8 +87,10 @@ write_if_different <- function(path, contents, href = NULL, check = TRUE) {
))
FALSE
} else {
if (!is.null(href)) {
name <- cli::style_hyperlink(name, href)
if (!is.null(command)) {
scheme <- "x-r-run"
url <- paste0(scheme, ":", command)
name <- cli::style_hyperlink(name, url)
}
cli::cli_inform("Writing {.path {name}}")

Expand Down
5 changes: 4 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## R CMD check results
There were no ERRORs, WARNINGs or NOTEs.

There was one note: Found non-API calls to R: 'SETLENGTH', 'SET_GROWABLE_BIT', 'SET_TRUELENGTH'.

These come from the upstream cpp11, and we're working to fix them there.

## revdepcheck results

Expand Down
2 changes: 1 addition & 1 deletion man/roxy_block.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tests/testthat/_snaps/rd-include-rmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

Code
. <- roc_proc_text(rd_roclet(), text)
Output
Message
Quitting from lines 2-3 [unnamed-chunk-2] (<temp-path.Rmd>)
Quitting from lines 2-3 [unnamed-chunk-1] (<temp-path.Rmd>)
Quitting from lines 2-2 [unnamed-chunk-1] (<another-temp-path.Rmd>)
x <text>:3: @includeRmd failed to evaluate '<temp-path.Rmd>'.
Caused by error:
! Error
Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/_snaps/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,12 @@
Output
[1] FALSE

# write_if_different produces correct command hyperlink

Code
write_if_different(path, "a <- 2", command = "rlang::inform('hi')")
Message
Writing ']8;;x-r-run:rlang::inform('hi')test.R]8;;'
Output
[1] TRUE

6 changes: 5 additions & 1 deletion tests/testthat/test-rd-include-rmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,11 @@ test_that("useful warnings", {
)
expect_snapshot(
. <- roc_proc_text(rd_roclet(), text),
transform = function(x) gsub(path, "<temp-path.Rmd>", x, fixed =TRUE)
transform = function(x) {
x <- gsub(path, "<temp-path.Rmd>", x, fixed = TRUE)
x <- gsub("file.*\\.Rmd", "<another-temp-path.Rmd>", x)
x
}
)
})

Expand Down
10 changes: 10 additions & 0 deletions tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,13 @@ test_that("write_if_different and end of line", {
expect_message(write_if_different(tmp, cnt_mix, check = FALSE), "Writing ")
expect_identical(readBin(tmp, "raw", 100), readBin(tmp_win, "raw", 100))
})

test_that("write_if_different produces correct command hyperlink", {
testthat::local_reproducible_output(hyperlinks = TRUE)

dir <- withr::local_tempdir()
path <- file.path(dir, "test.R")

write_lines(made_by("#"), path)
expect_snapshot(write_if_different(path, "a <- 2", command = "rlang::inform('hi')"))
})

0 comments on commit 69ea710

Please sign in to comment.