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 | 18a120c | 2024-04-30 21:04:33 +0200 | [diff] [blame] | 9 | # variables: |
| 10 | # CHROME_VERSION: "114.0.5735.198-1" |
| 11 | |
Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 12 | build-job: |
| 13 | stage: build |
| 14 | |
| 15 | cache: |
| 16 | key: icc |
| 17 | paths: |
| 18 | - ./cache |
| 19 | |
| 20 | artifacts: |
| 21 | paths: |
| 22 | - "target/*" |
Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 23 | before_script: |
| 24 | - source `find .. -name section_helper.sh` |
| 25 | |
| 26 | - start_section install_linux_packages "Installing missing Linux packages" |
| 27 | - apt-get update |
Marc Kupietz | fb80dc5 | 2023-06-18 14:31:50 +0200 | [diff] [blame] | 28 | - 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 |
Marc Kupietz | d0e1b3a | 2023-06-16 15:12:25 +0200 | [diff] [blame] | 29 | - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb |
| 30 | - 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] | 31 | # - wget http://mirror.cs.uchicago.edu/google-chrome/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb |
| 32 | # - 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] | 33 | - locale-gen de_DE.utf8 en_GB.utf8 en_US.utf8 |
| 34 | - end_section install_linux_packages |
| 35 | |
Marc Kupietz | d0e1b3a | 2023-06-16 15:12:25 +0200 | [diff] [blame] | 36 | - start_section testing_chromium "Testing chromium PDF export" |
| 37 | - ./ci/html2pdf https://google.com test.pdf 1 |
| 38 | - ls -l ./test.pdf |
| 39 | - end_section testing_chromium |
| 40 | |
Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 41 | - start_section install_fonts "Installing Libertinus and Fira fonts" |
| 42 | - wget -O- https://github.com/mozilla/Fira/archive/refs/tags/4.202.tar.gz | tar -C /usr/share/fonts -zx --wildcards "*.otf" |
| 43 | - fc-cache |
| 44 | - end_section install_fonts |
| 45 | |
Marc Kupietz | ce1aa0c | 2023-06-15 07:50:23 +0200 | [diff] [blame] | 46 | - start_section install_r_packages "Installing missing R packages" |
Marc Kupietz | 3b69cbb | 2024-05-02 12:17:14 +0200 | [diff] [blame] | 47 | - echo "options(Ncpus=$(nproc))" > ~/.Rprofile |
Marc Kupietz | 8945875 | 2024-05-02 12:17:46 +0200 | [diff] [blame^] | 48 | - R -e "install.packages(c('devtools', 'scales', 'sp', 'raster', 'kableExtra', 'DT', 'svglite', 'qrcode'), dependencies=TRUE)" |
| 49 | - R -e 'devtools::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/idsThemeR", dependencies=TRUE)' |
| 50 | - 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] | 51 | - end_section install_r_packages |
| 52 | |
| 53 | script: |
| 54 | - start_section installing "Installing posterdown (ids)" |
| 55 | - R -e 'devtools::install()' |
| 56 | - end_section installing |
| 57 | - start_section render "Generating demo artifacts" |
| 58 | - R_CACHE_ROOTPATH=./cache R -e "require(rmarkdown); render('inst/rmarkdown/templates/posterdown_ids/skeleton/skeleton.Rmd', output_format='posterdown::posterdown_ids', output_dir='target')" |
| 59 | - ./ci/html2pdf target/skeleton.html target/skeleton.pdf 1 |
| 60 | - inkscape -b white --pdf-poppler -o target/skeleton.svg target/skeleton.pdf || true |
| 61 | - scour -i target/skeleton.svg -o target/skeleton_optimized.svg --enable-viewboxing --enable-id-stripping --shorten-ids --indent=none |
| 62 | - end_section render |
| 63 | |