Skip to content

Commit

Permalink
Merge branch 'main' into sfp-104-nl
Browse files Browse the repository at this point in the history
  • Loading branch information
ToonVanDaele authored Nov 17, 2023
2 parents dd00063 + b413229 commit ae76199
Show file tree
Hide file tree
Showing 107 changed files with 4,737 additions and 869 deletions.
5 changes: 5 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
source("renv/activate.R")
local({
options(
pkgType = "both"
)
})
6 changes: 3 additions & 3 deletions .github/workflows/generate-artifact-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Query dependencies
run: |
install.packages('remotes')
install.packages('remotes', type = "source")
saveRDS(remotes::dev_package_deps(dependencies = NA), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
Expand All @@ -49,8 +49,8 @@ jobs:
- name: Install dependencies
run: |
remotes::install_deps(dependencies = NA) #fails to install protocolhelper
remotes::install_github("inbo/protocolhelper")
remotes::install_deps(dependencies = NA, type = "source") #fails to install protocolhelper
remotes::install_github("inbo/protocolhelper", type = "source")
shell: Rscript {0}

- name: Session info
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/update_news_zenodo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
build:
if: github.event.review.state == 'approved'
&& github.event.pull_request.base.ref == 'main'
&& (startsWith(github.head_ref, 'sfp-')
|| startsWith(github.head_ref, 'sip-')
|| startsWith(github.head_ref, 'sop-')
|| startsWith(github.head_ref, 'sap-')
|| startsWith(github.head_ref, 'spp-'))
&& (startsWith(github.event.pull_request.head.ref, 'sfp-')
|| startsWith(github.event.pull_request.head.ref, 'sip-')
|| startsWith(github.event.pull_request.head.ref, 'sop-')
|| startsWith(github.event.pull_request.head.ref, 'sap-')
|| startsWith(github.event.pull_request.head.ref, 'spp-'))
runs-on: ubuntu-latest
name: "update repo news and zenodo"
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ vignettes/*.pdf

# Other
docs/
from_docx/
css/
_bookdown_files/
18 changes: 18 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@
"affiliation": "Research Institute for Nature and Forest",
"type": "Researcher",
"orcid": "0000-0003-3537-286X"
},
{
"name": "Sophie Vermeersch",
"affiliation": "Research Institute for Nature and Forest",
"type": "Researcher",
"orcid": "0009-0001-5836-1189"
},
{
"name": "Els De Bie",
"affiliation": "Research Institute for Nature and Forest",
"type": "Researcher",
"orcid": "0000-0001-7679-743X"
},
{
"name": "Scheers, Kevin",
"affiliation": "Research Institute for Nature and Forest",
"type": "Researcher",
"orcid": "0000-0002-4756-4247"
}
]
}
46 changes: 36 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ Note also that any dependency packages needed by the packages listed in the [DES

Apart from the above R packages, you will also need a working installation of TinyTeX, which is an external open-source software package that is needed to render protocols to PDF format (i.e. when you run `protocolhelper::render_protocol()` see [Workflow](#workflow)).

To install this, we recommend to follow the [installation instructions](https://github.com/inbo/INBOmd/#installation) provided by the `INBOmd` R package.
Please make sure to install this from an R session that runs outside of the RStudio `protocolsource.Rproj`.
So, close the RStudio project and any other R sessions and start the most recent version of R that is installed on your system and copy-paste the installation instructions in the R console.
To install this:

- close the RStudio project and any other R sessions and start the most recent version of R that is installed on your system

- follow the [installation instructions](https://github.com/inbo/INBOmd/#installation) provided by the `INBOmd` R package and copy-paste the installation instructions in the R console.

## `(R)markdown` syntax and learning `Rmarkdown`

Expand Down Expand Up @@ -145,7 +147,7 @@ Tips & Tricks:

## <a name="branching"></a>Branching model

![](src/management/protocols-gitflow-model.png)
![](source/management/protocols-gitflow-model.png)

We use a simple branching model.
The main branch is protected and can only receive commits from reviewed pull requests.
Expand Down Expand Up @@ -219,9 +221,9 @@ This website will host all approved and published versions of all protocols.

7. When you think your protocol is ready to be reviewed, visit [github protocolsource](https://github.com/inbo/protocolsource) and start a Pull Request (PR)

![](src/management/pr-on-github-1.png)
![](source/management/pr-on-github-1.png)

![](src/management/pr-on-github-2.png)
![](source/management/pr-on-github-2.png)

1. Wait for the continuous integration checks to finish and see if the checks succeeded.
These checks will run `protocolhelper::check_frontmatter()` and `protocolhelper::check_structure()`, and update the version number if needed.
Expand All @@ -237,14 +239,14 @@ This website will host all approved and published versions of all protocols.
At least one repo admin and one other subject-matter specialist must review the protocol.
The subject-matter specialist reviews the contents of the protocol and the repo-admin reviews technical aspects.

![](src/management/pr-on-github-4.png)
![](source/management/pr-on-github-4.png)

10. Reviewers can follow [these guidelines](REVIEWING.md)

11. If the reviewers raise concerns, changes can be made to the protocol that address these concerns (stage, commit, push).
If the review requires substantial changes, it is wise to temporarilly mark the PR as draft

![](src/management/pr-on-github-3.png)
![](source/management/pr-on-github-3.png)

When you have dealt with the reviewer comments, go to your draft pull request and press 'ready for review'

Expand Down Expand Up @@ -276,13 +278,16 @@ This will allow you to check the resulting output locally.
### From an existing docx protocol
Even if you are converting an older published protocol, we recommend leaving the date field to it's default value (current date) and instead mention in the `NEWS.md` file that this is a conversion from protocol so-and-so published first on date such-and-such.


```r
library(protocolhelper)
create_sfp(title = "Klassieke vegetatieopname in een proefvlak aan de hand van visuele inschattingen van bedekking van soorten in (semi-)terrestrische vegetatie",
short_title = "vegopname terrest",
authors = "De Bie, Els",
orcids = "0000-0000-1234-5678",
date = "2016-07-19",
date = "`r Sys.Date()`",
reviewers = "Hans Van Calster, Lieve Vriens, Jan Wouters, Wouter Van Gompel, Els Lommelen",
file_manager = "Hans Van Calster",
theme = "vegetation",
Expand All @@ -296,6 +301,8 @@ create_sfp(title = "Klassieke vegetatieopname in een proefvlak aan de hand van v

### From a new template

For a field protocol (sfp) (you need to specify a theme):

```r
library(protocolhelper)
create_sfp(title = "titel van het protocol",
Expand All @@ -313,7 +320,7 @@ create_sfp(title = "titel van het protocol",
render = FALSE)
```

Alternatively, for a project-specific protocol:
Alternatively, for a project-specific protocol (you need to specify a project_name):

```r
library(protocolhelper)
Expand All @@ -329,6 +336,25 @@ create_spp(title = "Bodemstalen nemen",
render = FALSE)
```

Or for a standard operating procedure (similarly for sip or sap; no need to specify theme or project_name):

```r
library(protocolhelper)
create_sop(title = "titel van het protocol",
subtitle = "optionele subtitel",
short_title = "korte titel",
authors = c("Achternaam1, Voornaam1", "Achternaam2, voornaam2"),
orcids = c("0000-0000-1234-5678", "0000-0000-1234-8765"),
date = "`r Sys.Date()`",
reviewers = "Voornaam Naam, ...",
file_manager = "Voornaam Naam",
language = "nl",
from_docx = NULL,
protocol_number = NULL,
render = FALSE)
```


## <a name="parameterized"></a>What to do in case of parameterized protocols?

See [the bookdown manual](https://bookdown.org/yihui/rmarkdown/parameterized-reports.html) for a general explanation about parameterized reports.
Expand Down
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
Remotes:
github::inbo/protocolhelper,
github::inbo/checklist
github::inbo/checklist,
github::inbo/inbodb
Imports:
checklist,
dplyr,
Expand All @@ -38,4 +39,5 @@ Imports:
rprojroot,
sessioninfo,
spatstat,
tibble
tibble,
yaml
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libv8-dev

## Install tinytex
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
r-cran-tinytex
RUN Rscript -e 'tinytex::install_tinytex(force = TRUE)'

## Install LaTeX packages
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ghostscript \
&& Rscript -e 'tinytex::tlmgr_install(c("amsmath", "amssymb", "array", "babel-dutch", "babel-english", "babel-french", "beamer", "beamerarticle", "biblatex", "bookmark", "booktabs", "calc", "caption", "csquotes", "dvips", "etoolbox", "fancyvrb", "fontenc", "fontspec", "footnote", "footnotehyper", "geometry", "graphicx", "helvetic", "hyperref", "hyphen-dutch", "hyphen-french", "iftex", "inconsolata", "inputenc", "listings", "lmodern", "longtable", "luatexja-preset", "luatexja-fontspec", "mathspec", "microtype", "multirow", "natbib", "orcidlink", "parskip", "pgfpages", "selnolig", "setspace", "soul", "svg", "tex", "textcomp", "times", "unicode-math", "upquote", "url", "xcolor", "xeCJK", "xurl"))'

WORKDIR /github/workspace

RUN R -e "install.packages('renv', repos = c(CRAN = 'https://cloud.r-project.org'))"
Expand Down
29 changes: 29 additions & 0 deletions MAINTENANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Updating `renv` or the `docker` machinery

These instructions are for admins only.

Making changes to `renv.lock`:

- create a new branch `docker-renv-update`
- adding a new package: add the package name to the `DESCRIPTION` file, install the package and snapshot it
- after an upgrade of R x.y to x.z: [see tutorial website](https://inbo.github.io/tutorials/tutorials/r_renv_update/#updating-r-and-packages)
- add, commit and push `renv.lock` (potentially also `DESCRIPTION` and other files altered by `renv`), make a Pull Request
- ask for a review
- wait until docker succesfully built message appears before merging

Making changes to `docker` or `dockerfile` (and possibly also `renv.lock`):

- create a new branch `docker-update`
- make changes and add, commit, push them
- ask for a review
- wait until docker succesfully built message appears before merging

Whenever the above branches are merged to main, a git tag `docker-<sha-1>` will be automatically added via GHA.
Here, <sha-1> refers to the SHA-1 identifier of the merge commit.

`dockerhub` is configured in such a way that the docker image will be built when the branchname starts with `docker-<name>`.
Docker will then add a docker tag to this image called `dev-<name>`.
This means that for every commit to a `docker-<name>` branch, the docker image will be rebuilt.
This allows to test if the image can be built.
There will be at most two test images: `dev-renv-update` or `dev-update`.
When a git tag `docker-<sha-1>` appears on the main branch, the docker image will built and receive a dockerhub tag `latest`.
28 changes: 28 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
### First version of protocol: sfp-406-nl

- Title: Vegetatieopname en LSVI-bepaling *Luronium natans*
- Published on: 2023-06-21
- Version number: 2023.06
- Link to this version: [sfp-406-nl version 2023.06](2023.06/index.html)

### Update of protocol: sfp-403-nl

- Title: Vegetatieopname en LSVI-bepaling habitat 3260
- Published on: 2023-06-20
- Version number: 2023.05
- Link to this version: [sfp-403-nl version 2023.05](2023.05/index.html)

### First version of protocol: sfp-113-nl

- Title: Bepaling doorzicht waterkolom oppervlaktewater op basis van de Secchi-diepte
- Published on: 2023-06-20
- Version number: 2023.04
- Link to this version: [sfp-113-nl version 2023.04](2023.04/index.html)

### First version of protocol: sfp-401-nl

- Title: Klassieke vegetatieopname in een proefvlak aan de hand van visuele inschattingen van bedekking van soorten in (semi-)terrestrische vegetatie
- Published on: 2023-05-02
- Version number: 2023.03
- Link to this version: [sfp-401-nl version 2023.03](2023.03/index.html)

### First version of protocol: sfp-403-nl

- Title: Vegetatieopname en LSVI-bepaling habitat 3260
Expand Down
4 changes: 2 additions & 2 deletions docker/entrypoint_update.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh -l

echo '\nGetting the code...\n'
git clone --branch=$GITHUB_HEAD_REF https://$INPUT_PAT@github.com/$GITHUB_REPOSITORY /update
git clone --branch=$INPUT_GITHUB_HEAD_REF https://$INPUT_PAT@github.com/$GITHUB_REPOSITORY /update
git config --global user.email "info@inbo.be"
git config --global user.name "INBO"
cd /update
Expand All @@ -17,7 +17,7 @@ git add .zenodo.json
git commit --message="update .zenodo.json"

echo '\nUpdating general NEWS.md...\n'
Rscript --no-save --no-restore -e 'protocolhelper:::update_news_release("'$GITHUB_HEAD_REF'")'
Rscript --no-save --no-restore -e 'protocolhelper:::update_news_release("'$INPUT_GITHUB_HEAD_REF'")'
git add NEWS.md
git commit --message="update general NEWS.md"

Expand Down
Loading

0 comments on commit ae76199

Please sign in to comment.