blob: 7545be511525faca54fe4130300792b2a1df3be1 [file] [log] [blame]
Marc Kupietz3d82f562024-03-16 10:19:03 +01001
2stages:
3 - test
4 - build
5 - deploy
6
7variables:
8 VID: $VID
9 DEBIAN_FRONTEND: noninteractive
10 APT_CACHE_DIR: apt-cache
Marc Kupietzd320f992024-04-19 12:30:04 +020011 SRC_DIR: test/resources/DNB
Marc Kupietzfddbb512024-04-26 16:49:02 +020012 YEARS: "13 18"
Marc Kupietz82e5b7b2025-09-25 09:58:29 +020013 SAXON_HOME: "$CI_PROJECT_DIR/lib"
Marc Kupietz3d82f562024-03-16 10:19:03 +010014
15build-and-test-i5:
16 stage: test
17 image: rocker/verse
18 artifacts:
19 paths:
Marc Kupietz5b734ce2024-04-26 17:20:09 +020020 - "target/dnb??.i5.xml"
Marc Kupietz3d82f562024-03-16 10:19:03 +010021 - "target/*.zip"
22 cache:
23 - key: DNB4KorAP
24 paths:
25 - apt-cache/
26
27 before_script:
28 - source `find .. -name section_helper.sh`
Marc Kupietz82e5b7b2025-09-25 09:58:29 +020029 - mkdir -p "$SAXON_HOME"
Marc Kupietzab37fa42025-09-25 10:55:32 +020030 - start_section saxon_license_debug "Preparing Saxon license"
31 - echo "SAXON_HOME=$SAXON_HOME"
32 - echo "SAXON_LICENSE=$SAXON_LICENSE"
33 - ls -l "$SAXON_HOME" || true
34 - ls -l "$SAXON_LICENSE" || true
35 - test -r "$SAXON_LICENSE" && echo "SAXON_LICENSE readable: yes" || echo "SAXON_LICENSE readable: no"
Marc Kupietz82e5b7b2025-09-25 09:58:29 +020036 - |
Marc Kupietz7c56da92025-09-25 10:47:20 +020037 if [ -r "$SAXON_LICENSE" ]; then
Marc Kupietzab37fa42025-09-25 10:55:32 +020038 cp -v "$SAXON_LICENSE" "$SAXON_HOME/saxon-license.lic" && ls -l "$SAXON_HOME/saxon-license.lic"
39 else
40 echo "No readable SAXON_LICENSE file variable present"
Marc Kupietz82e5b7b2025-09-25 09:58:29 +020041 fi
Marc Kupietzab37fa42025-09-25 10:55:32 +020042 - end_section saxon_license_debug
Marc Kupietz3d82f562024-03-16 10:19:03 +010043 - start_section install_linux_packages "Installing missing Linux packages"
44 - apt-get -o dir::cache::archives="$APT_CACHE_DIR" update
Marc Kupietzab0a7332024-04-26 13:25:16 +020045 - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y libxml2-utils curl openjdk-17-jre-headless xmlstarlet
Marc Kupietz3d82f562024-03-16 10:19:03 +010046 - end_section install_linux_packages
Marc Kupietzec784c82024-04-21 17:41:00 +020047 - start_section install_models "Installing models"
48 - make models/dereko_domains_s.classifier
49 - end_section install_models
Marc Kupietz3d82f562024-03-16 10:19:03 +010050
51 script:
52 - start_section checking_i5 "Building and testing I5 files"
Marc Kupietzedce85c2024-04-26 17:17:25 +020053 - make -j $(nproc) test
Marc Kupietz3d82f562024-03-16 10:19:03 +010054 - end_section checking_i5
55
56
Marc Kupietz6d534882024-03-17 16:25:26 +010057build-index:
Marc Kupietz3d82f562024-03-16 10:19:03 +010058 image: perl:5.38
Marc Kupietzb169c272024-03-16 12:07:54 +010059 services:
60 - docker:dind
Marc Kupietz3d82f562024-03-16 10:19:03 +010061 stage: build
62 rules:
Marc Kupietzdf3aacd2024-05-09 21:55:54 +020063 - if: '$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_JOB_MANUAL == "true"'
Marc Kupietzf9a703b2024-05-09 21:53:32 +020064 variables:
65 VID: $CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA
66 PERL_LOCAL_LIB_ROOT: ./perl5
67 PERL5LIB: ./perl5/lib/perl5
Marc Kupietz3d82f562024-03-16 10:19:03 +010068 cache:
69 - key: DNB4KorAP
70 paths:
71 - $PERL_LOCAL_LIB_ROOT
72 - perl5/
73 - apt-cache/
74 - key:
75 files:
Marc Kupietz94bbe6b2024-04-10 20:35:48 +020076 - target/dnb18.i5.xml
Marc Kupietz3d82f562024-03-16 10:19:03 +010077 paths:
Marc Kupietz94bbe6b2024-04-10 20:35:48 +020078 - target/dnb18.zip
79 - target/dnb18.tree_tagger.zip
80 - target/dnb18.marmot-malt.zip
81 - target/dnb18.spacy.zip
82 - target/dnb18.krill.tar
Marc Kupietz13e28582024-04-19 11:26:01 +020083
Marc Kupietz3d82f562024-03-16 10:19:03 +010084 before_script:
85 - source `find .. -name section_helper.sh`
Marc Kupietz82e5b7b2025-09-25 09:58:29 +020086 - mkdir -p "$SAXON_HOME"
Marc Kupietzab37fa42025-09-25 10:55:32 +020087 - start_section saxon_license_debug "Preparing Saxon license"
88 - echo "SAXON_HOME=$SAXON_HOME"
89 - echo "SAXON_LICENSE=$SAXON_LICENSE"
90 - ls -l "$SAXON_HOME" || true
91 - ls -l "$SAXON_LICENSE" || true
92 - test -r "$SAXON_LICENSE" && echo "SAXON_LICENSE readable: yes" || echo "SAXON_LICENSE readable: no"
Marc Kupietz82e5b7b2025-09-25 09:58:29 +020093 - |
Marc Kupietz7c56da92025-09-25 10:47:20 +020094 if [ -r "$SAXON_LICENSE" ]; then
Marc Kupietzab37fa42025-09-25 10:55:32 +020095 cp -v "$SAXON_LICENSE" "$SAXON_HOME/saxon-license.lic" && ls -l "$SAXON_HOME/saxon-license.lic"
96 else
97 echo "No readable SAXON_LICENSE file variable present"
Marc Kupietz82e5b7b2025-09-25 09:58:29 +020098 fi
Marc Kupietzab37fa42025-09-25 10:55:32 +020099 - end_section saxon_license_debug
Marc Kupietz3d82f562024-03-16 10:19:03 +0100100 - start_section install_linux_packages "Installing missing Linux packages"
101 - mkdir -pv $APT_CACHE_DIR
102 - apt-get -o dir::cache::archives="$APT_CACHE_DIR" update
Marc Kupietzb169c272024-03-16 12:07:54 +0100103 - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y rsync pv jq curl openjdk-17-jre-headless docker.io
Marc Kupietz3d82f562024-03-16 10:19:03 +0100104 - end_section install_linux_packages
105
Marc Kupietzb169c272024-03-16 12:07:54 +0100106 - start_section install_tree_tagger "Installing TreeTagger"
Marc Kupietz420260d2024-03-17 19:14:10 +0100107 - docker image inspect korap/conllu2treetagger:latest >/dev/null 2>&1 || curl -Ls 'https://gitlab.ids-mannheim.de/KorAP/CoNLL-U-Treetagger/-/jobs/artifacts/master/raw/conllu2treetagger.xz?job=build-docker-image' | docker load
Marc Kupietzb169c272024-03-16 12:07:54 +0100108 - end_section install_tree_tagger
109
Marc Kupietz6d534882024-03-17 16:25:26 +0100110 - start_section install_spacy "Installing spaCy"
Marc Kupietz420260d2024-03-17 19:14:10 +0100111 - docker image inspect korap/conllu2spacy:latest >/dev/null 2>&1 || curl -Ls https://corpora.ids-mannheim.de/tools/conllu2spacy.tar.xz | docker load
Marc Kupietz6d534882024-03-17 16:25:26 +0100112 - end_section install_spacy
113
Marc Kupietz3d82f562024-03-16 10:19:03 +0100114 - start_section install_perl_packages "Installing missing Perl packages"
115 - curl -L https://cpanmin.us | perl - App::cpanminus
116 - cpanm -n -l $PERL_LOCAL_LIB_ROOT File::ShareDir::Install https://github.com/KorAP/KorAP-XML-TEI.git
Marc Kupietzf73a91d2024-04-10 20:45:42 +0200117 - cpanm -n -l $PERL_LOCAL_LIB_ROOT https://github.com/KorAP/KorAP-XML-Krill.git
118 - cpanm -n -l $PERL_LOCAL_LIB_ROOT https://github.com/KorAP/KorAP-XML-CoNLL-U.git
Marc Kupietz3d82f562024-03-16 10:19:03 +0100119 - end_section install_perl_packages
120
121 script:
122 - export PATH=$PERL_LOCAL_LIB_ROOT/bin:$PATH
Marc Kupietz6d534882024-03-17 16:25:26 +0100123 - start_section building_index "Building index"
Marc Kupietz420260d2024-03-17 19:14:10 +0100124 - touch target/*.zip # ignore timestamps in make
125 - sleep 1
Marc Kupietz48c6a682024-03-24 15:27:08 +0100126 - touch target/*.*.zip
Marc Kupietz13e28582024-04-19 11:26:01 +0200127 - MAX_THREADS=2 make -j $(nproc) target/dnb.index.tar.xz
Marc Kupietz3d82f562024-03-16 10:19:03 +0100128 - end_section building_krill
129 artifacts:
130 paths:
Marc Kupietzb169c272024-03-16 12:07:54 +0100131 - target/*.zip
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200132 - target/dnb18.index.tar.xz
Marc Kupietz3d82f562024-03-16 10:19:03 +0100133
134deploy:
135 stage: deploy
136 dependencies:
Marc Kupietz420260d2024-03-17 19:14:10 +0100137 - "build-index"
Marc Kupietz105913d2024-05-09 21:34:13 +0200138 rules:
Marc Kupietzdf3aacd2024-05-09 21:55:54 +0200139 - if: '$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_JOB_MANUAL == "true"'
Marc Kupietz3d82f562024-03-16 10:19:03 +0100140 image: rocker/verse
141 before_script:
142 - source `find .. -name section_helper.sh`
Marc Kupietz82e5b7b2025-09-25 09:58:29 +0200143 - mkdir -p "$SAXON_HOME"
Marc Kupietzab37fa42025-09-25 10:55:32 +0200144 - start_section saxon_license_debug "Preparing Saxon license"
145 - echo "SAXON_HOME=$SAXON_HOME"
146 - echo "SAXON_LICENSE=$SAXON_LICENSE"
147 - ls -l "$SAXON_HOME" || true
148 - ls -l "$SAXON_LICENSE" || true
149 - test -r "$SAXON_LICENSE" && echo "SAXON_LICENSE readable: yes" || echo "SAXON_LICENSE readable: no"
Marc Kupietz82e5b7b2025-09-25 09:58:29 +0200150 - |
Marc Kupietz7c56da92025-09-25 10:47:20 +0200151 if [ -r "$SAXON_LICENSE" ]; then
Marc Kupietzab37fa42025-09-25 10:55:32 +0200152 cp -v "$SAXON_LICENSE" "$SAXON_HOME/saxon-license.lic" && ls -l "$SAXON_HOME/saxon-license.lic"
153 else
154 echo "No readable SAXON_LICENSE file variable present"
Marc Kupietz82e5b7b2025-09-25 09:58:29 +0200155 fi
Marc Kupietzab37fa42025-09-25 10:55:32 +0200156 - end_section saxon_license_debug
Marc Kupietz3d82f562024-03-16 10:19:03 +0100157 - start_section setup_ssh "Setting up SSH"
158 - apt-get update
159 - apt-get install -y rsync openssh-client
160 - mkdir -p ~/.ssh
161 - chmod 700 ~/.ssh
162 - eval $(ssh-agent -s)
163 - chmod 400 $SSH_PRIVATE_KEY
164 - ssh-add $SSH_PRIVATE_KEY
165 - end_section setup_ssh
166 script:
Marc Kupietzb7696992024-03-18 17:41:15 +0100167 - start_section korapxmlu "Uploading index to KorAP4DNB instance"
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200168 - touch target/dnb18.index.tar.xz
Marc Kupietzb7696992024-03-18 17:41:15 +0100169 - make deploy
Marc Kupietz3d82f562024-03-16 10:19:03 +0100170 - end_section deploy