Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 1 | # use the verse rocker image, as it contains tidyverse, devtools and some texlive |
Marc Kupietz | d0e1b3a | 2023-06-16 15:12:25 +0200 | [diff] [blame] | 2 | image: rocker/tidyverse |
Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 3 | |
| 4 | # define stages of runner. at the moment, |
| 5 | # just build (no test or deploy). |
| 6 | stages: |
| 7 | - build |
| 8 | |
Marc Kupietz | f0eeb46 | 2024-05-31 16:13:55 +0200 | [diff] [blame] | 9 | variables: |
| 10 | SOURCE_FILE: "inst/rmarkdown/templates/posterdown_ids/skeleton/skeleton.Rmd" |
Marc Kupietz | 18a120c | 2024-04-30 21:04:33 +0200 | [diff] [blame] | 11 | # CHROME_VERSION: "114.0.5735.198-1" |
| 12 | |
Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 13 | build-job: |
| 14 | stage: build |
| 15 | |
| 16 | cache: |
| 17 | key: icc |
| 18 | paths: |
| 19 | - ./cache |
| 20 | |
| 21 | artifacts: |
| 22 | paths: |
| 23 | - "target/*" |
Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 24 | 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 Kupietz | e2d5d23 | 2024-05-29 18:25:00 +0200 | [diff] [blame] | 29 | - 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 |
Marc Kupietz | d0e1b3a | 2023-06-16 15:12:25 +0200 | [diff] [blame] | 30 | - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb |
| 31 | - dpkg -i google-chrome-stable_current_amd64.deb || apt-get install -y -f |
Marc Kupietz | 18a120c | 2024-04-30 21:04:33 +0200 | [diff] [blame] | 32 | # - wget http://mirror.cs.uchicago.edu/google-chrome/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb |
| 33 | # - dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb || apt-get install -y -f |
Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 34 | - locale-gen de_DE.utf8 en_GB.utf8 en_US.utf8 |
| 35 | - end_section install_linux_packages |
| 36 | |
Marc Kupietz | d0e1b3a | 2023-06-16 15:12:25 +0200 | [diff] [blame] | 37 | - 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 Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 42 | - start_section install_fonts "Installing Libertinus and Fira fonts" |
| 43 | - wget -O- https://github.com/mozilla/Fira/archive/refs/tags/4.202.tar.gz | tar -C /usr/share/fonts -zx --wildcards "*.otf" |
| 44 | - fc-cache |
| 45 | - end_section install_fonts |
| 46 | |
Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 47 | - start_section install_r_packages "Installing missing R packages" |
Marc Kupietz | d69b9fa | 2024-05-02 12:46:35 +0200 | [diff] [blame] | 48 | - echo -e 'local({r <- getOption("repos")\n r["CRAN"] <- "https://cloud.r-project.org"\n options(repos=r)})' > ~/.Rprofile |
| 49 | - echo "options(Ncpus=$(nproc))" >> ~/.Rprofile |
Marc Kupietz | 8945875 | 2024-05-02 12:17:46 +0200 | [diff] [blame] | 50 | - R -e "install.packages(c('devtools', 'scales', 'sp', 'raster', 'kableExtra', 'DT', 'svglite', 'qrcode'), dependencies=TRUE)" |
| 51 | - R -e 'devtools::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/idsThemeR", dependencies=TRUE)' |
| 52 | - R -e 'devtools::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/posterdown", dependencies=TRUE)' |
Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 53 | - end_section install_r_packages |
| 54 | |
| 55 | script: |
Marc Kupietz | a39d0cc | 2024-05-31 12:45:45 +0200 | [diff] [blame] | 56 | - start_section installing "Installing posterdown.ids" |
Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 57 | - R -e 'devtools::install()' |
| 58 | - end_section installing |
| 59 | - start_section render "Generating demo artifacts" |
Marc Kupietz | f0eeb46 | 2024-05-31 16:13:55 +0200 | [diff] [blame] | 60 | - R_CACHE_ROOTPATH=./cache R -e "require(rmarkdown); render('$SOURCE_FILE', output_format='posterdown.ids::posterdown_ids', output_dir='target')" |
| 61 | - export SVG=target/$(basename $SOURCE_FILE .Rmd).svg |
| 62 | - export HTML=target/$(basename $SOURCE_FILE .Rmd).html |
| 63 | - export PDF=target/$(basename $SOURCE_FILE .Rmd).pdf |
| 64 | - ./ci/html2pdf $HTML $PDF 1 |
| 65 | - inkscape -b white --pdf-poppler -o $SVG $PDF || true |
| 66 | - scour -i $SVG -o target/skeleton_optimized.svg --enable-viewboxing --enable-id-stripping --shorten-ids --indent=none |
Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 67 | - end_section render |
| 68 | |