Skip to content

Commit

Permalink
use md in docs; usethis workflow; update GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
achubaty committed Jan 31, 2024
1 parent fa27ed6 commit 64f7237
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 128 deletions.
96 changes: 24 additions & 72 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
# NOTE: This workflow is overkill for most R packages
# check-standard.yaml is likely a better choice
# usethis::use_github_action("check-standard") will install it.
#
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
# 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:
- master
- [main, master, development]
pull_request:
branches:
- master
- [main, master, development]

name: R-CMD-check

Expand All @@ -25,80 +21,36 @@ jobs:
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'devel', http-user-agent: 'release'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: '3.6'}
- {os: ubuntu-16.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest", http-user-agent: "R/4.0.0 (ubuntu-16.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: windows-latest, r: 'oldrel'}
- {os: ubuntu-20.04, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-20.04, r: 'release'}
- {os: ubuntu-20.04, r: 'oldrel'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true

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

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

- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-r@v2
with:
Ncpus: 2
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}

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

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
use-public-rspm: false

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "16.04"), sep = "\n")')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
extra-packages: |
any::rcmdcheck
any::Rcpp
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true
31 changes: 10 additions & 21 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
on:
push:
branches:
- main
- master
- development
pull_request:
branches:
- main
- master
- development

Expand All @@ -20,30 +22,17 @@ jobs:
steps:
- uses: actions/checkout@v2

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

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

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- uses: r-lib/actions/setup-r@v2
with:
Ncpus: 2
use-public-rspm: false

- name: Cache R packages
uses: actions/cache@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install dependencies
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
shell: Rscript {0}
extra-packages: |
any::covr
- name: Test coverage
run: covr::codecov()
Expand Down
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Authors@R: c(
)
URL: https://github.com/achubaty/meow
BugReports: https://github.com/achubaty/meow/issues
Encoding: UTF-8
License: GPL
Depends:
R (>= 3.1.2)
Expand All @@ -20,4 +21,5 @@ Imports:
Suggests:
covr,
testthat
RoxygenNote: 6.0.1
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
14 changes: 14 additions & 0 deletions R/meow-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# meow by Alex M Chubaty and Kiri Whan
# Copyright (C) 2015-2024
#

#' @keywords internal
"_PACKAGE"

## usethis namespace: start
#' @importFrom graphics plot
#' @importFrom jpeg readJPEG
#' @importFrom utils download.file
## usethis namespace: end
NULL
27 changes: 2 additions & 25 deletions R/meow.R
Original file line number Diff line number Diff line change
@@ -1,35 +1,12 @@
#
# meow by Alex M Chubaty and Kiri Whan
# Copyright (C) 2015-2020
#

#' Get random pictures of cats. Meow!
#'
#' Queries \url{https://thecatapi.com} for cute cat photos and displays them in your R session.
#'
#' Bug reports: \url{https://github.com/achubaty/meow/issues}
#'
#' @name meow-package
#' @docType package
#' @author Alex M. Chubaty \email{alex.chubaty@@gmail.com}
#' @author Kiri Whan \email{kiriwhan@@gmail.com}
#' @keywords package
NULL



#' Download and display a random picture of a cat.
#'
#' Downloads and plots a random cat image (jpg) from \url{https://thecatapi.com}.
#' Downloads and plots a random cat image (jpg) from <https://thecatapi.com>.
#'
#' @return Invisibly returns logical, \code{TRUE} indicating success.
#' @return Invisibly returns logical, `TRUE` indicating success.
#' Invoked for its side effect of displaying a cat picture.
#'
#' @author Alex Chubaty and Kiri Whan
#' @export
#' @importFrom graphics plot
#' @importFrom jpeg readJPEG
#' @importFrom utils download.file
#'
#' @examples
#' meow()
Expand Down
24 changes: 17 additions & 7 deletions man/meow-package.Rd

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

4 changes: 2 additions & 2 deletions man/meow.Rd

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

1 change: 1 addition & 0 deletions meow.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace,vignette

0 comments on commit 64f7237

Please sign in to comment.