Skip to content

Commit

Permalink
Implement index (#96)
Browse files Browse the repository at this point in the history
* Refactor encoding tests to catch known warning.

* Reorg description for readability

Used usethis::use_tidy_description() for standardization. Also updated R4DS to DSLC, added the pkgdown site in the URL field, and added a ".9000" while we work on this version (which will probably be at least 1.1).

* Switch most examples to examplesIf

Also cleaned up some formatting, and added @export directives for S3 methods. This doesn't REALLY export them, it just registers them for dispatch.

Closes #94.

* Make R CMD check happy.

* Style for consistency.

* More coverage.

Add explicit # nocov to things we won't check, try to cover as much as we can. Also refactored and repaired some tests while I was at it.

The biggest change might be that I renamed the test files to match their associated R files. This makes it much easier to run tests and coverage for that single file. With proper mocking, the order of tests shouldn't matter.

I also updated to testtthat 3e for snapshots. At the same time, I change the capture.output tests to snapshots.

* Update GHA.

Other than general updates, the main thing I did was remove the R 3.6 thing specifically since it's way back at the point.

* More test coverage.

* 100% coverage!
  • Loading branch information
jonthegeek authored Aug 21, 2024
1 parent b2d129a commit 73e15da
Show file tree
Hide file tree
Showing 67 changed files with 7,714 additions and 1,594 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# 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
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
on:
push:
branches: [main, master]
Expand All @@ -12,6 +8,8 @@ on:

name: R-CMD-check

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
Expand All @@ -23,13 +21,9 @@ jobs:
matrix:
config:
- {os: macos-latest, r: 'release'}

- {os: windows-latest, r: 'release'}
# Use 3.6 to trigger usage of RTools35
- {os: windows-latest, r: '3.6'}
# use 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: '4.1'}

- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
Expand All @@ -42,7 +36,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

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

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

Expand All @@ -60,3 +54,4 @@ jobs:
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
4 changes: 3 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:

name: pkgdown

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
Expand All @@ -22,7 +24,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:

name: Commands

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') }}
Expand All @@ -14,7 +16,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down Expand Up @@ -51,7 +53,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down
21 changes: 16 additions & 5 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,54 @@ on:

name: test-coverage

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
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(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
88 changes: 35 additions & 53 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,62 +1,44 @@
Package: tidytuesdayR
Type: Package
Package: tidytuesdayR
Title: Access the Weekly 'TidyTuesday' Project Dataset
Version: 1.0.3
Authors@R:
c(
person(
given = "Ellis",
family = "Hughes",
email = "[email protected]",
role = c("aut", "cre")
),
person(
given = "Jon",
family = "Harmon",
email = "[email protected]",
role = "ctb"
),
person(
given = "Thomas",
family = "Mock",
email = "[email protected]",
role = "ctb"
),
person(
given = "R4DS Online Learning Community",
email = "[email protected]",
role = "dtc"
)
)
Description:
'TidyTuesday' is a project by the 'R4DS Online Learning Community' in which they
post a weekly dataset onto post a weekly dataset in a public data repository
(<https://github.com/rfordatascience/tidytuesday>) for people to
analyze and visualize. This package provides the tools to easily download this data and the
description of the source.
Version: 1.0.3.9000
Authors@R: c(
person("Ellis", "Hughes", , "[email protected]", role = c("aut", "cre")),
person("Jon", "Harmon", , "[email protected]", role = "ctb"),
person("Thomas", "Mock", , "[email protected]", role = "ctb"),
person("Data Science Learning Community", , , "[email protected]", role = "dtc")
)
Description: 'TidyTuesday' is a project by the 'Data Science Learning
Community' in which they post a weekly dataset in a public data
repository (<https://github.com/rfordatascience/tidytuesday>) for
people to analyze and visualize. This package provides the tools to
easily download this data and the description of the source.
License: MIT + file LICENSE
URL: https://github.com/thebioengineer/tidytuesdayR
URL: https://thebioengineer.github.io/tidytuesdayR/,
https://github.com/thebioengineer/tidytuesdayR
BugReports: https://github.com/thebioengineer/tidytuesdayR/issues
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.1
Depends: R (>= 3.4.0)
Suggests:
testthat (>= 2.1.0),
covr,
pkgdown,
tibble,
withr
Depends:
R (>= 3.4.0)
Imports:
readxl (>= 1.0.0),
rvest (>= 0.3.2),
tools (>= 3.1.0),
httr,
jsonlite,
lubridate (>= 1.7.0),
magrittr,
purrr (>= 0.2.5),
readr (>= 1.0.0),
readxl (>= 1.0.0),
rlang,
rstudioapi (>= 0.2),
xml2 (>= 1.2.0),
httr,
jsonlite,
magrittr,
usethis
rvest (>= 0.3.2),
tools (>= 3.1.0),
usethis,
xml2 (>= 1.2.0)
Suggests:
covr,
pkgdown,
testthat (>= 3.0.0),
tibble,
withr
Encoding: UTF-8
RoxygenNote: 7.3.2
Config/testthat/edition: 3
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ S3method(print,tt)
S3method(print,tt_data)
S3method(print,tt_dataset_table)
S3method(print,tt_dataset_table_list)
S3method(tt_gh_error,response)
S3method(tt_gh_error,tt_response)
export("%>%")
export(github_pat)
export(last_tuesday)
Expand Down Expand Up @@ -35,6 +37,7 @@ importFrom(purrr,walk)
importFrom(readr,read_delim)
importFrom(readxl,read_xls)
importFrom(readxl,read_xlsx)
importFrom(rlang,"%||%")
importFrom(rstudioapi,isAvailable)
importFrom(rstudioapi,viewer)
importFrom(rvest,html_node)
Expand Down
Loading

0 comments on commit 73e15da

Please sign in to comment.