diff --git a/.Rbuildignore b/.Rbuildignore index a4691d7..1d17d7b 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -11,3 +11,6 @@ docs ^config-uat-psw\.yml$ ^\.github$ ^README\.Rmd$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 9a0a295..699a6b0 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -18,8 +18,6 @@ jobs: fail-fast: false matrix: config: - - {os: macos-latest, r: 'release'} - - {os: windows-latest, r: 'release'} - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} - {os: ubuntu-latest, r: 'oldrel-1'} diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..bfc9f4d --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,49 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + release: + types: [published] + workflow_dispatch: + +name: pkgdown.yaml + +permissions: read-all + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.gitignore b/.gitignore index dd7f525..f75f337 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ inst/doc *.env *.swp config-uat-psw.yml +docs diff --git a/DESCRIPTION b/DESCRIPTION index cb94358..9937fdf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,14 +1,14 @@ Type: Package Package: audit.workbench Title: RStudio/Workbench User Acceptance Tests -Version: 0.6.4 +Version: 0.6.5 Authors@R: person("Jumping", "Rivers", , "info@jumpingrivers.com", role = c("aut", "cre")) Description: Testing whether data scientists can do what they expect in - RStudio Workbench. + Posit Workbench. License: file LICENSE Imports: - audit.base (>= 0.6.9), + audit.base (>= 0.6.20), BiocManager, cli, dplyr, @@ -20,7 +20,6 @@ Imports: remotes, rlang, rmarkdown, - rstudioapi, serverHeaders, stringr, tibble, @@ -29,6 +28,8 @@ Imports: yaml Suggests: reticulate, + rvest, + rstudioapi, testthat (>= 3.0.0) Remotes: jumpingrivers/audit.base, @@ -36,4 +37,6 @@ Remotes: Config/testthat/edition: 3 Encoding: UTF-8 LazyData: false -RoxygenNote: 7.2.3 +Language: en-GB +RoxygenNote: 7.3.2 +URL: https://jumpingrivers.github.io/audit.workbench/ diff --git a/NEWS.md b/NEWS.md index fb7052e..cfa32e6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +# audit.workbench 0.6.5 *2025-02-22* +- feat: The {rstudioapi} package is now optional + # audit.workbench 0.6.4 *2023-01-11* - fix: Return `TRUE`, when `testing_core_r_pkgs()` passes diff --git a/R/check_core_r_pkgs.R b/R/check_core_r_pkgs.R index dfb74be..7d7b595 100644 --- a/R/check_core_r_pkgs.R +++ b/R/check_core_r_pkgs.R @@ -24,7 +24,7 @@ check_core_r_pkgs = R6::R6Class( ) testing_core_r_pkgs = function(debug_level) { - core_r_pkgs = rstudioapi::getRStudioPackageDependencies()$name + core_r_pkgs = get_core_r_packages() in_pkgs = utils::installed.packages() missing_r_pkgs = core_r_pkgs[!(core_r_pkgs %in% rownames(in_pkgs))] if (length(missing_r_pkgs) > 0L) { @@ -32,3 +32,22 @@ testing_core_r_pkgs = function(debug_level) { } return(TRUE) } + +get_core_r_packages = function() { + if (requireNamespace("rstudioapi", quietly = TRUE)) { + core = rstudioapi::getRStudioPackageDependencies()$name + } else if (requireNamespace("rstudioapi", quietly = TRUE)) { + html = rvest::read_html("https://docs.posit.co/ide/server-pro/reference/r_package_dependencies.html") #nolint + cells = rvest::html_nodes(html, "td") + values = purrr::map_chr(cells, rvest::html_text2) + all = tibble::tibble( + "name" = values[seq.int(1L, length(values), 3L)], + "version" = values[seq.int(1L, length(values), 3L) + 1], + "features" = values[seq.int(1L, length(values), 3L) + 2] + ) + core = all$name + } else { + stop("Install either rstudioapi or rvest to check core packages ") + } + return(sort(core)) +} diff --git a/R/check_git_cloning.R b/R/check_git_cloning.R index 471b793..f1fedb8 100644 --- a/R/check_git_cloning.R +++ b/R/check_git_cloning.R @@ -7,7 +7,7 @@ check_git_cloning = R6::R6Class( inherit = audit.base::base_check, public = list( #' @description Checking that we can access and clone from github.com - #' @param debug_level See check() for details + #' @param debug_level See `check()` for details check = function(debug_level) { private$checker(git_cloning(debug_level)) return(invisible(NULL)) diff --git a/R/check_package.R b/R/check_package.R index 4c2babf..0f74ccf 100644 --- a/R/check_package.R +++ b/R/check_package.R @@ -33,7 +33,7 @@ check_bioconductor = R6::R6Class( "check_bioconductor", inherit = audit.base::base_check, public = list( - #' @description Checks that bioconductor URLs are accessible + #' @description Checks that Bioconductor URLs are accessible #' @param debug_level See check() for details check = function(debug_level) { private$checker(testing_bioconductor(debug_level)) diff --git a/R/check_posit_version.R b/R/check_posit_version.R index dd0be43..fc3345b 100644 --- a/R/check_posit_version.R +++ b/R/check_posit_version.R @@ -1,5 +1,11 @@ check_posit_version = function() { - posit_version = rstudioapi::versionInfo()$long_version + if (requireNamespace("rstudioapi", quietly = TRUE)) { + posit_version = rstudioapi::versionInfo()$long_version + } else { + cmd = system2("rstudio-server", args = "version", stdout = TRUE) + posit_version = stringr::str_remove(cmd, " .*") + + } posit_version = stringr::str_remove(posit_version, "\\+[0-9]*") audit.base::audit_posit_version(posit_version, type = "workbench") return(posit_version) diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..2227ebf --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,4 @@ +url: https://jumpingrivers.github.io/audit.workbench/ +template: + bootstrap: 5 + diff --git a/audit.workbench.Rproj b/audit.workbench.Rproj index 57bf3f9..bf0de91 100644 --- a/audit.workbench.Rproj +++ b/audit.workbench.Rproj @@ -1,4 +1,5 @@ Version: 1.0 +ProjectId: 40527578-1e74-4287-ac65-4e93cb15d8e4 RestoreWorkspace: Default SaveWorkspace: Default diff --git a/inst/extdata/report/report.qmd b/inst/extdata/report/report.qmd index 706db03..825a393 100644 --- a/inst/extdata/report/report.qmd +++ b/inst/extdata/report/report.qmd @@ -91,7 +91,7 @@ gt::gt(sys_deps) %>% "pkg" = "R Package") %>% gt::cols_align("left") %>% gt::cols_hide("n") %>% - gt::tab_style(style = gt::cell_text(v_align = "top"), + gt::tab_style(style = gt::cell_text(v_align = "top"), locations = gt::cells_body(columns = sys_libs)) ``` @@ -111,12 +111,12 @@ gt::gt(software) %>% gt::cols_align("right") %>% gt::cols_hide(c("software", "upgrade")) %>% - gt::tab_row_group(label = "R", rows = which(.data$software == "r")) %>% - gt::tab_row_group(label = "Python", rows = which(.data$software == "python")) %>% - gt::tab_row_group(label = "Quarto", rows = which(.data$software == "quarto")) %>% + gt::tab_row_group(label = "R", rows = which(.data$software == "r")) %>% + gt::tab_row_group(label = "Python", rows = which(.data$software == "python")) %>% + gt::tab_row_group(label = "Quarto", rows = which(.data$software == "quarto")) %>% gtExtras::gt_highlight_rows(rows = which(.data$upgrade), font_color = "white", - fill = severe) + fill = severe) ``` ## Deployments @@ -138,5 +138,5 @@ gt::gt(deploy) %>% palette = c("grey10", "grey50"), font_weight = c("normal", "normal"), small_cap = FALSE - ) + ) ``` diff --git a/man/check_bioconductor.Rd b/man/check_bioconductor.Rd index 8bd2d64..035d0d2 100644 --- a/man/check_bioconductor.Rd +++ b/man/check_bioconductor.Rd @@ -36,7 +36,7 @@ Check classes \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-check_bioconductor-check}{}}} \subsection{Method \code{check()}}{ -Checks that bioconductor URLs are accessible +Checks that Bioconductor URLs are accessible \subsection{Usage}{ \if{html}{\out{