Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up CI with Azure Pipelines #158

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
1 change: 0 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
^data$
^doc$
^man-roxygen$
^Meta$
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ vignettes/*.pdf
*.knit.md
.Rproj.user
# data files created through `configure`
data/*.rda
# data/*.rda
# keep it here, this strategy got broken in Spring 2021, see e.g.:
# https://stackoverflow.com/questions/66860659/lazydata-is-specified-without-a-data-directory-error-when-submitting-r-packa
# note: at the same time, it has also become necessary to NOT exclude the data directory in .Rbuildignore.
# https://stat.ethz.ch/R-manual/R-devel/doc/manual/R-exts.html#Checking-and-building-packages
23 changes: 18 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
FROM rocker/r-ver:3.5.3
FROM rocker/r-ver:4.2.3
## Ubuntu 22.04 jammy
# -> don't use latest R release, since that will keep getting linked with later build-dates and RStudio packagemanager
# -> sets repository to RStudio packagemanager for specific build date of R version, being 2023-04-20 for R 4.2.3
# (see https://github.com/rocker-org/rocker-versioned2/blob/master/dockerfiles/r-ver_4.2.3.Dockerfile for reference)
# -> installs R to /usr/local/lib/R

# libnode-dev ?
# graphics Cairo: libcairo2-dev libxt-dev
# apt-utils
## Install required dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand All @@ -23,19 +31,24 @@ RUN apt-get update \
# - https://pandoc.org/installing.html#linux
# We should use the same version as in rocker/rstudio:<R_VER>
# docker run --rm rocker/rstudio:<R_VER> /usr/lib/rstudio-server/bin/pandoc/pandoc -v
# RSc: TODO: need to check and update pandoc version here
RolandASc marked this conversation as resolved.
Show resolved Hide resolved
ENV PANDOC_DEB="2.3.1/pandoc-2.3.1-1-amd64.deb"
COPY docker/install_pandoc.sh .
RUN sh install_pandoc.sh $PANDOC_DEB && rm install_pandoc.sh

## Install TinyTeX as LaTeX installation
COPY docker/install_tinytex.sh .
# - Use a version-stable tlnet archive CTAN repo from texlive.info
# - here we consider the frozen TeXLive 2016 snapshot, corresponding to the TeXLive release
# shipped as texlive-* in Debian stretch (base image for the rocker/verse currently used)
# - note that https was not supported in TeXLive 2016 for the CTAN repository
ENV CTAN_REPO=http://www.texlive.info/tlnet-archive/2017/04/13/tlnet
# - here we consider a frozen TeXLive snapshot, corresponding to the TeXLive
# release shipped as texlive-* in Ubuntu 22.04 jammy (2021.20220204-1: all)
ENV CTAN_REPO=https://www.texlive.info/tlnet-archive/2022/02/04/tlnet
# rocker/verse:4.2.3 would pick texlive rather than tinytex, with the following vars:
# ENV CTAN_REPO=https://www.texlive.info/tlnet-archive/2023/04/20/tlnet
# ENV PATH=$PATH:/usr/local/texlive/bin/linux

# - It is important to also install all required LaTeX packages when building the image
RUN sh install_tinytex.sh fancyhdr

## Script for re-installation of TinyTeX in the running container
# - needed if at a certain point the "Remote repository is newer than local",
# for non-version-stable TinyTeX installations
Expand Down
40 changes: 40 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Docker
# Build and push an image to Azure Container Registry
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker

trigger:
- develop

resources:
- repo: self

variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: '6284f62b-b5ab-43fb-a236-b29ffaaada8e'
imageRepository: 'smarp'
containerRegistry: 'miraiappregistry.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
tag: '$(Build.BuildId)'

# Agent VM image name
vmImageName: 'ubuntu-latest'

stages:
- stage: Build
displayName: Build and push stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
latest
Binary file added data/IB.rda
Binary file not shown.
Binary file added data/VM.rda
Binary file not shown.
8 changes: 5 additions & 3 deletions docker/install_tinytex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
# - ghostscript (for pdfcrop)

## Admin-based install of TinyTeX:
install2.r --error --skipinstalled tinytex \
&& wget -qO- \
"https://github.com/yihui/tinytex/raw/master/tools/install-unx.sh" | \
install2.r --error --skipinstalled tinytex

wget -qO- \
"https://github.com/rstudio/tinytex/raw/main/tools/install-unx.sh" | \
sh -s - --admin --no-path \
&& mv ~/.TinyTeX /opt/TinyTeX \
&& /opt/TinyTeX/bin/*/tlmgr path add

## LaTeX packages from rocker/verse and app-specific packages passed as arguments
tlmgr install \
ae inconsolata listings metafont mfware pdfcrop parskip tex \
Expand Down
4 changes: 3 additions & 1 deletion tools/config/cleanup.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Clean up files generated during configuration here.
# Use 'remove_file()' to remove files generated during configuration.

unlink("data", recursive = TRUE)
# unlink("data", recursive = TRUE)
# keep it here, this strategy got broken in Spring 2021, see e.g.:
# https://stackoverflow.com/questions/66860659/lazydata-is-specified-without-a-data-directory-error-when-submitting-r-packa