Skip to content

Commit c1c1bab

Browse files
authored
updates for no-suggests checks (#49)
* no suggests updates * skips
1 parent 9714dcc commit c1c1bab

File tree

9 files changed

+114
-31
lines changed

9 files changed

+114
-31
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
#
4+
# NOTE: This workflow only directly installs "hard" dependencies, i.e. Depends,
5+
# Imports, and LinkingTo dependencies. Notably, Suggests dependencies are never
6+
# installed, with the exception of testthat, knitr, and rmarkdown. The cache is
7+
# never used to avoid accidentally restoring a cache containing a suggested
8+
# dependency.
9+
on:
10+
push:
11+
branches: [main, master]
12+
pull_request:
13+
14+
name: R-CMD-check-hard.yaml
15+
16+
permissions: read-all
17+
18+
jobs:
19+
check-no-suggests:
20+
runs-on: ${{ matrix.config.os }}
21+
22+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
config:
28+
- {os: ubuntu-latest, r: 'release'}
29+
30+
env:
31+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
32+
R_KEEP_PKG_SOURCE: yes
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- uses: r-lib/actions/setup-pandoc@v2
38+
39+
- uses: r-lib/actions/setup-r@v2
40+
with:
41+
r-version: ${{ matrix.config.r }}
42+
http-user-agent: ${{ matrix.config.http-user-agent }}
43+
use-public-rspm: true
44+
45+
- uses: r-lib/actions/setup-r-dependencies@v2
46+
with:
47+
dependencies: '"hard"'
48+
cache: false
49+
extra-packages: |
50+
any::rcmdcheck
51+
any::testthat
52+
any::knitr
53+
any::rmarkdown
54+
needs: check
55+
56+
- uses: r-lib/actions/check-r-package@v2
57+
with:
58+
upload-snapshots: true
59+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

R/use.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@
2929
#' The syntax is opinionated and should not be considered the exact answer for
3030
#' every data analysis. It has reasonable defaults.
3131
#' @examples
32-
#' library(modeldata)
33-
#' data(ad_data)
34-
#' use_glmnet(Class ~ ., data = ad_data)
32+
#' if (rlang::is_installed("modeldata")) {
33+
#' library(modeldata)
34+
#' data(ad_data)
35+
#' use_glmnet(Class ~ ., data = ad_data)
3536
#'
36-
#' data(Sacramento)
37-
#' use_glmnet(price ~ ., data = Sacramento, verbose = TRUE, prefix = "sac_homes")
37+
#' data(Sacramento)
38+
#' use_glmnet(price ~ ., data = Sacramento, verbose = TRUE, prefix = "sac_homes")
39+
#' }
3840
#' @export
3941
#' @rdname templates
4042
use_glmnet <- function(formula, data, prefix = "glmnet", verbose = FALSE,

README.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ knitr::opts_chunk$set(
1818

1919
<!-- badges: start -->
2020
[![R-CMD-check](https://github.com/tidymodels/usemodels/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tidymodels/usemodels/actions/workflows/R-CMD-check.yaml)
21-
[![Coverage status](https://codecov.io/gh/tidymodels/usemodels/branch/main/graph/badge.svg)](https://codecov.io/github/tidymodels/usemodels?branch=main)
21+
[![Coverage status](https://codecov.io/gh/tidymodels/usemodels/branch/main/graph/badge.svg)](https://app.codecov.io/github/tidymodels/usemodels?branch=main)
2222
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)
2323
<!-- badges: end -->
2424

@@ -59,7 +59,7 @@ devtools::install_github("tidymodels/usemodels")
5959

6060
This project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
6161

62-
- For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on RStudio Community](https://community.rstudio.com/new-topic?category_id=15&tags=tidymodels,question).
62+
- For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on Posit Community](https://forum.posit.co/new-topic?category_id=15&tags=tidymodels,question).
6363

6464
- If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/usemodels/issues).
6565

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[![R-CMD-check](https://github.com/tidymodels/usemodels/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tidymodels/usemodels/actions/workflows/R-CMD-check.yaml)
99
[![Coverage
10-
status](https://codecov.io/gh/tidymodels/usemodels/branch/main/graph/badge.svg)](https://codecov.io/github/tidymodels/usemodels?branch=main)
10+
status](https://codecov.io/gh/tidymodels/usemodels/branch/main/graph/badge.svg)](https://app.codecov.io/github/tidymodels/usemodels?branch=main)
1111
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)
1212
<!-- badges: end -->
1313

@@ -86,7 +86,7 @@ By contributing to this project, you agree to abide by its terms.
8686

8787
- For questions and discussions about tidymodels packages, modeling, and
8888
machine learning, please [post on RStudio
89-
Community](https://community.rstudio.com/new-topic?category_id=15&tags=tidymodels,question).
89+
Community](https://forum.posit.co/new-topic?category_id=15&tags=tidymodels,question).
9090

9191
- If you think you have encountered a bug, please [submit an
9292
issue](https://github.com/tidymodels/usemodels/issues).

inst/WORDLIST

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
Lifecycle
2-
tidymodels
1+
CMD
32
ORCID
3+
PBC
4+
RStudio
5+
Tidymodels
46
funder
7+
lifecycle
8+
palmerpenguins
9+
reprex
10+
tidymodels

man/templates.Rd

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-basics.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
library(modeldata)
2-
data("penguins")
1+
32

43
test_that("wrong model type", {
4+
skip_if_not_installed("modeldata")
5+
library(modeldata)
6+
data("penguins")
7+
58
expect_snapshot(use_cubist(island ~ ., data = penguins), error = TRUE)
69
expect_snapshot(use_C5.0(bill_depth_mm ~ ., data = penguins), error = TRUE)
710
})

tests/testthat/test-clipboard.R

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
library(modeldata)
2-
data("penguins")
3-
4-
penguins$island <- as.character(penguins$island)
5-
6-
# ------------------------------------------------------------------------------
71

82
# Code to loop over all tests and configurations
93

@@ -45,7 +39,13 @@ no_dummy_clip_template <- function(model, prefix, verbose, tune) {
4539
}
4640

4741
verify_models <- function(model, prefix, tune, verbose) {
42+
skip_if_not_installed("modeldata")
4843
# These are automatically skipped on CRAN
44+
library(modeldata)
45+
data("penguins")
46+
47+
penguins$island <- as.character(penguins$island)
48+
4949
if (model != "C5.0") {
5050
expect_snapshot(dummy_clip_template(model, prefix, verbose, tune))
5151
}
@@ -56,6 +56,12 @@ verify_models <- function(model, prefix, tune, verbose) {
5656

5757

5858
test_that("all model templates with clipboard", {
59+
skip_if_not_installed("modeldata")
60+
library(modeldata)
61+
data("penguins")
62+
63+
penguins$island <- as.character(penguins$island)
64+
5965
skip_on_cran()
6066
skip_on_os("linux")
6167
skip_on_os("windows")

tests/testthat/test-templates.R

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
library(modeldata)
2-
data("penguins")
3-
4-
penguins$island <- as.character(penguins$island)
5-
6-
# ------------------------------------------------------------------------------
7-
81
# Code to loop over all tests and configurations
92

103
dummy_template <- function(model, prefix, verbose, tune) {
@@ -38,6 +31,12 @@ no_dummy_template <- function(model, prefix, verbose, tune) {
3831
}
3932

4033
verify_models <- function(model, prefix, tune, verbose) {
34+
skip_if_not_installed("modeldata")
35+
library(modeldata)
36+
data("penguins")
37+
38+
penguins$island <- as.character(penguins$island)
39+
4140
# These are automatically skipped on CRAN
4241
if (model != "C5.0") {
4342
expect_snapshot(dummy_template(model, prefix, verbose, tune))
@@ -49,6 +48,12 @@ verify_models <- function(model, prefix, tune, verbose) {
4948

5049

5150
test_that("all model templates", {
51+
skip_if_not_installed("modeldata")
52+
library(modeldata)
53+
data("penguins")
54+
55+
penguins$island <- as.character(penguins$island)
56+
5257
models <- c("bag_tree_rpart", "C5.0", "cubist", "dbarts", "earth", "glmnet",
5358
"kernlab_svm_poly", "kernlab_svm_rbf", "kknn", "mgcv", "mixOmics",
5459
"nnet", "ranger", "rpart", "xgboost", "xrf")

0 commit comments

Comments
 (0)