| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 1 | # use the verse rocker image, as it contains tidyverse, remotes and some texlive |
| Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 2 | image: rocker/tidyverse |
| 3 | |
| 4 | # define stages of runner. at the moment, |
| 5 | # just build (no test or deploy). |
| 6 | stages: |
| 7 | - build |
| 8 | |
| 9 | build-job: |
| 10 | stage: build |
| 11 | |
| 12 | cache: |
| 13 | key: revealjs |
| 14 | paths: |
| 15 | - ./cache |
| 16 | |
| 17 | artifacts: |
| 18 | paths: |
| 19 | - "target/*" |
| Marc Kupietz | fbf254d | 2023-10-09 15:10:42 +0200 | [diff] [blame] | 20 | - "target/ids_files/*" |
| Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 21 | |
| 22 | before_script: |
| 23 | - source `find .. -name section_helper.sh` |
| Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 24 | - start_section install_linux_packages "Installing missing Linux packages" |
| 25 | - apt-get update |
| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 26 | - apt-get install -y libvulkan1 libu2f-udev fonts-liberation build-essential |
| 27 | libglpk40 libcurl4-gnutls-dev libxml2-dev libsodium-dev libsecret-1-dev |
| 28 | libfontconfig1-dev libssl-dev libxt6 libpq-dev imagemagick libnss3 |
| Marc Kupietz | 1212b87 | 2026-08-08 17:18:22 +0200 | [diff] [blame] | 29 | libuv1t64 libgbm-dev libxss1 libappindicator3-1 libasound2t64 |
| 30 | libatk-bridge2.0-0 libgtk-3-0 libnspr4 libnss3 libgbm-dev ca-certificates |
| 31 | curl gnupg |
| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 32 | - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | |
| 33 | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg |
| Marc Kupietz | 02d582a | 2023-10-09 20:11:52 +0200 | [diff] [blame] | 34 | - NODE_MAJOR=20 |
| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 35 | - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] |
| 36 | https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee |
| 37 | /etc/apt/sources.list.d/nodesource.list |
| Marc Kupietz | 02d582a | 2023-10-09 20:11:52 +0200 | [diff] [blame] | 38 | - apt-get update && apt-get install nodejs -y |
| 39 | - node --version |
| 40 | - npm install puppeteer |
| Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 41 | - locale-gen de_DE.utf8 en_GB.utf8 en_US.utf8 |
| Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 42 | - end_section install_linux_packages |
| 43 | |
| Marc Kupietz | 24a129b | 2023-10-10 14:04:32 +0200 | [diff] [blame] | 44 | - start_section setup_deployment "Setup deployment" |
| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 45 | - "command -v ssh-agent >/dev/null || apt-get install openssh-client -y" |
| Marc Kupietz | 24a129b | 2023-10-10 14:04:32 +0200 | [diff] [blame] | 46 | |
| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 47 | ## |
| 48 | ## Run ssh-agent (inside the build environment) |
| 49 | ## |
| Marc Kupietz | 24a129b | 2023-10-10 14:04:32 +0200 | [diff] [blame] | 50 | - eval $(ssh-agent -s) |
| 51 | |
| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 52 | ## |
| 53 | ## Give the right permissions, otherwise ssh-add will refuse to add files |
| 54 | ## Add the SSH key stored in SSH_PRIVATE_KEY file type CI/CD variable to the agent store |
| 55 | ## |
| Marc Kupietz | 24a129b | 2023-10-10 14:04:32 +0200 | [diff] [blame] | 56 | - chmod 400 "$SSH_PRIVATE_KEY" |
| 57 | - ssh-add "$SSH_PRIVATE_KEY" |
| 58 | |
| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 59 | ## |
| 60 | ## Create the SSH directory and give it the right permissions |
| 61 | ## |
| Marc Kupietz | 24a129b | 2023-10-10 14:04:32 +0200 | [diff] [blame] | 62 | - mkdir -p ~/.ssh |
| 63 | - chmod 700 ~/.ssh |
| 64 | - end_section setup_deployment |
| 65 | |
| Marc Kupietz | 02d582a | 2023-10-09 20:11:52 +0200 | [diff] [blame] | 66 | - start_section test_puppeteer "Testing puppeteer" |
| 67 | - ./ci/screenshot https://www.google.com /tmp/google.png |
| 68 | - end_section test_puppeteer |
| Marc Kupietz | fbf254d | 2023-10-09 15:10:42 +0200 | [diff] [blame] | 69 | |
| Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 70 | - start_section install_r_packages "Installing missing R packages" |
| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 71 | - R -e "install.packages(c('devtools', 'remotes', 'RKorAPClient', 'httr', |
| 72 | 'tidytext', 'httpuv', 'scales', 'sp', 'raster', 'kableExtra', 'DT', |
| 73 | 'svglite', 'qrcode', 'rsvg', 'highcharter'))" |
| Marc Kupietz | f432ef5 | 2026-08-28 14:03:21 +0300 | [diff] [blame] | 74 | # the CRAN RKorAPClient above pulls in its (compiled) dependencies as |
| 75 | # binaries; now replace the package itself with the git version, which |
| 76 | # has features not yet on CRAN (e.g. the cacheAs parameter of |
| 77 | # collocationAnalysis()) |
| 78 | - R -e |
| 79 | 'remotes::install_git("https://korap.ids-mannheim.de/gerrit/KorAP/RKorAPClient", |
| 80 | upgrade = "never")' |
| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 81 | - R -e |
| 82 | 'remotes::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/idsThemeR")' |
| Marc Kupietz | 2b548bc | 2023-10-09 07:21:59 +0200 | [diff] [blame] | 83 | - R -e 'devtools::install(".")' |
| Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 84 | - end_section install_r_packages |
| 85 | |
| 86 | script: |
| 87 | - start_section render "Running scripts" |
| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 88 | - R_CACHE_ROOTPATH=./cache R -e "require(rmarkdown); |
| 89 | render('examples/ids.Rmd', |
| Marc Kupietz | e195cea | 2026-08-17 13:17:33 +0200 | [diff] [blame] | 90 | output_format='revealjs.ids::revealjs_presentation', output_dir='target')" |
| Marc Kupietz | 02d582a | 2023-10-09 20:11:52 +0200 | [diff] [blame] | 91 | - ./ci/screenshot file://`pwd`/target/ids.html target/title.png |
| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 92 | file://`pwd`/target/ids.html#/light-verb-constructions target/lvc.png |
| 93 | file://`pwd`/target/ids.html#/registered-users target/users.png |
| 94 | file://`pwd`/target/ids.html#/references-1 target/references.png |
| Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 95 | - end_section render |
| Marc Kupietz | 24a129b | 2023-10-10 14:04:32 +0200 | [diff] [blame] | 96 | - start_section deploy "Deploying slides" |
| Marc Kupietz | e45ed91 | 2026-05-04 19:45:29 +0200 | [diff] [blame] | 97 | - scp -ro StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null |
| 98 | target/ids* |
| 99 | cowner@klinux10:/vol/work/kupietz/slides/2023-10-08-Revealjs-demo/ |