blob: 4bc2559e8d05cf02bd943233c06438485ccbacb9 [file] [log] [blame]
# use the verse rocker image, as it contains tidyverse, devtools and some texlive
image: rocker/tidyverse
# define stages of runner. at the moment,
# just build (no test or deploy).
stages:
- build
build-job:
stage: build
cache:
key: revealjs
paths:
- ./cache
artifacts:
paths:
- "target/*"
- "target/ids_files/*"
before_script:
- source `find .. -name section_helper.sh`
- start_section install_linux_packages "Installing missing Linux packages"
- apt-get update
- 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
- curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
- NODE_MAJOR=20
- 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
- apt-get update && apt-get install nodejs -y
- node --version
- npm install puppeteer
- locale-gen de_DE.utf8 en_GB.utf8 en_US.utf8
- end_section install_linux_packages
- start_section setup_deployment "Setup deployment"
- 'command -v ssh-agent >/dev/null || apt-get install openssh-client -y'
##
## Run ssh-agent (inside the build environment)
##
- eval $(ssh-agent -s)
##
## Give the right permissions, otherwise ssh-add will refuse to add files
## Add the SSH key stored in SSH_PRIVATE_KEY file type CI/CD variable to the agent store
##
- chmod 400 "$SSH_PRIVATE_KEY"
- ssh-add "$SSH_PRIVATE_KEY"
##
## Create the SSH directory and give it the right permissions
##
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- end_section setup_deployment
- start_section test_puppeteer "Testing puppeteer"
- ./ci/screenshot https://www.google.com /tmp/google.png
- end_section test_puppeteer
- start_section install_r_packages "Installing missing R packages"
- R -e "install.packages(c('devtools', 'RKorAPClient', 'httr', 'tidytext', 'httpuv', 'scales', 'sp', 'raster', 'kableExtra', 'DT', 'svglite', 'qrcode', 'rsvg', 'highcharter'))"
- R -e 'devtools::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/idsThemeR")'
- R -e 'devtools::install(".")'
- end_section install_r_packages
script:
- start_section render "Running scripts"
- R_CACHE_ROOTPATH=./cache R -e "require(rmarkdown); render('examples/ids.Rmd', output_format='revealjs::revealjs_presentation', output_dir='target')"
- ./ci/screenshot file://`pwd`/target/ids.html target/title.png
file://`pwd`/target/ids.html#/light-verb-constructions target/lvc.png
file://`pwd`/target/ids.html#/registered-users target/users.png
file://`pwd`/target/ids.html#/references-1 target/references.png
- end_section render
- start_section deploy "Deploying slides"
- scp -ro StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null target/ids* cowner@klinux10:/vol/work/kupietz/slides/2023-10-08-Revealjs-demo/