blob: 37fb414aeca3e5c7a20a0f3f5f4986cdbf343c89 [file] [log] [blame]
Marc Kupietz6dd64022023-11-18 21:30:56 +01001stages:
2 - build-and-test
3 - build-docker-image
Marc Kupietz6ac65072023-11-17 20:31:39 +01004
Marc Kupietz6dd64022023-11-18 21:30:56 +01005build-and-test:
6 image: rocker/tidyverse
7 stage: build-and-test
Marc Kupietz6dd64022023-11-18 21:30:56 +01008 before_script:
9 - source `find .. -name section_helper.sh`
Marc Kupietz6ac65072023-11-17 20:31:39 +010010
Marc Kupietz6dd64022023-11-18 21:30:56 +010011 - 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
31build-docker-image:
32 image: docker:latest
33 services:
34 - docker:dind
Marc Kupietzf6bb6cb2023-11-18 17:17:50 +010035 rules:
36 - if: $CI_COMMIT_TAG =~ /.+/
37 variables:
38 VID: $CI_COMMIT_TAG
39 - when: manual
40 variables:
Marc Kupietz6dd64022023-11-18 21:30:56 +010041 VID_ALT: $CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA
42 VID: snapshot
43 stage: build-docker-image
Marc Kupietz6483a9b2023-11-21 16:31:16 +010044 cache:
Marc Kupietzf9ec7672023-11-21 17:54:55 +010045 key: corpuscomposition
Marc Kupietz6483a9b2023-11-21 16:31:16 +010046 paths:
47 - cache/
Marc Kupietz6ac65072023-11-17 20:31:39 +010048 before_script:
Marc Kupietz6483a9b2023-11-21 16:31:16 +010049 - mkdir -p cache
Marc Kupietzf6bb6cb2023-11-18 17:17:50 +010050 - apk update
51 - apk add --no-cache git
Marc Kupietz6ac65072023-11-17 20:31:39 +010052 script:
Marc Kupietzf6bb6cb2023-11-18 17:17:50 +010053 - docker build -f Dockerfile -t korap/corpuscomposition:$VID .
Marc Kupietz901a5c12023-11-21 17:54:40 +010054 - docker run -d --name corpuscomposition korap/corpuscomposition:$VID
Marc Kupietz6483a9b2023-11-21 16:31:16 +010055 - docker cp corpuscomposition:/cache ./
56 - docker kill corpuscomposition
Marc Kupietz901a5c12023-11-21 17:54:40 +010057 - 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 Kupietz6483a9b2023-11-21 16:31:16 +010058 - docker save korap/corpuscomposition.slim | xz -T0 > corpuscomposition-$VID.xz
Marc Kupietzf6bb6cb2023-11-18 17:17:50 +010059 artifacts:
60 paths:
61 - corpuscomposition-$VID.xz
62