Marc Kupietz | 6dd6402 | 2023-11-18 21:30:56 +0100 | [diff] [blame] | 1 | stages: |
| 2 | - build-and-test |
| 3 | - build-docker-image |
Marc Kupietz | 6ac6507 | 2023-11-17 20:31:39 +0100 | [diff] [blame] | 4 | |
Marc Kupietz | 6dd6402 | 2023-11-18 21:30:56 +0100 | [diff] [blame] | 5 | build-and-test: |
| 6 | image: rocker/tidyverse |
| 7 | stage: build-and-test |
| 8 | cache: |
| 9 | key: korap |
| 10 | paths: |
| 11 | - ./cache |
| 12 | before_script: |
| 13 | - source `find .. -name section_helper.sh` |
Marc Kupietz | 6ac6507 | 2023-11-17 20:31:39 +0100 | [diff] [blame] | 14 | |
Marc Kupietz | 6dd6402 | 2023-11-18 21:30:56 +0100 | [diff] [blame] | 15 | - start_section install_linux_packages "Installing missing Linux packages" |
| 16 | - apt-get update |
| 17 | - apt-get install -y libu2f-udev build-essential libglpk40 libcurl4-gnutls-dev libxml2-dev libsodium-dev libsecret-1-dev libfontconfig1-dev libssl-dev libxt6 libpq-dev curl |
| 18 | - end_section install_linux_packages |
| 19 | |
| 20 | - start_section install_r_packages "Installing missing R packages" |
| 21 | - R -e "install.packages(c('devtools', 'RKorAPClient', 'httr', 'shiny', 'shinythemes', 'highcharter'))" |
| 22 | - R -e 'devtools::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/idsThemeR")' |
| 23 | - end_section install_r_packages |
| 24 | |
| 25 | script: |
| 26 | - start_section render "Running scripts" |
| 27 | - echo 'options(shiny.port=18000)' >> ~/.Rprofile |
| 28 | - R_CACHE_ROOTPATH=./cache Rscript shiny/app.R & |
| 29 | - PID=$! |
| 30 | - sleep 10 |
| 31 | - curl http://127.0.0.1:18000/ |
| 32 | - kill $PID |
| 33 | - end_section render |
| 34 | |
| 35 | build-docker-image: |
| 36 | image: docker:latest |
| 37 | services: |
| 38 | - docker:dind |
Marc Kupietz | f6bb6cb | 2023-11-18 17:17:50 +0100 | [diff] [blame] | 39 | rules: |
| 40 | - if: $CI_COMMIT_TAG =~ /.+/ |
| 41 | variables: |
| 42 | VID: $CI_COMMIT_TAG |
| 43 | - when: manual |
| 44 | variables: |
Marc Kupietz | 6dd6402 | 2023-11-18 21:30:56 +0100 | [diff] [blame] | 45 | VID_ALT: $CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA |
| 46 | VID: snapshot |
| 47 | stage: build-docker-image |
Marc Kupietz | 6ac6507 | 2023-11-17 20:31:39 +0100 | [diff] [blame] | 48 | before_script: |
Marc Kupietz | f6bb6cb | 2023-11-18 17:17:50 +0100 | [diff] [blame] | 49 | - apk update |
| 50 | - apk add --no-cache git |
Marc Kupietz | 6ac6507 | 2023-11-17 20:31:39 +0100 | [diff] [blame] | 51 | script: |
Marc Kupietz | f6bb6cb | 2023-11-18 17:17:50 +0100 | [diff] [blame] | 52 | - docker build -f Dockerfile -t korap/corpuscomposition:$VID . |
| 53 | - docker save korap/corpuscomposition:$VID | xz -T0 -M16G -9 > corpuscomposition-$VID.xz |
| 54 | artifacts: |
| 55 | paths: |
| 56 | - corpuscomposition-$VID.xz |
| 57 | |