Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ on:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:

name: R-CMD-check
name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
Expand All @@ -25,21 +28,25 @@ jobs:
- {os: macos-latest, r: 'release'}

- {os: windows-latest, r: 'release'}
# use 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: '4.1'}
# use 4.0 or 4.1 to check with rtools40's older compiler
- {os: windows-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: '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
CXX14: g++
CXX14STD: -std=c++1y
CXX14FLAGS: -Wall -g -02

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

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

Expand All @@ -57,3 +64,8 @@ jobs:
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
10 changes: 7 additions & 3 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ on:
types: [published]
workflow_dispatch:

name: pkgdown
name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
Expand All @@ -19,8 +21,10 @@ jobs:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand All @@ -39,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
12 changes: 9 additions & 3 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ on:
issue_comment:
types: [created]

name: Commands
name: pr-commands.yaml

permissions: read-all

jobs:
document:
Expand All @@ -13,8 +15,10 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down Expand Up @@ -50,8 +54,10 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
pull_request:
branches: [main, master]

name: test-coverage
name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
Expand All @@ -15,36 +17,45 @@ jobs:
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(Sys.getenv("RUNNER_TEMP"), "package")
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
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ Imports:
generics (>= 0.1.2),
glue (>= 1.6.2),
hardhat (>= 1.0.0),
modelenv (>= 0.1.0),
modelenv (>= 0.2.0.9000),
parsnip (>= 1.0.2),
prettyunits (>= 1.1.0),
Rfast (>= 2.0.6),
Rfast (>= 2.0.6),
rlang (>= 1.0.6),
rsample (>= 1.0.0),
stats,
Expand All @@ -49,6 +49,8 @@ Suggests:
rmarkdown,
testthat (>= 3.0.0),
workflows (>= 1.1.2)
Remotes:
tidymodels/modelenv
Config/Needs/website: pkgdown, tidymodels, tidyverse, palmerpenguins,
patchwork, ggforce, tidyverse/tidytemplate
Config/testthat/edition: 3
Expand Down
7 changes: 6 additions & 1 deletion R/cluster_spec.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
#' @export
#' @keywords internal
new_cluster_spec <- function(cls, args, eng_args, mode, method, engine) {
modelenv::check_spec_mode_engine_val(model = cls, mode = mode, eng = engine)
modelenv::check_spec_mode_engine_val(
model = cls,
mode = mode,
eng = engine,
call = rlang::caller_env()
)

out <- list(
args = args, eng_args = eng_args,
Expand Down
15 changes: 8 additions & 7 deletions tests/testthat/_snaps/arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,30 @@
k_means() %>% set_mode()
Condition
Error in `modelenv::stop_incompatible_mode()`:
! Available modes for model type k_means are: 'unknown', 'partition'
x Available modes for model type k_means are:
* "unknown" and "partition".

---

Code
k_means() %>% set_mode(2)
Condition
Error in `modelenv::check_spec_mode_engine_val()`:
! '2' is not a known mode for model `k_means()`.
Error in `set_mode()`:
! 2 is not a known mode for model `k_means()`.

---

Code
k_means() %>% set_mode("haberdashery")
Condition
Error in `modelenv::check_spec_mode_engine_val()`:
! 'haberdashery' is not a known mode for model `k_means()`.
Error in `set_mode()`:
! "haberdashery" is not a known mode for model `k_means()`.

# can't set a mode that isn't allowed by the model spec

Code
set_mode(k_means(), "classification")
Condition
Error in `modelenv::check_spec_mode_engine_val()`:
! 'classification' is not a known mode for model `k_means()`.
Error in `set_mode()`:
! "classification" is not a known mode for model `k_means()`.

4 changes: 2 additions & 2 deletions tests/testthat/_snaps/hier_clust.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Code
hier_clust(mode = "bogus")
Condition
Error in `modelenv::check_spec_mode_engine_val()`:
! 'bogus' is not a known mode for model `hier_clust()`.
Error in `hier_clust()`:
! "bogus" is not a known mode for model `hier_clust()`.

---

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/k_means.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Code
k_means(mode = "bogus")
Condition
Error in `modelenv::check_spec_mode_engine_val()`:
! 'bogus' is not a known mode for model `k_means()`.
Error in `k_means()`:
! "bogus" is not a known mode for model `k_means()`.

---

Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/_snaps/tune_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@
Condition
Warning:
The `...` are not used in this function but one or more objects were passed: 'something'
Warning:
`grid_latin_hypercube()` was deprecated in dials 1.3.0.
i Please use `grid_space_filling()` instead.
Output
# Tuning results
# 2-fold cross-validation
Expand Down
Loading