Skip to content

Commit

Permalink
Add inst and remove crayon and msg functions
Browse files Browse the repository at this point in the history
  • Loading branch information
KevCaz committed Dec 31, 2023
1 parent 1179321 commit 99133d8
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 100 deletions.
85 changes: 25 additions & 60 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
on:
push:
branches:
- main
branches: main
pull_request:
branches:
- main
branches: main

name: R-CMD-check
name: R CMD Check

jobs:
R-CMD-check:
Expand All @@ -18,72 +16,39 @@ jobs:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'devel'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: windows-latest, r: 'devel'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: 'oldrel'}
- {os: ubuntu-22.04, r: 'devel'}
- {os: ubuntu-22.04, r: 'release'}
- {os: ubuntu-22.04, r: 'oldrel'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
OWLBOT_TOKEN: ${{ secrets.OWLBOT_TOKEN }}
_R_CHECK_DONTTEST_EXAMPLES_: false
SPECIESPLUS_TOKEN: ${{ secrets.SPECIESPLUS_TOKEN }}
CRAN: ${{ matrix.config.cran }}

steps:
- uses: actions/checkout@v1

- uses: r-lib/actions/setup-r@master
with:
r-version: ${{ matrix.config.r }}
- uses: actions/checkout@v3

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

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "depends.Rds", version = 2)
shell: Rscript {0}
- uses: r-lib/actions/setup-pandoc@v2

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v1
- uses: r-lib/actions/setup-r@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-
use-public-rspm: true

- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck, any::covr
needs: check

- name: Install dependencies
- uses: r-lib/actions/check-r-package@v2

- name: Test coverage
if: matrix.config.os == 'ubuntu-22.04' && matrix.config.r == 'release'
run: |
library(remotes)
deps <- readRDS("depends.Rds")
deps[["installed"]] <- vapply(deps[["package"]], remotes:::local_sha, character(1))
update(deps)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "warning", check_dir = "check")
covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check

# - name: Test coverage
# if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release'
# run: |
# remotes::install_cran("covr")
# covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")
# shell: Rscript {0}

7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: skeleton
Title: Template
Version: 0.0.0.9000
Date: 2020-11-19
Date: 2023-12-31
Authors@R:
person(given = "Kevin",
family = "Cazelles",
Expand All @@ -16,9 +16,8 @@ Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
Imports:
cli,
crayon
cli
Suggests:
testthat,
knitr
RoxygenNote: 7.1.1
RoxygenNote: 7.2.3
6 changes: 0 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Generated by roxygen2: do not edit by hand

export(foo)
importFrom(cli,style_bold)
importFrom(cli,style_underline)
importFrom(crayon,blue)
importFrom(crayon,green)
importFrom(crayon,red)
importFrom(crayon,yellow)
1 change: 1 addition & 0 deletions R/foo.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
#' foo(2, 3)

foo <- function(x, y = x) {
cli::cli_alert_info("useful message")
x + y + 1
}
29 changes: 0 additions & 29 deletions R/zzz.R

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

This is our R package template repository. Note that this template was designed
to be used with the [`devtools`](https://devtools.r-lib.org/) package (and
[`usethis`](https://github.com/r-lib/usethis)). Therefore, the [R Packages](https://r-pkgs.org) represents a valuable reference to work with this package skeleton.
[`usethis`](https://github.com/r-lib/usethis)). Therefore, the book [R Packages](https://r-pkgs.org) represents a valuable reference to work with this package skeleton.


# Resources
Expand All @@ -13,6 +13,7 @@ to be used with the [`devtools`](https://devtools.r-lib.org/) package (and
- https://kevcaz.github.io/aboutRPackages/#1
- https://ropensci.org/blog/2019/01/14/conduct/


## Code of Conduct

Please note that this project is released with a [Contributor Code of Conduct](https://docs.ropensci.org/rcites/CONDUCT.html).
Expand Down
3 changes: 3 additions & 0 deletions inst/raw-data/mock.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"var1", "var2"
1, 2
3, 4

0 comments on commit 99133d8

Please sign in to comment.