| # use the verse rocker image, as it contains tidyverse, devtools and some texlive |
| image: rocker/tidyverse |
| |
| # define stages of runner. at the moment, |
| # just build (no test or deploy). |
| stages: |
| - build |
| |
| variables: |
| SOURCE_FILE: "inst/rmarkdown/templates/posterdown_ids/skeleton/skeleton.Rmd" |
| # CHROME_VERSION: "114.0.5735.198-1" |
| |
| build-job: |
| stage: build |
| |
| cache: |
| key: icc |
| paths: |
| - ./cache |
| |
| artifacts: |
| paths: |
| - "target/*" |
| before_script: |
| - source `find .. -name section_helper.sh` |
| |
| - start_section install_linux_packages "Installing missing Linux packages" |
| - apt-get update |
| - apt-get install -y libvulkan1 libu2f-udev fonts-liberation build-essential libglpk40 libcurl4-gnutls-dev libxml2-dev libsodium-dev libsecret-1-dev libfontconfig1-dev libssl-dev libxt6 libpq-dev imagemagick inkscape scour poppler-utils fonts-stix |
| - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb |
| - dpkg -i google-chrome-stable_current_amd64.deb || apt-get install -y -f |
| # - wget http://mirror.cs.uchicago.edu/google-chrome/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb |
| # - dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb || apt-get install -y -f |
| - locale-gen de_DE.utf8 en_GB.utf8 en_US.utf8 |
| - end_section install_linux_packages |
| |
| - start_section testing_chromium "Testing chromium PDF export" |
| - ./ci/html2pdf https://google.com test.pdf 1 |
| - ls -l ./test.pdf |
| - end_section testing_chromium |
| |
| - start_section install_fonts "Installing Libertinus and Fira fonts" |
| - wget -O- https://github.com/mozilla/Fira/archive/refs/tags/4.202.tar.gz | tar -C /usr/share/fonts -zx --wildcards "*.otf" |
| - fc-cache |
| - end_section install_fonts |
| |
| - start_section install_r_packages "Installing missing R packages" |
| - echo -e 'local({r <- getOption("repos")\n r["CRAN"] <- "https://cloud.r-project.org"\n options(repos=r)})' > ~/.Rprofile |
| - echo "options(Ncpus=$(nproc))" >> ~/.Rprofile |
| - R -e "install.packages(c('devtools', 'scales', 'sp', 'raster', 'kableExtra', 'DT', 'svglite', 'qrcode'), dependencies=TRUE)" |
| - R -e 'devtools::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/idsThemeR", dependencies=TRUE)' |
| - R -e 'devtools::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/posterdown", dependencies=TRUE)' |
| - end_section install_r_packages |
| |
| script: |
| - start_section installing "Installing posterdown.ids" |
| - R -e 'devtools::install()' |
| - end_section installing |
| - start_section render "Generating demo artifacts" |
| - R_CACHE_ROOTPATH=./cache R -e "require(rmarkdown); render('$SOURCE_FILE', output_format='posterdown.ids::posterdown_ids', output_dir='target')" |
| - export SVG=target/$(basename $SOURCE_FILE .Rmd).svg |
| - export HTML=target/$(basename $SOURCE_FILE .Rmd).html |
| - export PDF=target/$(basename $SOURCE_FILE .Rmd).pdf |
| - ./ci/html2pdf $HTML $PDF 1 |
| - inkscape -b white --pdf-poppler -o $SVG $PDF || true |
| - scour -i $SVG -o target/skeleton_optimized.svg --enable-viewboxing --enable-id-stripping --shorten-ids --indent=none |
| - end_section render |
| |