Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 35 additions & 47 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +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
name: test-coverage

on:
push:
branches: [main, master]
branches: [main]
pull_request:

name: test-coverage.yaml

permissions: read-all
branches: [main]

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

permissions:
contents: write

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Set up R
uses: r-lib/actions/setup-r@v2

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, any::xml2
needs: coverage
- name: Install system dependencies
uses: r-lib/actions/setup-r-dependencies@v2

- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
print(cov)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
# Fail if error if not on PR, or if on PR and token is given
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
- name: Install dependencies
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
Rscript -e 'install.packages(c("remotes", "covr", " testthat", "DT", "htmltools"))'
Rscript -e 'remotes::install_deps(dependencies = TRUE)'

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4

- name: Run coverage and generate badge
run: |
mkdir -p coverage
Rscript -e '
cov <- covr::package_coverage(type = "tests")
covr::to_cobertura(cov, "coverage/cobertura.xml")
covr::report(cov, file = "coverage/coverage.html")
pct <- round(covr::percent_coverage(cov))
col <- if (pct >= 90) "brightgreen" else if (pct >= 75) "orange" else "red"
url <- sprintf("https://img.shields.io/badge/coverage-%s%%25-%s.svg", pct, col)
download.file(url, "coverage/badge.svg", quiet = TRUE)
'

- name: Deploy badge and reports to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./coverage
publish_branch: gh-pages
destination_dir: _xml_coverage_reports/
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: envsetup
Title: Support the Setup of the R Environment for Clinical Trial Programming Workflows
Version: 0.2.1
Version: 0.3.0
Authors@R: c(
person("Nicholas", "Masel", email = "nmasel@its.jnj.com", role = c("aut", "cre")),
person("Mike", "Stackhouse", email = "mike.stackhouse@atorusresearch.com", role = c("aut"), comment = c(ORCID = "0000-0001-6030-723X")),
Expand All @@ -24,7 +24,8 @@ Imports:
purrr,
rlang,
usethis,
roxygen2
envnames,
utils
Suggests:
rmarkdown,
testthat,
Expand Down
6 changes: 5 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

export(build_from_config)
export(detach_autos)
export(envsetup_environment)
export(get_path)
export(init)
export(library)
export(read_path)
export(rprofile)
export(validate_config)
export(write_path)
importFrom(config,get)
importFrom(envnames,environment_name)
importFrom(fs,dir_tree)
importFrom(purrr,walk)
importFrom(purrr,walk2)
Expand All @@ -20,4 +22,6 @@ importFrom(usethis,ui_done)
importFrom(usethis,ui_field)
importFrom(usethis,ui_info)
importFrom(usethis,ui_oops)
importFrom(usethis,ui_value)
importFrom(usethis,ui_yeah)
importFrom(utils,getFromNamespace)
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# envsetup 0.3.0

- `paths` no are no longer attached to the search path (#80)
- `paths` objects default to the global environment now, but they can be changed using the `envsetup.path.environment` option (#80)
- `get_path()` was added to help you retrieve a path with changing the storage environment using the `envsetup.path.environment` option (#80)
- `autos` are no longer attached to the search path, and are sourced to global (#81)
- `rprofile` lets you specify if sourcing of autos should overwrite an object in global if it already exists (#81)
- extensive messaging added to make users aware of autos being attached and conflicts (#81)
- object metadata storage is added to track what functions were sourced from where, see `envsetup_environment$object_metadata` (#81)
- vignettes updated to divide content into smaller chunks (#82)

# envsetup 0.2.1

- `set_autos()` will now handle NULL hierarchical paths (#66)
Expand Down
Loading
Loading