Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
a3e6c49
first test setup docker
ElsLommelen Mar 18, 2022
f9f2276
operational docker workflow (locally)
ElsLommelen Apr 1, 2022
54591b1
rename entrypoint.sh to allow a 2nd docker to be added
ElsLommelen Apr 5, 2022
f5d52b8
add docker with checks
ElsLommelen Apr 5, 2022
7407daf
correct path to render.R
ElsLommelen Apr 5, 2022
06efd53
point Dockerfile to new docker
ElsLommelen Apr 5, 2022
0d76221
move function from .sh to .R
ElsLommelen Apr 5, 2022
239b41d
try solving loadnamespace problem
ElsLommelen Apr 6, 2022
9aada04
.Rprofile gives problems with loadNamespace
ElsLommelen Apr 6, 2022
420a7f6
check if branch is up to date with main
ElsLommelen Apr 6, 2022
c0c218a
Merge branch 'renv-setup' into docker-setup
ElsLommelen Jul 15, 2022
4f3cdd1
Merge branch 'renv-setup' into docker-setup
ElsLommelen Jul 18, 2022
c3fbb34
correct date in testprotocol
ElsLommelen Jul 18, 2022
9e8ad68
test check_structure() instead of check_frontmatter()
ElsLommelen Jul 18, 2022
cb63ddb
new test check_structure()
ElsLommelen Jul 18, 2022
97fe1aa
check_frontmatter terug toevoegen
ElsLommelen Jul 18, 2022
a92f284
overbodige code in commentaar zetten
ElsLommelen Jul 18, 2022
bdf28e2
rename message protocol website to English
ElsLommelen Jul 18, 2022
78ddebe
voorlopige versies pushen om lege wd te hebben
ElsLommelen Jul 18, 2022
e4cf9f6
test checklist::clean_git()
ElsLommelen Jul 18, 2022
46ddfbf
test of interactive() de zaak oplost
ElsLommelen Jul 19, 2022
d741c91
testen of 2 checks na mekaar werkt
ElsLommelen Jul 19, 2022
6c74577
nieuwe test
ElsLommelen Jul 19, 2022
a87bdf6
Merge branch 'renv-setup' into docker-setup
ElsLommelen Jul 19, 2022
30052ac
check_frontmatter() testen i.p.v. tweemaal check_structure()
ElsLommelen Jul 19, 2022
ca06635
trycatch in check_all.R
ElsLommelen Jul 19, 2022
522eb00
check_all.R: output layout issue
ElsLommelen Jul 19, 2022
92bfb47
rewrite check_all as function
ElsLommelen Jul 19, 2022
34a9e36
add function check_all() to file check_all
ElsLommelen Jul 19, 2022
829165c
correct drop of error message
ElsLommelen Jul 19, 2022
58adefc
eventjes imiteren dat we niet interactief bezig zijn
ElsLommelen Jul 19, 2022
5406827
en hu is het hopelijk echt in orde...
ElsLommelen Jul 19, 2022
34a3f6e
verwijder enter die toch niet werkt
ElsLommelen Jul 20, 2022
dd2329b
verwijder weergave inhoud map
ElsLommelen Jul 20, 2022
8ddb273
nu entrypoint_update testen
ElsLommelen Jul 20, 2022
80a66b3
render_release is interne functie geworden
ElsLommelen Jul 20, 2022
87be7bc
oeps, verkeerde file gecommit... hier de juiste
ElsLommelen Jul 20, 2022
667ceb9
Merge branch 'renv-setup' into docker-setup
ElsLommelen Jul 25, 2022
0943329
gebruik rocker/verse voor installatie van R (nieuwere versie nodig)
ElsLommelen Jul 26, 2022
4285032
verwijder overbodige (test)code
ElsLommelen Jul 26, 2022
ba9dd96
gebruik methode aangeraden door renv
ElsLommelen Jul 26, 2022
592faa8
packages zijn niet geïnstalleerd in container als renv::restore() hie…
ElsLommelen Jul 26, 2022
e33420f
ter info
ElsLommelen Jul 26, 2022
7504f21
renv_restore() ook toevoegen aan check docker
ElsLommelen Jul 27, 2022
46891fa
add function update_version_number() to check docker
ElsLommelen Jul 27, 2022
a32d9d7
testje voor merge naar main
ElsLommelen Jul 27, 2022
7b6665a
onafgewerkte yamls voorlopig even wegdoen
ElsLommelen Jul 27, 2022
bf90281
Merge pull request #1 from ElsLommelen/docker-setup
ElsLommelen Jul 27, 2022
4322f8f
yaml wat aanpassen
ElsLommelen Jul 27, 2022
6ceae5c
extra testjes om branchnaam te achterhalen
ElsLommelen Jul 27, 2022
2184c89
Merge pull request #2 from ElsLommelen/testbranch
ElsLommelen Jul 27, 2022
e2dddf3
nieuwe test
ElsLommelen Jul 27, 2022
5a2aeec
correctie
ElsLommelen Jul 27, 2022
18e1875
Merge branch 'main' into testbranch
ElsLommelen Jul 27, 2022
db3fc11
Merge pull request #3 from ElsLommelen/testbranch
ElsLommelen Jul 27, 2022
c8ee057
correcties
ElsLommelen Jul 27, 2022
5b67bb0
Merge pull request #4 from ElsLommelen/correctiebranch
ElsLommelen Jul 27, 2022
e842679
titeltest en overbodige rommel weg
ElsLommelen Jul 27, 2022
89e41e3
Merge pull request #5 from ElsLommelen/sfp444-nl
ElsLommelen Jul 27, 2022
e8860b0
undo handleiding door renv -> renv::restore() niet meer nodig voor en…
Jul 29, 2022
4dd57c4
renv::restore() verwijderen in entrypoint_check, inclusief aanpassing…
Jul 29, 2022
c14c790
current version of entrypoint_website.sh
Jul 29, 2022
491157e
entrypoint_website: neem tag van protocols over van protocolsource
Aug 4, 2022
d0ad6bd
load library to get error in docker if loading fails
Aug 4, 2022
4a1cc18
Bumped 2021.01 to 2022.01 in index.Rmd
Aug 4, 2022
ac839e5
update .zenodo.json
Aug 4, 2022
4e28ac6
update general NEWS.md
Aug 4, 2022
5b5595a
verduidelijking in build_push.sh
Aug 22, 2022
3890ec4
correction
Aug 22, 2022
672fb3f
change and clean dockerfile
Aug 22, 2022
b6813d1
Merge branch 'dockertests' of github.com:ElsLommelen/protocolsource i…
Aug 22, 2022
b8cba68
change version number to test function update_version_number()
ElsLommelen Sep 5, 2022
199e286
Merge branch 'renv-setup' into dockertests
ElsLommelen Sep 8, 2022
3ecd59a
ignore superfluous code (due to update of protocolhelper)
ElsLommelen Sep 8, 2022
c72e145
test GHA
ElsLommelen Sep 22, 2022
8f45411
nog wat extra info toegevoegd aan kladbestandje build_push.sh
ElsLommelen Sep 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
.Rproj.user
publish
src
renv/library
25 changes: 25 additions & 0 deletions .github/workflows/test_refs_PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Env var on PR

on:
pull_request:
branches:
- main

jobs:
build-website:
runs-on: ubuntu-latest
name: "test env var in PR"
env:
GITHUB_PAT: ${{ secrets.GITHUB_PAT }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: test
run: |
echo 'GitHub actions:' $GITHUB_ACTIONS
echo 'Event name:' $GITHUB_EVENT_NAME
echo 'ref:' $GITHUB_REF
echo 'ref name:' $GITHUB_REF_NAME
echo 'base ref:' $GITHUB_BASE_REF
echo 'head ref:' $GITHUB_HEAD_REF
echo 'repo:' $GITHUB_REPOSITORY
23 changes: 23 additions & 0 deletions .github/workflows/update-website-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: On merge to main, build the protocol and add it to the website "Log RECENT_MERGED_BRANCH_NAME"

on:
push:
branches:
- main

jobs:
build-website:
runs-on: ubuntu-latest
name: "add protocol to website"
env:
GITHUB_PAT: ${{ secrets.GITHUB_PAT }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- uses: tonynguyenit18/github-action-custom-vars@v1
- name: test
run: |
echo 'GitHub actions:' $GITHUB_ACTIONS
echo 'Event name:' $GITHUB_EVENT_NAME
echo 'ref:' $GITHUB_REF
echo 'recent merged branch:' $RECENT_MERGED_BRANCH_NAME
76 changes: 38 additions & 38 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
{
"title": "Source code of protocols of the Research Institute for Nature and Forest (INBO)",
"description": "This archive provides the source code of protocols used at the Research Institute for Nature and Forest (INBO), Brussels, Belgium (<a href=\"https://www.inbo.be/en\">www.inbo.be</a>). The protocols are written in R markdown and are compiled as html using the bookdown package. The website with the compiled protocols (including older versions) is at <a href=\"https://protocols.inbo.be\">https://protocols.inbo.be</a>.",
"license": "cc-by",
"upload_type": "other",
"access_right": "open",
"creators": [
{
"name": "Van Calster, Hans",
"affiliation": "Research Institute for Nature and Forest",
"orcid": "0000-0001-8595-8426"
},
{
"name": "De Bie, Els",
"affiliation": "Research Institute for Nature and Forest",
"orcid": "0000-0001-7679-743X"
},
{
"name": "Onkelinx, Thierry",
"affiliation": "Research Institute for Nature and Forest",
"orcid": "0000-0001-8804-4216"
},
{
"name": "Vanderhaeghe, Floris",
"affiliation": "Research Institute for Nature and Forest",
"orcid": "0000-0002-6378-6229"
}
],
"keywords": [
"open protocol",
"open science",
"research institute",
"nature",
"forest",
"environment",
"markdown",
"Flanders",
"Belgium"
]
"title": "Source code of protocols of the Research Institute for Nature and Forest (INBO)",
"description": "This archive provides the source code of protocols used at the Research Institute for Nature and Forest (INBO), Brussels, Belgium (<a href=\"https://www.inbo.be/en\">www.inbo.be<\/a>). The protocols are written in R markdown and are compiled as html using the bookdown package. The website with the compiled protocols (including older versions) is at <a href=\"https://protocols.inbo.be\">https://protocols.inbo.be<\/a>.",
"license": "cc-by",
"upload_type": "other",
"access_right": "open",
"creators": [
{
"name": "Van Calster, Hans",
"affiliation": "Research Institute for Nature and Forest",
"orcid": "0000-0001-8595-8426"
},
{
"name": "De Bie, Els",
"affiliation": "Research Institute for Nature and Forest",
"orcid": "0000-0001-7679-743X"
},
{
"name": "Onkelinx, Thierry",
"affiliation": "Research Institute for Nature and Forest",
"orcid": "0000-0001-8804-4216"
},
{
"name": "Vanderhaeghe, Floris",
"affiliation": "Research Institute for Nature and Forest",
"orcid": "0000-0002-6378-6229"
}
],
"keywords": [
"open protocol",
"open science",
"research institute",
"nature",
"forest",
"environment",
"markdown",
"Flanders",
"Belgium"
]
}
97 changes: 97 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
FROM rocker/verse

ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="RStable" \
org.label-schema.description="A docker image with stable versions of R and a bunch of packages used to check and publish protocols." \
org.label-schema.license="MIT" \
org.label-schema.url="e.g. https://www.inbo.be/" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/inbo/protocolsource" \
org.label-schema.vendor="Research Institute for Nature and Forest" \
maintainer="Hans Van Calster <hans.vancalster@inbo.be>"

## for apt to be noninteractive
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true

## Install nano
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
nano

COPY docker/Rprofile.site $R_HOME/etc/Rprofile.site

## Install wget
#RUN apt-get update \
# && apt-get install -y --no-install-recommends \
# wget

## Install pandoc
RUN wget https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb \
&& dpkg -i pandoc-2.7.3-1-amd64.deb \
&& rm pandoc-2.7.3-1-amd64.deb

## Install git depencencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
# git \
openssh-client

## Install curl dependencies
#RUN apt-get update \
# && apt-get install -y --no-install-recommends \
# libcurl4-openssl-dev

## Install ggplot2 dependencies
#RUN apt-get update \
# && apt-get install -y --no-install-recommends \
# libfreetype6-dev

## Install rgdal dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
gdal-bin \
libgdal-dev \
libproj-dev \
proj-bin

## Install openssl dependencies
#RUN apt-get update \
# && apt-get install -y --no-install-recommends \
# libssl-dev

## Install systemfonts dependencies
#RUN apt-get update \
# && apt-get install -y --no-install-recommends \
# libfontconfig1-dev

## Install textshaping dependencies
#RUN apt-get update \
# && apt-get install -y --no-install-recommends \
# libharfbuzz-dev libfribidi-dev

## Install V8 dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libv8-dev

## Install xml2 dependencies
#RUN apt-get update \
# && apt-get install -y --no-install-recommends \
# libxml2-dev

WORKDIR /github/workspace

RUN R -e "install.packages('renv', repos = c(CRAN = 'https://cloud.r-project.org'))"
RUN R -e "renv::consent(provided = TRUE)"
COPY renv.lock renv.lock
RUN R -e "renv::restore()"
RUN R -e "renv::isolate()"

COPY docker/entrypoint_website.sh /entrypoint_website.sh
COPY docker/entrypoint_update.sh /entrypoint_update.sh
COPY docker/entrypoint_check.sh /entrypoint_check.sh

ENTRYPOINT ["/entrypoint_check.sh"]
7 changes: 6 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Version 2022.01

- Protocol code: sfp-401-nl
- Title: Klassieke vegetatieopname in een proefvlak aan de hand van visuele inschattingen van bedekking van soorten in (semi-)terrestrische vegetatie

<!--One entry for each release describing the generic changes since the previous release.
e.g. (sort most recent first)

Expand All @@ -8,4 +13,4 @@ e.g. (sort most recent first)
- sfp-402_shorttitle_nl (update)
- 2020.01
- sfp-402_shorttitle_nl (first version)
-->
-->
47 changes: 47 additions & 0 deletions build_push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#to be used on protocolsource (change entrypoint below in Dockerfile to run other parts)

docker build --tag=inbo/protocols .

#entrypoint_check
docker run --rm --env GITHUB_REPOSITORY="ElsLommelen/protocolsource" --env BRANCH_SOURCE="dockertests" --env PROTOCOL_CODE="sfp-401-nl" --env INPUT_TOKEN inbo/protocols
#INPUT_TOKEN is als omgevingsvariabele toegevoegd op laptop

#entrypoint_update
docker run --rm --env GITHUB_REPOSITORY="ElsLommelen/protocolsource" --env BRANCH_SOURCE="dockertests" --env PROTOCOL_CODE="sfp-401-nl" --env INPUT_TOKEN inbo/protocols

#entrypoint_website
docker run --rm --env GITHUB_REPOSITORY_SOURCE="ElsLommelen/protocolsource" --env BRANCH_SOURCE="dockertests" --env GITHUB_REPOSITORY_DEST="ElsLommelen/protocols" --env INPUT_TOKEN --env GITHUB_ACTIONS=true --env GITHUB_EVENT_NAME=push --env GITHUB_REF=refs/heads/main --env PROTOCOL_CODE="sfp-401-nl" inbo/protocols



#examples
docker build --no-cache --tag=inbobmk/checklist .

docker build --tag=inbobmk/checklist .

docker push inbobmk/checklist

# run on branch
docker run --rm --env GITHUB_REPOSITORY="inbo/checklist" --env GITHUB_SHA=$(git rev-parse HEAD) --env INPUT_TOKEN=$GITHUB_PAT --env INPUT_PATH="." --env ORCID_TOKEN=$ORCID_TOKEN --env CODECOV_TOKEN=$CODECOV_TOKEN inbobmk/checklist
docker run --rm -it --entrypoint=/bin/bash --env GITHUB_REPOSITORY="inbo/checklist" --env GITHUB_SHA=$(git rev-parse HEAD) --env INPUT_TOKEN=$GITHUB_PAT --env INPUT_PATH="." --env ORCID_TOKEN=$ORCID_TOKEN --env CODECOV_TOKEN=$CODECOV_TOKEN inbobmk/checklist

# run on main
docker run --rm --env GITHUB_REPOSITORY="inbo/checklist" --env GITHUB_SHA=$(git rev-parse HEAD) --env GITHUB_PAT=$GITHUB_PAT --env INPUT_PATH="." --env ORCID_TOKEN=$ORCID_TOKEN --env CODECOV_TOKEN=$CODECOV_TOKEN --env GITHUB_ACTIONS=true --env GITHUB_EVENT_NAME=push --env GITHUB_REF=refs/heads/main inbobmk/checklist



#zinvolle env uit github
GITHUB_BASE_REF: name of target branch of the PR
GITHUB_EVENT_NAME: name of the event that triggered the workflow run
GITHUB_HEAD_REF: source branch of the PR
GITHUB_REF: full ref of branch or tag that triggered the workflow run (best niet gebruiken bij PR)
GITHUB_REF_NAME: short ref name of branch or tag that triggered the workflow run
GITHUB_REPOSITORY: owner and repository name, bv. inbo/protocolsource

#aan te passen env
BRANCH_SOURCE (on PR) -> GITHUB_HEAD_REF
BRANCH_SOURCE (on push) -> GITHUB_REF_NAME
PROTOCOL_CODE -> BRANCH_SOURCE (zie hierboven)
INPUT_TOKEN???
GITHUB_REPOSITORY_SOURCE -> GITHUB_REPOSITORY
GITHUB_REPOSITORY_DEST: meegeven als env!
48 changes: 48 additions & 0 deletions docker/Rprofile.site
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
options(
papersize = "a4",
tab.width = 2,
width = 80,
help_type = "html",
keep.source.pkgs = TRUE,
xpinch = 300,
ypinch = 300,
yaml.eval.expr = TRUE,
repos = c(
CRAN = "https://cloud.r-project.org/",
INLA = "https://inla.r-inla-download.org/R/stable",
inbo = "https://inbo.r-universe.dev"
),
install.packages.check.source = "yes",
install.packages.compile.from.source = "always",
inbo_required = c("checklist", "fortunes", "remotes", "INBOmd", "INBOtheme")
)

if ("checklist" %in% rownames(utils::installed.packages())) {
options(
lintr.linter_file = system.file("lintr", package = "checklist")
)
}

if (
interactive() &&
!all(getOption("inbo_required") %in% rownames(utils::installed.packages()))
) {
warning(
c(
"\n",
rep("^", getOption("width")),
"\nThis R installation lacks some required INBO packages.",
"\nPlease install them using the code below:\n",
"\ninstall.packages(c(",
paste0(
"\"",
getOption("inbo_required")[
!getOption("inbo_required") %in% rownames(utils::installed.packages())
],
"\"", collapse = ", "
),
"))\n\n",
rep("^", getOption("width"))
)
)
}
20 changes: 20 additions & 0 deletions docker/check_all.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# bundled checks for protocols
library(protocolhelper)
check_all <- function(protocol_code) {
#protocol_code <- Sys.getenv("PROTOCOL_CODE")
fail <- FALSE
tryCatch(
protocolhelper::check_frontmatter(protocol_code),
error = function(e) e,
finally = fail <- TRUE
)
tryCatch(
protocolhelper::check_structure(protocol_code),
error = function(e) e,
finally = fail <- TRUE
)
if (fail) {
stop("\nThe source code failed some checks. Please check the error message above.\n")
}
}
check_all(Sys.getenv("PROTOCOL_CODE"))
Loading