Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pkgdown. #7

Merged
merged 1 commit into from
Nov 1, 2024
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
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
^LICENSE\.md$
^\.github$
^codecov\.yml$
^_pkgdown\.yml$
^docs$
^pkgdown$
8 changes: 5 additions & 3 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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")'
50 changes: 50 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 13 additions & 7 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,25 @@ on:
issue_comment:
types: [created]

name: Commands
name: pr-commands.yaml

permissions: read-all

jobs:
document:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
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:
Expand All @@ -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

Expand All @@ -76,4 +82,4 @@ jobs:

- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GHA_TOKEN }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
36 changes: 33 additions & 3 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 @@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.httr-oauth
.DS_Store
inst/doc
docs
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 16 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ knitr::opts_chunk$set(
# bespoke <img src="man/figures/logo.png" align="right" height="139" />

<!-- badges: start -->
[![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)
<!-- badges: end -->

Sometimes it makes sense to define a simple baseline model programmatically, using simple rules defined by subject matter experts.
Expand All @@ -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")
```
:::
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@

<!-- badges: start -->

[![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)
<!-- badges: end -->

Sometimes it makes sense to define a simple baseline model
Expand All @@ -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:
<div class="pkgdown-release">

Install the released version of bespoke from
[CRAN](https://cran.r-project.org/):

``` r
install.packages("bespoke")
```

</div>

<div class="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")
```

</div>
5 changes: 5 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
url: https://macmillancontentscience.github.io/bespoke/
template:
bootstrap: 5
development:
mode: auto
1 change: 1 addition & 0 deletions man/bespoke-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
Loading