Skip to content

Update package version retrieval to use randomforge instead of rpact #3

Update package version retrieval to use randomforge instead of rpact

Update package version retrieval to use randomforge instead of rpact #3

Workflow file for this run

name: R Package Test Workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REPOSITORY_BRANCH: ${{ github.head_ref }}
R_KEEP_PKG_SOURCE: yes
NOT_CRAN: true
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up R
uses: r-lib/actions/setup-r@v2
- name: Set up Pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libgit2-dev \
libssl-dev \
libssh2-1-dev
- name: Set up R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::git2r, any::devtools, any::rlang, any::knitr, any::testthat, any::uuid, any::writexl, any::glue, any::httr
- name: Install latest version of randomforge from GitHub
run: |
devtools::install_github("RCONIS/randomforge")
shell: Rscript {0}
- name: Run unit tests
run: |
result <- devtools::test()
if (is.null(result)) {
message('No test results found')
quit(status = 1, save = "no")
}
df <- as.data.frame(result)
if (is.null(df)) {
message('Test results could not be converted to a data frame')
quit(status = 1, save = "no")
}
if (!all(c('failed', 'nb') %in% names(df))) {
message('Test results data frame does not contain expected columns')
quit(status = 1, save = "no")
}
nFailed <- sum(df$failed, na.rm = TRUE)
if (nFailed == 0 && 'error' %in% names(df)) {
nFailed <- sum(df$error, na.rm = TRUE)
}
nTotal <- sum(df$nb, na.rm = TRUE)
if (nFailed > 0) {
message(nFailed, ' tests of ', nTotal, ' failed')
quit(status = 1, save = "no")
}
message(nTotal, ' tests passed successfully')
shell: Rscript {0}
- name: ℹ️ Session info ️
run: |
options(width = 100, crayon.enabled = TRUE)
pkgs <- installed.packages()[,"Package"]
if (!require("sessioninfo", quietly=TRUE)) install.packages("sessioninfo")
tryCatch({
sessioninfo::session_info(pkgs, include_base = TRUE)
}, error = function(x){utils::sessionInfo()})
shell: Rscript {0}