Skip to content

Commit

Permalink
Remove fit_tmb, add codecov and fix yaml files for Actions (#10)
Browse files Browse the repository at this point in the history
* removing fit_tmb

* fix small issue

* adding codecov

* Update README.md

* try adding Matrix as DEPENDS to trigger update

* expand R-CMD-check Action

* expand R-CMD-check to build Matrix/TMB from source

* test change to R-CMD-check

* test fix for Matrix/TMB inconsistency in codecov

* Update test-coverage.yaml

* another experiment

* Update test-coverage.yaml

* strip out codecov

* trigger check

* add manual codecov script

* try adding installs for R-CMD-check

* fix bug and move codecov.yml to scratch

* removing Matrix from Depends

* add test-coverage.yaml

* improving codecov

* small fix

* add codecov badge

* updating NEWS and DESCRIPTION

* small updates

* adding build-from-source for TMB/Matrix in pkgdown yaml

* adding build-from-source for test-coverage.yaml

* compiled Rd files

---------

Co-authored-by: Jim Thorson <James.T.Thorson@gmail.com>
  • Loading branch information
James-Thorson-NOAA and James-Thorson committed Feb 1, 2024
1 parent 0762900 commit 9027c4d
Show file tree
Hide file tree
Showing 31 changed files with 409 additions and 440 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
^_pkgdown\.yml$
^docs$
^pkgdown$
^codecov\.yml$
18 changes: 15 additions & 3 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
branches: [main, remove-fit_tmb]
pull_request:
branches: [main, master]
branches: [main, remove-fit_tmb]

name: R-CMD-check

Expand All @@ -21,9 +21,21 @@ jobs:
with:
use-public-rspm: true

- name: Install dependencies Ubuntu
if: runner.os == 'Linux'
run: |
install.packages('remotes')
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("knitr")
remotes::install_cran("rmarkdown")
remotes::install_cran("rcmdcheck")
install.packages("Matrix", type = "source")
install.packages("TMB", type = "source")
shell: Rscript {0}

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
- uses: r-lib/actions/check-r-package@v2
12 changes: 12 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ jobs:
with:
use-public-rspm: true

- name: Install dependencies Ubuntu
if: runner.os == 'Linux'
run: |
install.packages('remotes')
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("knitr")
remotes::install_cran("rmarkdown")
remotes::install_cran("rcmdcheck")
install.packages("Matrix", type = "source")
install.packages("TMB", type = "source")
shell: Rscript {0}

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 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, dev, remove-fit_tmb]
pull_request:
branches: [main, dev, remove-fit_tmb]

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

- name: Install dependencies Ubuntu
if: runner.os == 'Linux'
run: |
install.packages('remotes')
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("knitr")
remotes::install_cran("rmarkdown")
remotes::install_cran("rcmdcheck")
install.packages("Matrix", type = "source")
install.packages("TMB", type = "source")
shell: Rscript {0}

- 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(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "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
11 changes: 7 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: phylosem
Type: Package
Title: Phylogenetic Structural Equation Model
Version: 1.1.2
Date: 2023-12-19
Version: 1.1.3
Date: 2024-01-31
Authors@R:
c(person(given = "James",
family = "Thorson",
Expand All @@ -19,10 +19,11 @@ Imports:
sem,
ape,
phylobase,
phylopath
phylopath,
methods
Depends:
TMB,
R (>= 4.0.0)
R (>= 4.0.0),
Suggests:
semPlot,
TreeTools,
Expand Down Expand Up @@ -54,3 +55,5 @@ Encoding: UTF-8
RoxygenNote: 7.2.3
VignetteBuilder: knitr
URL: https://james-thorson-noaa.github.io/phylosem/
BugReports: https://github.com/James-Thorson-NOAA/phylosem/issues

4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ S3method(logLik,phylosem)
S3method(print,phylosem)
S3method(summary,phylosem)
S3method(vcov,phylosem)
export(TMBAIC)
export(as_fitted_DAG)
export(as_phylo4d)
export(as_sem)
Expand All @@ -17,16 +16,17 @@ export(best)
export(checkDepPackageVersion)
export(choice)
export(compare_phylosem)
export(fit_tmb)
export(list_parameters)
export(phylosem)
export(phylosem_control)
importFrom(TMB,MakeADFun)
importFrom(TMB,compile)
importFrom(TMB,dynlib)
importFrom(TMB,sdreport)
importFrom(ape,Ntip)
importFrom(ape,node.depth.edgelength)
importFrom(ape,rtree)
importFrom(methods,is)
importFrom(phylobase,phylo4d)
importFrom(phylopath,average_DAGs)
importFrom(phylopath,coef_plot)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# phylosem 1.1.3
* Removing fit_tmb to simplify code and remove unnecessary warnings
* Adding codecov and extra tests
* Fixing R-CMD-check to force build Matrix/TMB from source

# phylosem 1.1.2
* Adding new functions to provide warning if Matrix version doesn't match
what's expected by TMB
Expand Down
23 changes: 0 additions & 23 deletions R/TMBAIC.R

This file was deleted.

4 changes: 2 additions & 2 deletions R/coerce_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function( object ){
# extract and name identical to output from est_DAG
out = list(
coef = t(object$report$Rho_jj),
se = t(as.list(object$opt$SD, what="Std. Error", report=TRUE)$Rho_jj)
se = t(as.list(object$sdrep, what="Std. Error", report=TRUE)$Rho_jj)
)
dimnames(out$coef) = dimnames(out$se) = list( colnames(object$data), colnames(object$data) )

Expand Down Expand Up @@ -64,7 +64,7 @@ function( object,

#
what = match.arg(what)
traits = as.list( object$opt$SD, what=what )$x_vj
traits = as.list( object$sdrep, what=what )$x_vj
colnames(traits) = colnames(object$data)
out = phylo4d( x=object$tree, all.data=traits )

Expand Down
5 changes: 4 additions & 1 deletion R/compare_phylosem.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function( sem_set,
estimate_ou = FALSE,
estimate_lambda = FALSE,
estimate_kappa = FALSE,
control = phylosem_control(),
... ){

# Initialize object of results
Expand All @@ -31,16 +32,18 @@ function( sem_set,
# Loop through models
for( modelI in seq_along(sem_set) ){
fit = tryCatch( phylosem( sem = sem_set[[modelI]],
#fit = phylosem( sem = sem_set[[modelI]],
tree = tree,
data = data,
family = family,
covs = covs,
estimate_ou = estimate_ou,
estimate_lambda = estimate_lambda,
estimate_kappa = estimate_kappa,
control = control,
... ),
error = function(e) e )
if( "phylosem" %in% class(fit) ){
if( isTRUE(is(fit, "phylosem")) ){
out[[modelI]] = fit
}
}
Expand Down
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' Data used to demonstrate phylogenetic comparative methods for fisheries science.
#' Specifically a copy of the Then et al. database \doi{10.1093/icesjms/fsu136}
#' using file "Mlifehist_ver1.0.csv" accessed from
#' \url{https://www.vims.edu/research/departments/fisheries/programs/mort_db/index.php}
#' \url{https://www.vims.edu/research/departments/fisheries/programs/mort_db/}
#'
#' @name Mlifehist_ver1_0
#' @docType data
Expand Down
Loading

0 comments on commit 9027c4d

Please sign in to comment.