Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 1 | # use the verse rocker image, as it contains tidyverse, devtools and some texlive |
| 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 | 02d582a | 2023-10-09 20:11:52 +0200 | [diff] [blame] | 26 | - 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 libnss3 libgbm-dev libxss1 libappindicator3-1 libasound2 libatk-bridge2.0-0 libgtk-3-0 libnspr4 libnss3 libgbm-dev ca-certificates curl gnupg |
| 27 | - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg |
| 28 | - NODE_MAJOR=20 |
| 29 | - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list |
| 30 | - apt-get update && apt-get install nodejs -y |
| 31 | - node --version |
| 32 | - npm install puppeteer |
Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 33 | - locale-gen de_DE.utf8 en_GB.utf8 en_US.utf8 |
Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 34 | - end_section install_linux_packages |
| 35 | |
Marc Kupietz | 24a129b | 2023-10-10 14:04:32 +0200 | [diff] [blame^] | 36 | |
| 37 | - start_section setup_deployment "Setup deployment" |
| 38 | - 'command -v ssh-agent >/dev/null || apt-get install openssh-client -y' |
| 39 | |
| 40 | ## |
| 41 | ## Run ssh-agent (inside the build environment) |
| 42 | ## |
| 43 | - eval $(ssh-agent -s) |
| 44 | |
| 45 | ## |
| 46 | ## Give the right permissions, otherwise ssh-add will refuse to add files |
| 47 | ## Add the SSH key stored in SSH_PRIVATE_KEY file type CI/CD variable to the agent store |
| 48 | ## |
| 49 | - chmod 400 "$SSH_PRIVATE_KEY" |
| 50 | - ssh-add "$SSH_PRIVATE_KEY" |
| 51 | |
| 52 | ## |
| 53 | ## Create the SSH directory and give it the right permissions |
| 54 | ## |
| 55 | - mkdir -p ~/.ssh |
| 56 | - chmod 700 ~/.ssh |
| 57 | - end_section setup_deployment |
| 58 | |
Marc Kupietz | 02d582a | 2023-10-09 20:11:52 +0200 | [diff] [blame] | 59 | - start_section test_puppeteer "Testing puppeteer" |
| 60 | - ./ci/screenshot https://www.google.com /tmp/google.png |
| 61 | - end_section test_puppeteer |
Marc Kupietz | fbf254d | 2023-10-09 15:10:42 +0200 | [diff] [blame] | 62 | |
Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 63 | - start_section install_r_packages "Installing missing R packages" |
Marc Kupietz | e8dc30b | 2023-10-09 12:16:30 +0200 | [diff] [blame] | 64 | - R -e "install.packages(c('devtools', 'RKorAPClient', 'httr', 'tidytext', 'httpuv', 'scales', 'sp', 'raster', 'kableExtra', 'DT', 'svglite', 'qrcode', 'rsvg', 'highcharter'))" |
Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 65 | - R -e 'devtools::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/idsThemeR")' |
Marc Kupietz | 2b548bc | 2023-10-09 07:21:59 +0200 | [diff] [blame] | 66 | - R -e 'devtools::install(".")' |
Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 67 | - end_section install_r_packages |
| 68 | |
| 69 | script: |
| 70 | - start_section render "Running scripts" |
| 71 | - R_CACHE_ROOTPATH=./cache R -e "require(rmarkdown); render('examples/ids.Rmd', output_format='revealjs::revealjs_presentation', output_dir='target')" |
Marc Kupietz | 02d582a | 2023-10-09 20:11:52 +0200 | [diff] [blame] | 72 | - ./ci/screenshot file://`pwd`/target/ids.html target/title.png |
| 73 | file://`pwd`/target/ids.html#/light-verb-constructions target/lvc.png |
| 74 | file://`pwd`/target/ids.html#/registered-users target/users.png |
Marc Kupietz | 5115251 | 2023-10-09 23:18:10 +0200 | [diff] [blame] | 75 | file://`pwd`/target/ids.html#/references-1 target/references.png |
Marc Kupietz | b80aa78 | 2023-10-08 23:33:26 +0200 | [diff] [blame] | 76 | - end_section render |
Marc Kupietz | 24a129b | 2023-10-10 14:04:32 +0200 | [diff] [blame^] | 77 | - start_section deploy "Deploying slides" |
| 78 | - scp -ro StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null target/ids* cowner@klinux10:/vol/work/kupietz/slides/2023-10-08-Revealjs-demo/ |