Skip to content

Commit

Permalink
increment version
Browse files Browse the repository at this point in the history
  • Loading branch information
fbenke-pik committed Nov 15, 2023
1 parent bb89060 commit 4a6af76
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '2603874'
ValidationKey: '2754640'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
Expand Down
97 changes: 25 additions & 72 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Run CI for R using https://eddelbuettel.github.io/r-ci/

name: check

on:
Expand All @@ -8,92 +6,45 @@ on:
pull_request:
branches: [main, master]

env:
USE_BSPM: "true"
_R_CHECK_FORCE_SUGGESTS_: "false"
NO_BINARY_INSTALL_R_PACKAGES: 'c("madrat", "magclass", "citation", "gms", "goxygen", "GDPuc", "roxygen2")'

jobs:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Bootstrap
run: |
sudo chown runner -R .
sudo locale-gen en_US.UTF-8
sudo add-apt-repository -y ppa:ubuntugis/ppa
curl -OLs https://eddelbuettel.github.io/r-ci/run.sh
chmod 0755 run.sh
./run.sh bootstrap
rm -f bspm_*.tar.gz
- name: Enable r-universe repo, modify bspm integration
run: |
# install packages from https://pik-piam.r-universe.dev and CRAN
echo '
options(repos = c(universe = "https://pik-piam.r-universe.dev",
CRAN = "https://cloud.r-project.org"))
' >> .Rprofile
cat .Rprofile
# modify bspm integration to never install binary builds of PIK CRAN packages
sudo sed -i '/bspm::enable()/d' /etc/R/Rprofile.site
# need double % because of printf, %s is replaced with "$NO_BINARY_INSTALL_R_PACKAGES" (see "env:" above)
printf '
local({
expr <- quote({
if (!is.null(repos)) {
noBinaryInstallRPackages <- %s
pkgs <- c(bspm::install_sys(pkgs[!pkgs %%in%% noBinaryInstallRPackages]),
pkgs[pkgs %%in%% noBinaryInstallRPackages])
}
type <- "source"
})
trace(utils::install.packages, expr, print = FALSE)
})
' "$NO_BINARY_INSTALL_R_PACKAGES" | sudo tee --append /etc/R/Rprofile.site >/dev/null
cat /etc/R/Rprofile.site
- name: Set up Pandoc
uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-pandoc@v2

- name: Set up Python 3.9
uses: actions/setup-python@v4
- uses: r-lib/actions/setup-r@v2
with:
python-version: 3.9
use-public-rspm: true
extra-repositories: "https://rse.pik-potsdam.de/r/packages"

- name: Cache R libraries
if: ${{ !env.ACT }} # skip when running locally via nektos/act
uses: pat-s/always-upload-cache@v3
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: /usr/local/lib/R/
key: 3-${{ runner.os }}-usr-local-lib-R-${{ hashFiles('DESCRIPTION') }}
restore-keys: |
3-${{ runner.os }}-usr-local-lib-R-
- name: Restore R library permissions
run: |
sudo chmod 2777 /usr/local/lib/R /usr/local/lib/R/site-library
- name: Install dependencies
run: |
./run.sh install_aptget libhdf5-dev libharfbuzz-dev libfribidi-dev
./run.sh install_all
./run.sh install_r_binary covr rstudioapi
./run.sh install_r lucode2
extra-packages: |
gamstransfer=?ignore
any::lucode2
any::covr
any::madrat
any::magclass
any::citation
any::gms
any::goxygen
any::GDPuc
# piam packages also available on CRAN (madrat, magclass, citation,
# gms, goxygen, GDPuc) will usually have an outdated binary version
# available; by using extra-packages we get the newest version

- uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install python dependencies if applicable
run: |
[ -f requirements.txt ] && python -m pip install --upgrade pip wheel || true
[ -f requirements.txt ] && pip install -r requirements.txt || true
- name: Remove bspm integration # to get rid of error when running install.packages
run: |
sudo sed -i '/ trace(utils::install.packages, expr, print = FALSE)/d' /etc/R/Rprofile.site
cat /etc/R/Rprofile.site
- name: Verify validation key
shell: Rscript {0}
run: lucode2:::validkey(stopIfInvalid = TRUE)
Expand All @@ -106,6 +57,8 @@ jobs:
- name: Test coverage
shell: Rscript {0}
run: covr::codecov(quiet = FALSE)
run: |
nonDummyTests <- setdiff(list.files("./tests/testthat/"), c("test-dummy.R", "_snaps"))
if(length(nonDummyTests) > 0) covr::codecov(quiet = FALSE)
env:
NOT_CRAN: "true"
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exclude: '^tests/testthat/_snaps/.*$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-json
Expand All @@ -15,7 +15,7 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/lorenzwalthert/precommit
rev: v0.3.2.9013
rev: v0.3.2.9025
hooks:
- id: parsable-R
- id: deps-in-desc
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'goxygen: In-Code Documentation for ''GAMS'''
version: 1.3.3
date-released: '2023-08-09'
version: 1.4.0
date-released: '2023-11-15'
abstract: A collection of tools which extract a model documentation from 'GAMS' code
and comments. In order to use the package you need to install 'pandoc' and 'pandoc-citeproc'
first (<https://pandoc.org/>).
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: goxygen
Type: Package
Title: In-Code Documentation for 'GAMS'
Version: 1.3.3
Date: 2023-08-09
Version: 1.4.0
Date: 2023-11-15
Authors@R: c(person("Jan Philipp", "Dietrich", email = "[email protected]", role = c("aut","cre")),
person("Kristine", "Karstens", email = "[email protected]", role = "aut"),
person("David", "Klein", email = "[email protected]", role = "aut"),
Expand Down
54 changes: 26 additions & 28 deletions R/helper_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @export
#'
.empty <- function(zz) {
writeLines("",zz)
writeLines("", zz)
}

#' .write
Expand All @@ -20,8 +20,8 @@
#' @author Jan Philipp Dietrich
#' @seealso \code{\link{goxygen}}, \code{\link{createModulePage}}
#'
.write <- function(zz,data) {
if(!is.null(data)) writeLines(data,zz)
.write <- function(zz, data) {
if (!is.null(data)) writeLines(data, zz)
.empty(zz)
}

Expand All @@ -36,19 +36,19 @@
#' @author Jan Philipp Dietrich
#' @seealso \code{\link{goxygen}}, \code{\link{createModulePage}}
#'
.header <- function(zz,title,level,id=NULL) {
if(length(title)>1) {
.header <- function(zz, title, level, id = NULL) {
if (length(title) > 1) {
warning("Multiline entry to title detected. Only first line will be used!")
title <- title[1]
}
if(!is.null(id)) id <- paste0(" {#id-",id,"}")
if(level<3) {
writeLines(paste0(title,id),zz)
symbol <- ifelse(level==1,"=","-")
writeLines(paste(rep(symbol,nchar(title)), collapse=""),zz)
if (!is.null(id)) id <- paste0(" {#id-", id, "}")
if (level < 3) {
writeLines(paste0(title, id), zz)
symbol <- ifelse(level == 1, "=", "-")
writeLines(paste(rep(symbol, nchar(title)), collapse = ""), zz)
} else {
start <- paste(rep("#",level),collapse="")
writeLines(paste(start,title),zz)
start <- paste(rep("#", level), collapse = "")
writeLines(paste(start, title), zz)
}
.empty(zz)
}
Expand All @@ -68,7 +68,7 @@
#' @seealso \code{\link{goxygen}}, \code{\link{createModulePage}}
#'
.section <- function(data, zz, title, level, id = NULL) {
if(!is.null(data)){
if (!is.null(data)) {
.header(zz, title, level, id)
.write(zz, data)
}
Expand All @@ -84,12 +84,12 @@
#' @author Jan Philipp Dietrich
#' @seealso \code{\link{goxygen}}, \code{\link{createModulePage}}
#'
.interfaceplot <- function(zz,name,docfolder) {
file <- paste0("images/interfaces_",sub("^[^_]*_","",name),".png")
if(file.exists(paste0(docfolder,"/",file))) {
.write(zz,paste0("![Interfaces to other modules](",file,"){ height=50% width=100% }"))
.interfaceplot <- function(zz, name, docfolder) {
file <- paste0("images/interfaces_", sub("^[^_]*_", "", name), ".png")
if (file.exists(paste0(docfolder, "/", file))) {
.write(zz, paste0("![Interfaces to other modules](", file, "){ height=50% width=100% }"))
} else {
.write(zz,"**Interface plot missing!**")
.write(zz, "**Interface plot missing!**")
}
}

Expand All @@ -104,14 +104,14 @@
#' @author Jan Philipp Dietrich
#' @seealso \code{\link{goxygen}}, \code{\link{createModulePage}}
#'
.limitations <- function(zz,limitations, emptyIfNULL=FALSE) {
if(is.null(limitations)) {
if(emptyIfNULL) return()
.limitations <- function(zz, limitations, emptyIfNULL = FALSE) {
if (is.null(limitations)) {
if (emptyIfNULL) return()
limitations <- "There are no known limitations."
}
limitations <- c("**Limitations**",limitations)
limitations <- paste(">",limitations)
.write(zz,limitations)
limitations <- c("**Limitations**", limitations)
limitations <- paste(">", limitations)
.write(zz, limitations)
}


Expand All @@ -124,8 +124,6 @@
#' @author Jan Philipp Dietrich
#' @seealso \code{\link{goxygen}}, \code{\link{createModulePage}}
#'
.updateImagePaths <- function(x){
return(gsub("\\(([^/]*\\.(png|jpg))\\)","(images/\\1)",x))
.updateImagePaths <- function(x) {
return(gsub("\\(([^/]*\\.(png|jpg))\\)", "(images/\\1)", x))
}


6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# In-Code Documentation for 'GAMS'

R package **goxygen**, version **1.3.3**
R package **goxygen**, version **1.4.0**

[![CRAN status](https://www.r-pkg.org/badges/version/goxygen)](https://cran.r-project.org/package=goxygen) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1411404.svg)](https://doi.org/10.5281/zenodo.1411404) [![R build status](https://github.com/pik-piam/goxygen/workflows/check/badge.svg)](https://github.com/pik-piam/goxygen/actions) [![codecov](https://codecov.io/gh/pik-piam/goxygen/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/goxygen) [![r-universe](https://pik-piam.r-universe.dev/badges/goxygen)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -48,7 +48,7 @@ In case of questions / problems please contact Jan Philipp Dietrich <dietrich@pi

To cite package **goxygen** in publications use:

Dietrich J, Karstens K, Klein D, Baumstark L (2023). _goxygen: In-Code Documentation for 'GAMS'_. doi:10.5281/zenodo.1411404 <https://doi.org/10.5281/zenodo.1411404>, R package version 1.3.3, <https://github.com/pik-piam/goxygen>.
Dietrich J, Karstens K, Klein D, Baumstark L (2023). _goxygen: In-Code Documentation for 'GAMS'_. doi:10.5281/zenodo.1411404 <https://doi.org/10.5281/zenodo.1411404>, R package version 1.4.0, <https://github.com/pik-piam/goxygen>.

A BibTeX entry for LaTeX users is

Expand All @@ -57,7 +57,7 @@ A BibTeX entry for LaTeX users is
title = {goxygen: In-Code Documentation for 'GAMS'},
author = {Jan Philipp Dietrich and Kristine Karstens and David Klein and Lavinia Baumstark},
year = {2023},
note = {R package version 1.3.3},
note = {R package version 1.4.0},
doi = {10.5281/zenodo.1411404},
url = {https://github.com/pik-piam/goxygen},
}
Expand Down
2 changes: 1 addition & 1 deletion man/createModulePage.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions man/dot-section.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/extractDocumentation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vignettes/goxygen.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ setwd(tempdir())
We take the GAMS code example from this package and save it to `dummymodel-plain`:

```{r eval=FALSE}
# copy the folder containing a simple dummy model with goxygen comments
file.copy(from = system.file("dummymodel-plain",package="goxygen"), to = ".", recursive = TRUE)
# copy the folder containing a simple dummy model with goxygen comments
file.copy(from = system.file("dummymodel-plain", package = "goxygen"), to = ".", recursive = TRUE)
```

and execute `goxygen` on this GAMS file to produce the documentation in HTML as well as PDF format.
Expand Down Expand Up @@ -108,7 +108,7 @@ Goxygen is tailored to extract the documentation from this modular structure and

```{r eval=FALSE}
# copy all files and folders containing the modular dummy model
file.copy(from = system.file("dummymodel",package="gms"), to = ".", recursive = TRUE)
file.copy(from = system.file("dummymodel", package = "gms"), to = ".", recursive = TRUE)
```

Now execute `goxygen` on the modular GAMS model:
Expand Down

0 comments on commit 4a6af76

Please sign in to comment.