Skip to content

Commit

Permalink
Merge pull request #145 from atorus-research/devel
Browse files Browse the repository at this point in the history
Add back code coverage workflow
  • Loading branch information
asbates committed Dec 14, 2023
2 parents 6876054 + f7d07fa commit eb1b6de
Show file tree
Hide file tree
Showing 21 changed files with 815 additions and 357 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/test-coverage.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]

name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3

- 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
needs: coverage

- name: Test coverage
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
)
shell: Rscript {0}

- 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@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Imports:
tidyselect (>= 1.1.0),
tibble (>= 3.0.1),
lifecycle,
forcats (>= 0.4.0)
forcats (>= 1.0.0)
Suggests:
testthat (>= 2.1.0),
haven (>= 2.2.0),
Expand Down
5 changes: 4 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ importFrom(dplyr,between)
importFrom(dplyr,bind_cols)
importFrom(dplyr,bind_rows)
importFrom(dplyr,case_when)
importFrom(dplyr,cur_column)
importFrom(dplyr,cur_group)
importFrom(dplyr,distinct)
importFrom(dplyr,do)
Expand All @@ -146,6 +147,7 @@ importFrom(dplyr,group_keys)
importFrom(dplyr,if_else)
importFrom(dplyr,lag)
importFrom(dplyr,left_join)
importFrom(dplyr,matches)
importFrom(dplyr,mutate)
importFrom(dplyr,mutate_all)
importFrom(dplyr,mutate_at)
Expand All @@ -164,7 +166,7 @@ importFrom(dplyr,vars)
importFrom(forcats,fct_collapse)
importFrom(forcats,fct_drop)
importFrom(forcats,fct_expand)
importFrom(forcats,fct_explicit_na)
importFrom(forcats,fct_na_value_to_level)
importFrom(lifecycle,deprecate_soft)
importFrom(lifecycle,deprecate_stop)
importFrom(magrittr,"%>%")
Expand Down Expand Up @@ -257,6 +259,7 @@ importFrom(tibble,add_column)
importFrom(tibble,rownames_to_column)
importFrom(tibble,tibble)
importFrom(tidyr,complete)
importFrom(tidyr,fill)
importFrom(tidyr,nesting)
importFrom(tidyr,pivot_longer)
importFrom(tidyr,pivot_wider)
Expand Down
56 changes: 56 additions & 0 deletions R/call_standardise.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# # MIT License
#
# Copyright (c) 2020 rlang authors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

#' rlang deprecated call_standardise, but this is necessary for
#' the `modify_nested_call()` function. The capability isn't
#' matched by the `call_match()` function.
#'
#' In modify nested call, this is used to restructure the function call
#' to have all named arguments. Since all the functions called inside
#' `call_standardise()` are exported and currently stable within rlang,
#' I'm porting the function here.
#'
#' @param call
#'
#' @return call
#' @noRd
tplyr_call_standardise <- function(call, env= rlang::caller_env()) {

expr <- rlang::get_expr(call)

if (!rlang::is_call(expr)) {
stop("call_standardise error")
}

# The call name might be a literal, not necessarily a symbol
env <- rlang::get_env(call, env)
fn <- rlang::eval_bare(rlang::node_car(expr), env)

if (rlang::is_primitive(fn)) {
call
} else {
matched <- match.call(fn, expr)
rlang::set_expr(call, matched)
}

}

Loading

0 comments on commit eb1b6de

Please sign in to comment.