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 |
Marc Kupietz | 6dd6402 | 2023-11-18 21:30:56 +0100 | [diff] [blame] | 8 | before_script: |
| 9 | - source `find .. -name section_helper.sh` |
Marc Kupietz | 6ac6507 | 2023-11-17 20:31:39 +0100 | [diff] [blame] | 10 | |
Marc Kupietz | 6dd6402 | 2023-11-18 21:30:56 +0100 | [diff] [blame] | 11 | - start_section install_linux_packages "Installing missing Linux packages" |
| 12 | - apt-get update |
| 13 | - 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 |
| 14 | - end_section install_linux_packages |
| 15 | |
| 16 | - start_section install_r_packages "Installing missing R packages" |
| 17 | - R -e "install.packages(c('devtools', 'RKorAPClient', 'httr', 'shiny', 'shinythemes', 'highcharter'))" |
| 18 | - R -e 'devtools::install_git("https://korap.ids-mannheim.de/gerrit/IDS-Mannheim/idsThemeR")' |
| 19 | - end_section install_r_packages |
| 20 | |
| 21 | script: |
| 22 | - start_section render "Running scripts" |
| 23 | - echo 'options(shiny.port=18000)' >> ~/.Rprofile |
| 24 | - R_CACHE_ROOTPATH=./cache Rscript shiny/app.R & |
| 25 | - PID=$! |
| 26 | - sleep 10 |
| 27 | - curl http://127.0.0.1:18000/ |
| 28 | - kill $PID |
| 29 | - end_section render |
| 30 | |
| 31 | build-docker-image: |
| 32 | image: docker:latest |
| 33 | services: |
| 34 | - docker:dind |
Marc Kupietz | f6bb6cb | 2023-11-18 17:17:50 +0100 | [diff] [blame] | 35 | rules: |
| 36 | - if: $CI_COMMIT_TAG =~ /.+/ |
| 37 | variables: |
| 38 | VID: $CI_COMMIT_TAG |
| 39 | - when: manual |
| 40 | variables: |
Marc Kupietz | 6dd6402 | 2023-11-18 21:30:56 +0100 | [diff] [blame] | 41 | VID_ALT: $CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA |
| 42 | VID: snapshot |
| 43 | stage: build-docker-image |
Marc Kupietz | 6483a9b | 2023-11-21 16:31:16 +0100 | [diff] [blame] | 44 | cache: |
Marc Kupietz | f9ec767 | 2023-11-21 17:54:55 +0100 | [diff] [blame] | 45 | key: corpuscomposition |
Marc Kupietz | 6483a9b | 2023-11-21 16:31:16 +0100 | [diff] [blame] | 46 | paths: |
| 47 | - cache/ |
Marc Kupietz | 6ac6507 | 2023-11-17 20:31:39 +0100 | [diff] [blame] | 48 | before_script: |
Marc Kupietz | 6483a9b | 2023-11-21 16:31:16 +0100 | [diff] [blame] | 49 | - mkdir -p cache |
Marc Kupietz | f6bb6cb | 2023-11-18 17:17:50 +0100 | [diff] [blame] | 50 | - apk update |
| 51 | - apk add --no-cache git |
Marc Kupietz | 6ac6507 | 2023-11-17 20:31:39 +0100 | [diff] [blame] | 52 | script: |
Marc Kupietz | 25da391 | 2023-12-05 15:39:00 +0100 | [diff] [blame] | 53 | - docker rm --force /corpuscomposition |
Marc Kupietz | f6bb6cb | 2023-11-18 17:17:50 +0100 | [diff] [blame] | 54 | - docker build -f Dockerfile -t korap/corpuscomposition:$VID . |
Marc Kupietz | 901a5c1 | 2023-11-21 17:54:40 +0100 | [diff] [blame] | 55 | - docker run -d --name corpuscomposition korap/corpuscomposition:$VID |
Marc Kupietz | 6483a9b | 2023-11-21 16:31:16 +0100 | [diff] [blame] | 56 | - docker cp corpuscomposition:/cache ./ |
| 57 | - docker kill corpuscomposition |
Marc Kupietz | 901a5c1 | 2023-11-21 17:54:40 +0100 | [diff] [blame] | 58 | - docker run --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/slim build --include-path /usr/local --include-path /cache korap/corpuscomposition |
Marc Kupietz | 6483a9b | 2023-11-21 16:31:16 +0100 | [diff] [blame] | 59 | - docker save korap/corpuscomposition.slim | xz -T0 > corpuscomposition-$VID.xz |
Marc Kupietz | f6bb6cb | 2023-11-18 17:17:50 +0100 | [diff] [blame] | 60 | artifacts: |
| 61 | paths: |
| 62 | - corpuscomposition-$VID.xz |
| 63 | |