-
Notifications
You must be signed in to change notification settings - Fork 12
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
revamp sitrep and nflverse_data class #199
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f8d660e
revamp sitrep and nflverse_data class
mrcaseb 91a6d3b
stop testing qs
tanho63 2dbe2b0
wrap qs test in skip if not install
tanho63 6b53e00
add back redact_path
tanho63 da907b1
cherry-pick test updates from seb's branch
tanho63 8ca88bf
skip pak for now
tanho63 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,51 @@ | ||
# 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 | ||
schedule: | ||
- cron: 15 15 1,15 * * | ||
branches: [main, master] | ||
pull_request: | ||
branches: | ||
- main | ||
- master | ||
- dev | ||
branches: [main, master] | ||
workflow_dispatch: | ||
|
||
name: R-CMD-check | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ${{ matrix.config.os }} | ||
if: "!contains(github.event.head_commit.message, 'ci skip')" | ||
|
||
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {os: windows-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/all/latest"} | ||
#- {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"} | ||
- {os: macOS-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/all/latest"} | ||
- {os: ubuntu-22.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | ||
- {os: ubuntu-22.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} | ||
- {os: ubuntu-20.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} | ||
- {os: ubuntu-20.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} | ||
- {os: macos-latest, r: 'release'} | ||
- {os: windows-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} | ||
- {os: ubuntu-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'oldrel-1'} | ||
|
||
env: | ||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | ||
RSPM: ${{ matrix.config.rspm }} | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
NFLVERSE_GH_TOKEN: ${{ secrets.NFLVERSE_GH_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
http-user-agent: ${{ matrix.config.http-user-agent }} | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
cache-version: 2 | ||
extra-packages: | | ||
rcmdcheck | ||
ropensci/piggyback | ||
|
||
- name: Check | ||
env: | ||
_R_CHECK_CRAN_INCOMING_REMOTE_: false | ||
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") | ||
shell: Rscript {0} | ||
extra-packages: any::rcmdcheck, ropensci/piggyback | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#' nflverse data class | ||
#' | ||
#' This class has a special S3 print method that tries to read attached metadata and | ||
#' provide timestamps and source attributes. It otherwise will dispatch to the | ||
#' `data.frame` class. | ||
#' | ||
#' @name nflverse_data-class | ||
#' @keywords internal | ||
#' @exportClass nflverse_data | ||
methods::setOldClass(c("nflverse_data", "data.frame")) | ||
|
||
#' @export | ||
#' @noRd | ||
print.nflverse_data <- function(x,...){ | ||
|
||
cli::cli_rule("{.emph nflverse {attr(x,'nflverse_type')}}") | ||
|
||
if(!is.null(attr(x,'nflverse_timestamp'))) { | ||
cli::cli_alert_info( | ||
"Data updated: {.field {format(attr(x,'nflverse_timestamp'), tz = Sys.timezone(), usetz = TRUE)}}" | ||
) | ||
} | ||
|
||
NextMethod(print,x) | ||
invisible(x) | ||
} | ||
|
||
make_nflverse_data <- function(df, nflverse_type = NULL, ...){ | ||
|
||
df <- data.table::as.data.table(df) | ||
data.table::setattr(df, "class", c("nflverse_data", "tbl_df", "tbl", "data.table","data.frame")) | ||
|
||
dots <- rlang::dots_list(..., .named = TRUE) | ||
|
||
for(i in seq_along(dots)){ | ||
data.table::setattr(df, names(dots)[[i]], dots[[i]]) | ||
} | ||
|
||
if(!is.null(nflverse_type)) data.table::setattr(df, "nflverse_type", nflverse_type) | ||
|
||
if( | ||
(length(dots) > 0 | !is.null(nflverse_type)) && | ||
is.null(attr(df, "nflverse_timestamp")) | ||
){ | ||
data.table::setattr(df, "nflverse_timestamp", Sys.time()) | ||
} | ||
|
||
return(df) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrcaseb maybe it was that we were installing mac pkgs from RSPM instead of whatever the default is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that's what I figured and why I decided to test a newer workflow. I hope it resolves our problems and stops annoying us