Skip to content

Commit

Permalink
Merge pull request #3 from nlmixr2/maintenance
Browse files Browse the repository at this point in the history
Maintenance
  • Loading branch information
mattfidler authored Sep 21, 2023
2 parents 5c05694 + 9b71697 commit 83dd432
Show file tree
Hide file tree
Showing 15 changed files with 151 additions and 124 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
^pkgdown$
\.o$
^\.github$
^codecov\.yml$
97 changes: 19 additions & 78 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
# NOTE: This workflow is overkill for most R packages
# check-standard.yaml is likely a better choice
# usethis::use_github_action("check-standard") will install it.
#
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
# 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
branches: [main, master]
pull_request:
branches:
- main
- master
branches: [main, master]

name: R-CMD-check

Expand All @@ -26,83 +18,32 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: '3.6'}
# We explicitly set the user agent for R devel to the current release version of R so RSPM serves the release binaries.
- {os: ubuntu-16.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest", http-user-agent: "R/4.0.0 (ubuntu-16.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {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 }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
- 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@v1

- uses: r-lib/actions/setup-tinytex@v1

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "16.04"))')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
extra-packages: any::rcmdcheck
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
62 changes: 31 additions & 31 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
# 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
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: macOS-latest
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-pandoc@v1

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Cache R packages
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
extra-packages: any::pkgdown, local::.
needs: website

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown", type = "binary")
- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
clean: false
branch: gh-pages
folder: docs
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
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
doc
Meta
/vignettes/lbfgsb3c.R
/vignettes/.Rhistory
/src/lbfgsb3c.so
/src/.Rhistory
/.Rhistory
.Rhistory
docs
inst/doc
13 changes: 11 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,25 @@ Description: Interfacing to Nocedal et al. L-BFGS-B.3.0
License: GPL-2
Depends: R (>= 3.6)
Imports: Rcpp (>= 0.12.3), numDeriv, methods
Suggests: optimx, microbenchmark, testthat, knitr, pkgbuild, rmarkdown, RcppArmadillo
Suggests:
knitr,
microbenchmark,
optimx,
pkgbuild,
RcppArmadillo,
rmarkdown,
testthat (>= 3.0.0)
LinkingTo: Rcpp (>= 0.12.3), RcppArmadillo
Encoding: UTF-8
VignetteBuilder: knitr
NeedsCompilation: yes
RoxygenNote: 7.0.2
RoxygenNote: 7.2.3
Author: Matthew L Fidler [aut, cre],
John C Nash [aut],
Ciyou Zhu [aut],
Richard Byrd [aut],
Jorge Nocedal [aut],
Jose Luis Morales [aut]
Packaged: 2020-02-26 20:18:51 UTC; john
URL: https://nlmixr2.github.io/lbfgsb3c/
Config/testthat/edition: 3
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[![R-CMD-check](https://github.com/nlmixrdevelopment/lbfgsb3c/workflows/R-CMD-check/badge.svg)](https://github.com/nlmixrdevelopment/lbfgsb3c/actions)
<!-- badges: start -->
[![R-CMD-check](https://github.com/nlmixr2/lbfgsb3c/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nlmixr2/lbfgsb3c/actions/workflows/R-CMD-check.yaml)
[![CRAN total downloads](https://cranlogs.r-pkg.org/badges/grand-total/lbfgsb3c)](https://cran.r-project.org/package=lbfgsb3c)
[![CRAN total downloads](https://cranlogs.r-pkg.org/badges/lbfgsb3c)](https://cran.r-project.org/package=lbfgsb3c)
[![Codecov test coverage](https://codecov.io/gh/nlmixr2/lbfgsb3c/branch/main/graph/badge.svg)](https://app.codecov.io/gh/nlmixr2/lbfgsb3c?branch=main)
<!-- badges: end -->

# libfgsb3c interface from C
This is the fork of the libfgsb3 from cran with the following differences:
Expand Down
5 changes: 4 additions & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
destination: docs
url: https://nlmixr2.github.io/lbfgsb3c/
template:
bootstrap: 5

14 changes: 14 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
comment: false

coverage:
status:
project:
default:
target: auto
threshold: 1%
informational: true
patch:
default:
target: auto
threshold: 1%
informational: true
8 changes: 8 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
# * https://testthat.r-lib.org/articles/special-files.html

library(testthat)
library(lbfgsb3c)

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-bounds.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
context("Bounds")
test_that("bounds test", {
bt.f<-function(x){
sum(x*x)
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-cyq.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ nn <- c(2, 3, 5, 8)

for (n in nn) {
str <- paste0("Chebyquad in ", n, " parameters");
context(str)
test_that(str, {
lower <- rep(-10, n)
upper <- rep(10, n)
Expand All @@ -109,5 +108,4 @@ for (n in nn) {
round(ans$value, 3))
}
})

}
4 changes: 2 additions & 2 deletions tests/testthat/test-genrose.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ genrose.g <- function(x, gs = NULL) {
gg
}

context("Unconstrained Genrose test with gradient")
# Unconstrained Genrose test with gradient

nn <- 100
xx <- rep(3, nn)
Expand All @@ -41,7 +41,7 @@ test_that("100u", {
})


context("Unconstrained Genrose test without gradient")
# Unconstrained Genrose test without gradient
ans100un <- lbfgsb3c(xx, genrose.f,
gr = NULL, gs = 10)

Expand Down
2 changes: 2 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html
*.R
5 changes: 2 additions & 3 deletions vignettes/lbfgsb3c.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ author: "John C Nash
University of Ottawa,
nashjc@uottawa.ca"
date: "October 22, 2019"
output:
pdf_document
output: rmarkdown::html_vignette
bibliography: lbfgsb3c.bib
vignette: >
%\VignetteIndexEntry{lbfgsb3c-nocompile}
%\VignetteEngine{knitr::rmarkdown}
\usepackage[utf8]{inputenc}
%\VignetteEncoding{UTF-8}
---

```{r setup, include=FALSE}
Expand Down

0 comments on commit 83dd432

Please sign in to comment.