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