Skip to content

Commit

Permalink
Add quarto
Browse files Browse the repository at this point in the history
  • Loading branch information
cansavvy committed Mar 13, 2024
1 parent 7a7d663 commit 7874492
Show file tree
Hide file tree
Showing 10 changed files with 313 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,17 @@ jobs:
GH_PAT: ${{ secrets.GH_PAT }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

build-quarto:
name: Build quarto image
needs: dockerfiles-changed
if: ${{needs.dockerfiles-changed.outputs.quarto_changed == 'true'}}
uses: ./.github/workflows/docker-test.yml
with:
directory: ottr_quarto
tag: jhudsl/ottr_quarto
dockerhubpush: true
secrets:
GH_PAT: ${{ secrets.GH_PAT }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
21 changes: 20 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Candace Savonen May 2022
# Candace Savonen March 2024

name: Pull Request

Expand Down Expand Up @@ -41,17 +41,25 @@ jobs:
with:
files: ottr_python/*

- name: Get specific changed files
id: quarto
uses: tj-actions/[email protected]
with:
files: ottr_quarto/*

- run: |
echo ${{steps.base_ottr.outputs.any_changed}}
echo ${{steps.ottrpal.outputs.any_changed}}
echo ${{steps.bioconductor.outputs.any_changed}}
echo ${{steps.python.outputs.any_changed}}
echo ${{steps.quarto.outputs.any_changed}}
outputs:
base_ottr_changed: ${{steps.base_ottr.outputs.any_changed}}
ottrpal_changed: ${{steps.ottrpal.outputs.any_changed}}
bioconductor_changed: ${{steps.bioconductor.outputs.any_changed}}
python_changed: ${{steps.python.outputs.any_changed}}
quarto_changed: ${{steps.quarto.outputs.any_changed}}

build-base:
name: Build base ottr image
Expand Down Expand Up @@ -96,3 +104,14 @@ jobs:
tag: jhudsl/ottr_python
secrets:
GH_PAT: ${{ secrets.GH_PAT }}

build-quarto:
name: Build quarto ottr image
needs: dockerfiles-changed
if: ${{needs.dockerfiles-changed.outputs.quarto_changed == 'true'}}
uses: ./.github/workflows/docker-test.yml
with:
directory: ottr_quarto
tag: jhudsl/ottr_quarto
secrets:
GH_PAT: ${{ secrets.GH_PAT }}
1 change: 1 addition & 0 deletions base_ottr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ RUN Rscript -e "options(warn = 2);install.packages( \
'spelling', \
'styler', \
'reticulate', \
'gh', \
'tibble'), \
repos = 'https://cloud.r-project.org/')"

Expand Down
Binary file not shown.
67 changes: 67 additions & 0 deletions base_ottr/git_token.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
AnVIL
Audiographer
Audiography
automagic
BIPOC
Bloomberg
Bookdown
chapt
Coursera
creativecommons
css
Datatrail
DataTrail
DISCOVERABLE
Dockerfile
Dockerhub
dropdown
enforceability
faq
favicon
FirstName
Funder
fyi
GDSCN
Generis
GH
Github
GitHub
https
ies
iframe
immunities
impactful
ITCR
itcrtraining
ITN
LastName
Leanpub
Licensor
LICENSOR
Markua
mentorship
MERCHANTABILITY
Muschelli
NCI
NHGRI
OTTR
ottrpal
ottrproject
Pandoc
png
pre
reproducibility
rmarkdown
RMarkdown
Savonen
sexualized
socio
synched
tada
UE
UE5
underserved
Videographer
Videography
WIPO
www
84 changes: 84 additions & 0 deletions ottr_quarto/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
FROM rocker/tidyverse:4.0.2
LABEL maintainer="[email protected]"
WORKDIR /rocker-build/

COPY install_github.R .

# Install apt-getable packages to start
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils dialog
RUN apt-get install -y --no-install-recommends \
libxt6 \
libpoppler-cpp-dev \
vim \
libglpk40 \
curl \
gpg

# Install gh
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg;
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null;
RUN apt update && apt install -y gh;

# Remove old symlinks to old pandoc
RUN unlink /usr/lib/rstudio-server/bin/pandoc/pandoc

# Uninstall old version of pandoc
RUN sudo apt-get purge pandoc pandoc-citeproc pandoc-data \
&& sudo apt-get autoremove --purge

# Install pandoc
RUN wget https://github.com/jgm/pandoc/releases/download/2.14.1/pandoc-2.14.1-1-amd64.deb \
&& sudo apt-get install ./pandoc-2.14.1-1-amd64.deb

# Create new symlinks
RUN ln -s /usr/bin/pandoc /usr/lib/rstudio-server/bin/pandoc/pandoc

# Add curl, bzip2
RUN apt-get update -qq && apt-get -y --no-install-recommends install \
bzip2 \
curl

# Install pip3 and installation tools
RUN apt-get -y --no-install-recommends install \
python3-pip python3-dev

RUN Rscript -e "remove.packages('rlang')"

# Commonly used R packages
RUN Rscript -e "options(warn = 2);install.packages( \
c('rlang', \
'bookdown', \
'emojifont', \
'here', \
'leanpubr', \
'optparse', \
'oro.nifti', \
'qpdf', \
'R.utils', \
'rprojroot', \
'rgoogleslides', \
'servr', \
'spelling', \
'styler', \
'reticulate', \
'gh', \
'tibble'), \
repos = 'https://cloud.r-project.org/')"

# cow needs this dependency:
RUN Rscript -e "devtools::install_version('gitcreds', version = '0.1.1', repos = 'http://cran.us.r-project.org')"

# Copy over git token and package list
COPY git_token.txt .
COPY github_package_list.tsv .

# Install packages from github
RUN Rscript install_github.R \
--packages github_package_list.tsv \
--token git_token.txt

RUN curl -LO https://quarto.org/download/latest/quarto-linux-amd64.deb
RUN gdebi --non-interactive quarto-linux-amd64.deb

# Set final workdir for commands
WORKDIR /home/rstudio
Binary file not shown.
67 changes: 67 additions & 0 deletions ottr_quarto/git_token.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
AnVIL
Audiographer
Audiography
automagic
BIPOC
Bloomberg
Bookdown
chapt
Coursera
creativecommons
css
Datatrail
DataTrail
DISCOVERABLE
Dockerfile
Dockerhub
dropdown
enforceability
faq
favicon
FirstName
Funder
fyi
GDSCN
Generis
GH
Github
GitHub
https
ies
iframe
immunities
impactful
ITCR
itcrtraining
ITN
LastName
Leanpub
Licensor
LICENSOR
Markua
mentorship
MERCHANTABILITY
Muschelli
NCI
NHGRI
OTTR
ottrpal
ottrproject
Pandoc
png
pre
reproducibility
rmarkdown
RMarkdown
Savonen
sexualized
socio
synched
tada
UE
UE5
underserved
Videographer
Videography
WIPO
www
8 changes: 8 additions & 0 deletions ottr_quarto/github_package_list.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rstudio/rmarkdown 02d3c2512686fda9c14c2a0e300aa02525f16ca5
yihui/xfun 74c2a6605d8f0fb19314da542baeead6dc8697d9
yihui/knitr a1052d12e0ff8f4ead365b4c85ef5835faa1c492
jhudsl/ottrpal HEAD
tidyverse/rvest 4fe39fb5089512d77b6a9cc026e5c895258ff6ce
R-lib/testthat e99155af85261e065192feb946dcfa6679cffae4
rstudio/bookdown 88bc4ead8562ea281838041c795b38fc4a6a7165
jhudsl/cow HEAD
52 changes: 52 additions & 0 deletions ottr_quarto/install_github.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env Rscript

if (!"optparse" %in% installed.packages()) {
install.packages("optparse")
}

library(optparse)

################################ Set up options ################################
# Set up optparse options
option_list <- list(
make_option(
opt_str = c("-p", "--packages"), type = "character",
default = "github_package_list.tsv" ,
help = "Path to a TSV with a list of packages to be installed through Github,
where file where the first column is the github package name e.g.
jhudsl/ottrpal and the second column is the commit ID to be installed
(to be supplied to the ref argument).
",
metavar = "character"
),
make_option(
opt_str = c("--token"), type = "character",
default = NULL,
help = "GITHUB PAT file",
metavar = "character"
)
)

# Parse options
opt <- parse_args(OptionParser(option_list = option_list))

# Read in the token
token <- as.character(readLines(opt$token)[1])

# Reset GITHUB PAT to be token
Sys.unsetenv("GITHUB_PAT")
Sys.setenv(GITHUB_PAT = token)

# set up list of packages to install
packages <- readr::read_tsv(opt$packages,
col_names = c("package_name", "ref"))

purrr::pmap(
packages,
~remotes::install_github(..1,
auth_token = token,
ref = ..2)
)

# Remove the file after we are done
file.remove(opt$token)

0 comments on commit 7874492

Please sign in to comment.