Skip to content

Commit

Permalink
Release prep
Browse files Browse the repository at this point in the history
* Fix typo
* No suggests tests
* Add rhub2
  • Loading branch information
hadley authored Jun 7, 2024
1 parent 9819a74 commit 2ffede2
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 3 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
2 changes: 1 addition & 1 deletion R/downlit-html.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ downlit_html_node <- function(x, classes = classes_pandoc()) {
xpath <- c(
# Usual block generated by pandoc (after syntax highlighting)
".//pre[contains(@class, 'sourceCode r')]",
# Special case that allows us to override usually rules if needed
# Special case that allows us to override usual rules if needed
".//div[contains(@class, 'downlit')]//pre"
)
xpath_block <- paste(xpath, collapse = "|")
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-article-index.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ test_that("can capture index from in-development package", {
})

test_that("can capture index of installed package (no vignettes)", {
skip_if_not_installed("MASS")
# Ensure we skip this test if MASS ever gets vignettes
skip_if_not(nrow(vignette(package = "MASS")$results) == 0)
expect_equal(
Expand All @@ -37,5 +38,3 @@ test_that("can capture index of installed package (vignettes + pkgdown)", {
})

# find_article ------------------------------------------------------------


3 changes: 3 additions & 0 deletions tests/testthat/test-downlit-html.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test_that("can highlight html file", {
skip_if_not_installed("xml2")
# verify_output() seems to be generating the wrong line endings
skip_on_os("windows")

Expand All @@ -9,6 +10,7 @@ test_that("can highlight html file", {
})

test_that("highlight all pre inside div.downlit", {
skip_if_not_installed("xml2")
html <- xml2::read_xml("
<body>
<div class = 'downlit'>
Expand All @@ -23,6 +25,7 @@ test_that("highlight all pre inside div.downlit", {
})

test_that("special package string gets linked", {
skip_if_not_installed("xml2")
html <- xml2::read_xml("<p>before <code>{downlit}</code> after</p>")
downlit_html_node(html)
expect_snapshot_output(show_xml(html))
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-downlit-md.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# rmarkdown::find_pandoc(cache = FALSE)

test_that("common across multiple versions", {
skip_if_not_installed("rmarkdown")
skip_if_not(rmarkdown::pandoc_version() > "2.0.0")

verify_output(test_path("test-downlit-md.txt"), {
Expand All @@ -26,6 +27,7 @@ test_that("common across multiple versions", {
})

test_that("pandoc AST v1.20", {
skip_if_not_installed("rmarkdown")
skip_if_not(rmarkdown::pandoc_version() > "2.0.0")
skip_if_not(rmarkdown::pandoc_version() < "2.10")

Expand All @@ -37,6 +39,7 @@ test_that("pandoc AST v1.20", {
})

test_that("pandoc AST v1.21", {
skip_if_not_installed("rmarkdown")
skip_if_not(rmarkdown::pandoc_version() >= "2.10")
skip_if_not(rmarkdown::pandoc_version() < "2.11")

Expand All @@ -49,6 +52,7 @@ test_that("pandoc AST v1.21", {

test_that("Special package string gets linked", {
# needed for eof setting on windows
skip_if_not_installed("rmarkdown")
skip_if_not(rmarkdown::pandoc_version() > "2.0.0")

expect_equal(
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-evaluate.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ test_that("ansi escapes are translated to html", {
# html --------------------------------------------------------------------

test_that("can include literal HTML", {
skip_if_not_installed("htmltools")
output <- evaluate::new_output_handler(value = identity)
env <- env(foo = function() htmltools::div("foo"))

Expand All @@ -85,6 +86,7 @@ test_that("can include literal HTML", {
})

test_that("captures dependencies", {
skip_if_not_installed("htmltools")
output <- evaluate::new_output_handler(value = identity)

dummy_dep <- htmltools::htmlDependency("dummy", "1.0.0", "dummy.js")
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-link.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ test_that("can link to remote pkgdown sites", {
})

test_that("or local sites, if registered", {
skip_if_not_installed("MASS")
local_options("downlit.local_packages" = c("MASS" = "MASS"))
expect_equal(href_expr_(MASS::abbey), "MASS/reference/abbey.html")
})
Expand Down

0 comments on commit 2ffede2

Please sign in to comment.