blob: 657f16c2e550a055b3c73d0e317101159cbc172c [file] [log] [blame]
Marc Kupietzce1aa0c2023-06-15 07:50:23 +02001# use the verse rocker image, as it contains tidyverse, devtools and some texlive
Marc Kupietzd0e1b3a2023-06-16 15:12:25 +02002image: rocker/tidyverse
Marc Kupietzce1aa0c2023-06-15 07:50:23 +02003
4# define stages of runner. at the moment,
5# just build (no test or deploy).
6stages:
7 - build
8
Marc Kupietzf0eeb462024-05-31 16:13:55 +02009variables:
10 SOURCE_FILE: "inst/rmarkdown/templates/posterdown_ids/skeleton/skeleton.Rmd"
Marc Kupietz18a120c2024-04-30 21:04:33 +020011# CHROME_VERSION: "114.0.5735.198-1"
12
Marc Kupietzce1aa0c2023-06-15 07:50:23 +020013build-job:
14 stage: build
15
16 cache:
17 key: icc
18 paths:
19 - ./cache
20
21 artifacts:
22 paths:
23 - "target/*"
Marc Kupietzce1aa0c2023-06-15 07:50:23 +020024 before_script:
25 - source `find .. -name section_helper.sh`
26
27 - start_section install_linux_packages "Installing missing Linux packages"
28 - apt-get update
Marc Kupietz78b08712025-02-02 22:10:18 +010029 - apt-get install -y curl 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
30 - curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
Marc Kupietzd0e1b3a2023-06-16 15:12:25 +020031 - dpkg -i google-chrome-stable_current_amd64.deb || apt-get install -y -f
Marc Kupietz78b08712025-02-02 22:10:18 +010032# - curl -O http://mirror.cs.uchicago.edu/google-chrome/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
Marc Kupietz18a120c2024-04-30 21:04:33 +020033# - dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb || apt-get install -y -f
Marc Kupietzce1aa0c2023-06-15 07:50:23 +020034 - locale-gen de_DE.utf8 en_GB.utf8 en_US.utf8
35 - end_section install_linux_packages
36
Marc Kupietzd0e1b3a2023-06-16 15:12:25 +020037 - start_section testing_chromium "Testing chromium PDF export"
38 - ./ci/html2pdf https://google.com test.pdf 1
39 - ls -l ./test.pdf
40 - end_section testing_chromium
41
Marc Kupietzce1aa0c2023-06-15 07:50:23 +020042 - start_section install_fonts "Installing Libertinus and Fira fonts"
Marc Kupietz78b08712025-02-02 22:10:18 +010043 - curl -Ls https://github.com/mozilla/Fira/archive/refs/tags/4.202.tar.gz | tar -C /usr/share/fonts -zx --wildcards "*.otf"
Marc Kupietzce1aa0c2023-06-15 07:50:23 +020044 - fc-cache
45 - end_section install_fonts
46
Marc Kupietzce1aa0c2023-06-15 07:50:23 +020047 - start_section install_r_packages "Installing missing R packages"
Marc Kupietz78b08712025-02-02 22:10:18 +010048# - echo -e 'local({r <- getOption("repos")\n r["CRAN"] <- "https://cloud.r-project.org"\n options(repos=r)})' > ~/.Rprofile
Marc Kupietzd69b9fa2024-05-02 12:46:35 +020049 - echo "options(Ncpus=$(nproc))" >> ~/.Rprofile
Marc Kupietz78b08712025-02-02 22:10:18 +010050 - R -e "install.packages('pak', dependencies=TRUE)"
51 - R -e "pak::pak(c('devtools', 'scales', 'sp', 'raster', 'kableExtra', 'DT', 'svglite', 'qrcode', 'posterdown'))"
Marc Kupietz89458752024-05-02 12:17:46 +020052 - R -e 'devtools::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/idsThemeR", dependencies=TRUE)'
53 - R -e 'devtools::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/posterdown", dependencies=TRUE)'
Marc Kupietzce1aa0c2023-06-15 07:50:23 +020054 - end_section install_r_packages
55
56 script:
Marc Kupietza39d0cc2024-05-31 12:45:45 +020057 - start_section installing "Installing posterdown.ids"
Marc Kupietzce1aa0c2023-06-15 07:50:23 +020058 - R -e 'devtools::install()'
59 - end_section installing
60 - start_section render "Generating demo artifacts"
Marc Kupietzf0eeb462024-05-31 16:13:55 +020061 - R_CACHE_ROOTPATH=./cache R -e "require(rmarkdown); render('$SOURCE_FILE', output_format='posterdown.ids::posterdown_ids', output_dir='target')"
62 - export SVG=target/$(basename $SOURCE_FILE .Rmd).svg
63 - export HTML=target/$(basename $SOURCE_FILE .Rmd).html
64 - export PDF=target/$(basename $SOURCE_FILE .Rmd).pdf
65 - ./ci/html2pdf $HTML $PDF 1
66 - inkscape -b white --pdf-poppler -o $SVG $PDF || true
67 - scour -i $SVG -o target/skeleton_optimized.svg --enable-viewboxing --enable-id-stripping --shorten-ids --indent=none
Marc Kupietzce1aa0c2023-06-15 07:50:23 +020068 - end_section render
69