diff --git a/.Rbuildignore b/.Rbuildignore index ea6da77..26c0d21 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -5,3 +5,6 @@ ^LICENSE\.md$ ^\.github$ ^codecov\.yml$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 8392aef..821a3d9 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -5,9 +5,10 @@ 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: @@ -26,7 +27,7 @@ jobs: - {os: ubuntu-latest, r: 'oldrel-1'} env: - GITHUB_PAT: ${{ secrets.GHA_TOKEN }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes steps: @@ -48,3 +49,4 @@ jobs: - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..4bbce75 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,50 @@ +# 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: + branches: [main, master] + 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/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml index 5260dea..2edd93f 100644 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -4,7 +4,9 @@ on: issue_comment: types: [created] -name: Commands +name: pr-commands.yaml + +permissions: read-all jobs: document: @@ -12,13 +14,15 @@ jobs: name: document runs-on: ubuntu-latest env: - GITHUB_PAT: ${{ secrets.GHA_TOKEN }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write steps: - uses: actions/checkout@v4 - uses: r-lib/actions/pr-fetch@v2 with: - repo-token: ${{ secrets.GHA_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: r-lib/actions/setup-r@v2 with: @@ -42,20 +46,22 @@ jobs: - uses: r-lib/actions/pr-push@v2 with: - repo-token: ${{ secrets.GHA_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} style: if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }} name: style runs-on: ubuntu-latest env: - GITHUB_PAT: ${{ secrets.GHA_TOKEN }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write steps: - uses: actions/checkout@v4 - uses: r-lib/actions/pr-fetch@v2 with: - repo-token: ${{ secrets.GHA_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: r-lib/actions/setup-r@v2 @@ -76,4 +82,4 @@ jobs: - uses: r-lib/actions/pr-push@v2 with: - repo-token: ${{ secrets.GHA_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index d9d5c3d..9882260 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -6,7 +6,9 @@ on: pull_request: branches: [main, master] -name: test-coverage +name: test-coverage.yaml + +permissions: read-all jobs: test-coverage: @@ -23,9 +25,37 @@ jobs: - 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(quiet = FALSE) + run: | + 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 + shell: bash + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v4 + with: + name: coverage-test-failures + path: ${{ runner.temp }}/package diff --git a/.gitignore b/.gitignore index f47ffab..8ff9bf4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .httr-oauth .DS_Store inst/doc +docs diff --git a/DESCRIPTION b/DESCRIPTION index b5c356b..5a0e0c7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,7 +12,8 @@ Description: Create hand-crafted baseline models for use in the tidymodels framework. These "models"" use user-supplied functions to make predictions, but can be used (for example) in a tidymodels stack. License: Apache License (>= 2) -URL: https://github.com/macmillancontentscience/bespoke +URL: https://macmillancontentscience.github.io/bespoke/, + https://github.com/macmillancontentscience/bespoke BugReports: https://github.com/macmillancontentscience/bespoke/issues Imports: hardhat, diff --git a/README.Rmd b/README.Rmd index d2f9eed..82e2e98 100644 --- a/README.Rmd +++ b/README.Rmd @@ -18,8 +18,10 @@ knitr::opts_chunk$set( # bespoke -[![R-CMD-check](https://github.com/macmillancontentscience/bespoke/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/macmillancontentscience/bespoke/actions/workflows/R-CMD-check.yaml) +[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) +[![CRAN status](https://www.r-pkg.org/badges/version/bespoke)](https://CRAN.R-project.org/package=bespoke) [![Codecov test coverage](https://codecov.io/gh/macmillancontentscience/bespoke/branch/main/graph/badge.svg)](https://app.codecov.io/gh/macmillancontentscience/bespoke?branch=main) +[![R-CMD-check](https://github.com/macmillancontentscience/bespoke/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/macmillancontentscience/bespoke/actions/workflows/R-CMD-check.yaml) Sometimes it makes sense to define a simple baseline model programmatically, using simple rules defined by subject matter experts. @@ -28,9 +30,19 @@ However, it can be difficult to compare such models to "real" models developed i ## Installation -You can install the development version of bespoke from [GitHub](https://github.com/) with: +::: {.pkgdown-release} +Install the released version of bespoke from [CRAN](https://cran.r-project.org/): + +``` r +install.packages("bespoke") +``` +::: + +::: {.pkgdown-devel} +Install the development version of bespoke from [GitHub](https://github.com/): ``` r -# install.packages("remotes") -remotes::install_github("macmillancontentscience/bespoke") +# install.packages("pak") +pak::pak("macmillancontentscience/bespoke") ``` +::: diff --git a/README.md b/README.md index db302cc..96a2e07 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,13 @@ -[![R-CMD-check](https://github.com/macmillancontentscience/bespoke/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/macmillancontentscience/bespoke/actions/workflows/R-CMD-check.yaml) +[![Lifecycle: +experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) +[![CRAN +status](https://www.r-pkg.org/badges/version/bespoke)](https://CRAN.R-project.org/package=bespoke) [![Codecov test coverage](https://codecov.io/gh/macmillancontentscience/bespoke/branch/main/graph/badge.svg)](https://app.codecov.io/gh/macmillancontentscience/bespoke?branch=main) +[![R-CMD-check](https://github.com/macmillancontentscience/bespoke/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/macmillancontentscience/bespoke/actions/workflows/R-CMD-check.yaml) Sometimes it makes sense to define a simple baseline model @@ -21,10 +25,25 @@ that fits within the {tidymodels} framework. ## Installation -You can install the development version of bespoke from -[GitHub](https://github.com/) with: +
+ +Install the released version of bespoke from +[CRAN](https://cran.r-project.org/): + +``` r +install.packages("bespoke") +``` + +
+ +
+ +Install the development version of bespoke from +[GitHub](https://github.com/): ``` r -# install.packages("remotes") -remotes::install_github("macmillancontentscience/bespoke") +# install.packages("pak") +pak::pak("macmillancontentscience/bespoke") ``` + +
diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..9d0b091 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,5 @@ +url: https://macmillancontentscience.github.io/bespoke/ +template: + bootstrap: 5 +development: + mode: auto diff --git a/man/bespoke-package.Rd b/man/bespoke-package.Rd index 15222e5..7aab5bc 100644 --- a/man/bespoke-package.Rd +++ b/man/bespoke-package.Rd @@ -12,6 +12,7 @@ Create hand-crafted baseline models for use in the tidymodels framework. These " \seealso{ Useful links: \itemize{ + \item \url{https://macmillancontentscience.github.io/bespoke/} \item \url{https://github.com/macmillancontentscience/bespoke} \item Report bugs at \url{https://github.com/macmillancontentscience/bespoke/issues} } diff --git a/vignettes/basics.Rmd b/vignettes/bespoke.Rmd similarity index 100% rename from vignettes/basics.Rmd rename to vignettes/bespoke.Rmd