| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 1 | |
| 2 | stages: |
| 3 | - test |
| 4 | - build |
| 5 | - deploy |
| 6 | |
| 7 | variables: |
| 8 | VID: $VID |
| 9 | DEBIAN_FRONTEND: noninteractive |
| 10 | APT_CACHE_DIR: apt-cache |
| Marc Kupietz | d320f99 | 2024-04-19 12:30:04 +0200 | [diff] [blame] | 11 | SRC_DIR: test/resources/DNB |
| 12 | YEARS: 18 |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 13 | |
| 14 | build-and-test-i5: |
| 15 | stage: test |
| 16 | image: rocker/verse |
| 17 | artifacts: |
| 18 | paths: |
| 19 | - "target/*.i5.xml" |
| 20 | - "target/*.zip" |
| 21 | cache: |
| 22 | - key: DNB4KorAP |
| 23 | paths: |
| 24 | - apt-cache/ |
| 25 | |
| 26 | before_script: |
| 27 | - source `find .. -name section_helper.sh` |
| 28 | - start_section install_linux_packages "Installing missing Linux packages" |
| 29 | - apt-get -o dir::cache::archives="$APT_CACHE_DIR" update |
| Marc Kupietz | ec784c8 | 2024-04-21 17:41:00 +0200 | [diff] [blame] | 30 | - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y libxml2-utils curl |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 31 | - end_section install_linux_packages |
| Marc Kupietz | ec784c8 | 2024-04-21 17:41:00 +0200 | [diff] [blame] | 32 | - start_section install_models "Installing models" |
| 33 | - make models/dereko_domains_s.classifier |
| 34 | - end_section install_models |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 35 | |
| 36 | script: |
| 37 | - start_section checking_i5 "Building and testing I5 files" |
| Marc Kupietz | 2fe36fa | 2024-04-15 21:02:36 +0200 | [diff] [blame] | 38 | - make -j $(nproc) test YEARS=18 |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 39 | - end_section checking_i5 |
| 40 | |
| 41 | |
| Marc Kupietz | 6d53488 | 2024-03-17 16:25:26 +0100 | [diff] [blame] | 42 | build-index: |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 43 | image: perl:5.38 |
| Marc Kupietz | b169c27 | 2024-03-16 12:07:54 +0100 | [diff] [blame] | 44 | services: |
| 45 | - docker:dind |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 46 | stage: build |
| 47 | rules: |
| 48 | - if: $CI_COMMIT_TAG =~ /.+/ |
| 49 | variables: |
| 50 | VID: $CI_COMMIT_TAG |
| 51 | - when: manual |
| 52 | variables: |
| 53 | VID: $CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA |
| 54 | PERL_LOCAL_LIB_ROOT: ./perl5 |
| 55 | PERL5LIB: ./perl5/lib/perl5 |
| 56 | cache: |
| 57 | - key: DNB4KorAP |
| 58 | paths: |
| 59 | - $PERL_LOCAL_LIB_ROOT |
| 60 | - perl5/ |
| 61 | - apt-cache/ |
| 62 | - key: |
| 63 | files: |
| Marc Kupietz | 94bbe6b | 2024-04-10 20:35:48 +0200 | [diff] [blame] | 64 | - target/dnb18.i5.xml |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 65 | paths: |
| Marc Kupietz | 94bbe6b | 2024-04-10 20:35:48 +0200 | [diff] [blame] | 66 | - target/dnb18.zip |
| 67 | - target/dnb18.tree_tagger.zip |
| 68 | - target/dnb18.marmot-malt.zip |
| 69 | - target/dnb18.spacy.zip |
| 70 | - target/dnb18.krill.tar |
| Marc Kupietz | 13e2858 | 2024-04-19 11:26:01 +0200 | [diff] [blame] | 71 | |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 72 | before_script: |
| 73 | - source `find .. -name section_helper.sh` |
| 74 | - start_section install_linux_packages "Installing missing Linux packages" |
| 75 | - mkdir -pv $APT_CACHE_DIR |
| 76 | - apt-get -o dir::cache::archives="$APT_CACHE_DIR" update |
| Marc Kupietz | b169c27 | 2024-03-16 12:07:54 +0100 | [diff] [blame] | 77 | - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y rsync pv jq curl openjdk-17-jre-headless docker.io |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 78 | - end_section install_linux_packages |
| 79 | |
| Marc Kupietz | b169c27 | 2024-03-16 12:07:54 +0100 | [diff] [blame] | 80 | - start_section install_tree_tagger "Installing TreeTagger" |
| Marc Kupietz | 420260d | 2024-03-17 19:14:10 +0100 | [diff] [blame] | 81 | - 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 Kupietz | b169c27 | 2024-03-16 12:07:54 +0100 | [diff] [blame] | 82 | - end_section install_tree_tagger |
| 83 | |
| Marc Kupietz | 6d53488 | 2024-03-17 16:25:26 +0100 | [diff] [blame] | 84 | - start_section install_spacy "Installing spaCy" |
| Marc Kupietz | 420260d | 2024-03-17 19:14:10 +0100 | [diff] [blame] | 85 | - docker image inspect korap/conllu2spacy:latest >/dev/null 2>&1 || curl -Ls https://corpora.ids-mannheim.de/tools/conllu2spacy.tar.xz | docker load |
| Marc Kupietz | 6d53488 | 2024-03-17 16:25:26 +0100 | [diff] [blame] | 86 | - end_section install_spacy |
| 87 | |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 88 | - start_section install_perl_packages "Installing missing Perl packages" |
| 89 | - curl -L https://cpanmin.us | perl - App::cpanminus |
| 90 | - cpanm -n -l $PERL_LOCAL_LIB_ROOT File::ShareDir::Install https://github.com/KorAP/KorAP-XML-TEI.git |
| Marc Kupietz | f73a91d | 2024-04-10 20:45:42 +0200 | [diff] [blame] | 91 | - cpanm -n -l $PERL_LOCAL_LIB_ROOT https://github.com/KorAP/KorAP-XML-Krill.git |
| 92 | - cpanm -n -l $PERL_LOCAL_LIB_ROOT https://github.com/KorAP/KorAP-XML-CoNLL-U.git |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 93 | - end_section install_perl_packages |
| 94 | |
| 95 | script: |
| 96 | - export PATH=$PERL_LOCAL_LIB_ROOT/bin:$PATH |
| Marc Kupietz | 6d53488 | 2024-03-17 16:25:26 +0100 | [diff] [blame] | 97 | - start_section building_index "Building index" |
| Marc Kupietz | 420260d | 2024-03-17 19:14:10 +0100 | [diff] [blame] | 98 | - touch target/*.zip # ignore timestamps in make |
| 99 | - sleep 1 |
| Marc Kupietz | 48c6a68 | 2024-03-24 15:27:08 +0100 | [diff] [blame] | 100 | - touch target/*.*.zip |
| Marc Kupietz | 13e2858 | 2024-04-19 11:26:01 +0200 | [diff] [blame] | 101 | - MAX_THREADS=2 make -j $(nproc) target/dnb.index.tar.xz |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 102 | - end_section building_krill |
| 103 | artifacts: |
| 104 | paths: |
| Marc Kupietz | b169c27 | 2024-03-16 12:07:54 +0100 | [diff] [blame] | 105 | - target/*.zip |
| Marc Kupietz | 94bbe6b | 2024-04-10 20:35:48 +0200 | [diff] [blame] | 106 | - target/dnb18.index.tar.xz |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 107 | |
| 108 | deploy: |
| 109 | stage: deploy |
| 110 | dependencies: |
| Marc Kupietz | 420260d | 2024-03-17 19:14:10 +0100 | [diff] [blame] | 111 | - "build-index" |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 112 | when: manual |
| 113 | image: rocker/verse |
| 114 | before_script: |
| 115 | - source `find .. -name section_helper.sh` |
| 116 | - start_section setup_ssh "Setting up SSH" |
| 117 | - apt-get update |
| 118 | - apt-get install -y rsync openssh-client |
| 119 | - mkdir -p ~/.ssh |
| 120 | - chmod 700 ~/.ssh |
| 121 | - eval $(ssh-agent -s) |
| 122 | - chmod 400 $SSH_PRIVATE_KEY |
| 123 | - ssh-add $SSH_PRIVATE_KEY |
| 124 | - end_section setup_ssh |
| 125 | script: |
| Marc Kupietz | b769699 | 2024-03-18 17:41:15 +0100 | [diff] [blame] | 126 | - start_section korapxmlu "Uploading index to KorAP4DNB instance" |
| Marc Kupietz | 94bbe6b | 2024-04-10 20:35:48 +0200 | [diff] [blame] | 127 | - touch target/dnb18.index.tar.xz |
| Marc Kupietz | b769699 | 2024-03-18 17:41:15 +0100 | [diff] [blame] | 128 | - make deploy |
| Marc Kupietz | 3d82f56 | 2024-03-16 10:19:03 +0100 | [diff] [blame] | 129 | - end_section deploy |