blob: 5619c5aa67f886f0fda78ed618108de3604e4d1a [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
11
12build-and-test-i5:
13 stage: test
14 image: rocker/verse
15 artifacts:
16 paths:
17 - "target/*.i5.xml"
18 - "target/*.zip"
19 cache:
20 - key: DNB4KorAP
21 paths:
22 - apt-cache/
23
24 before_script:
25 - source `find .. -name section_helper.sh`
26 - start_section install_linux_packages "Installing missing Linux packages"
27 - apt-get -o dir::cache::archives="$APT_CACHE_DIR" update
28 - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y libxml2-utils
29 - end_section install_linux_packages
30
31 script:
32 - start_section checking_i5 "Building and testing I5 files"
Marc Kupietz2fe36fa2024-04-15 21:02:36 +020033 - make -j $(nproc) test YEARS=18
Marc Kupietz3d82f562024-03-16 10:19:03 +010034 - end_section checking_i5
35
36
Marc Kupietz6d534882024-03-17 16:25:26 +010037build-index:
Marc Kupietz3d82f562024-03-16 10:19:03 +010038 image: perl:5.38
Marc Kupietzb169c272024-03-16 12:07:54 +010039 services:
40 - docker:dind
Marc Kupietz3d82f562024-03-16 10:19:03 +010041 stage: build
42 rules:
43 - if: $CI_COMMIT_TAG =~ /.+/
44 variables:
45 VID: $CI_COMMIT_TAG
46 - when: manual
47 variables:
48 VID: $CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA
49 PERL_LOCAL_LIB_ROOT: ./perl5
50 PERL5LIB: ./perl5/lib/perl5
51 cache:
52 - key: DNB4KorAP
53 paths:
54 - $PERL_LOCAL_LIB_ROOT
55 - perl5/
56 - apt-cache/
57 - key:
58 files:
Marc Kupietz94bbe6b2024-04-10 20:35:48 +020059 - target/dnb18.i5.xml
Marc Kupietz3d82f562024-03-16 10:19:03 +010060 paths:
Marc Kupietz94bbe6b2024-04-10 20:35:48 +020061 - target/dnb18.zip
62 - target/dnb18.tree_tagger.zip
63 - target/dnb18.marmot-malt.zip
64 - target/dnb18.spacy.zip
65 - target/dnb18.krill.tar
Marc Kupietz13e28582024-04-19 11:26:01 +020066 variables:
67 SRC_DIR: test/resources/DNB
68 YEARS: 18
69
Marc Kupietz3d82f562024-03-16 10:19:03 +010070 before_script:
71 - source `find .. -name section_helper.sh`
72 - start_section install_linux_packages "Installing missing Linux packages"
73 - mkdir -pv $APT_CACHE_DIR
74 - apt-get -o dir::cache::archives="$APT_CACHE_DIR" update
Marc Kupietzb169c272024-03-16 12:07:54 +010075 - 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 +010076 - end_section install_linux_packages
77
Marc Kupietzb169c272024-03-16 12:07:54 +010078 - start_section install_tree_tagger "Installing TreeTagger"
Marc Kupietz420260d2024-03-17 19:14:10 +010079 - 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 +010080 - end_section install_tree_tagger
81
Marc Kupietz6d534882024-03-17 16:25:26 +010082 - start_section install_spacy "Installing spaCy"
Marc Kupietz420260d2024-03-17 19:14:10 +010083 - 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 +010084 - end_section install_spacy
85
Marc Kupietz3d82f562024-03-16 10:19:03 +010086 - start_section install_perl_packages "Installing missing Perl packages"
87 - curl -L https://cpanmin.us | perl - App::cpanminus
88 - 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 +020089 - cpanm -n -l $PERL_LOCAL_LIB_ROOT https://github.com/KorAP/KorAP-XML-Krill.git
90 - cpanm -n -l $PERL_LOCAL_LIB_ROOT https://github.com/KorAP/KorAP-XML-CoNLL-U.git
Marc Kupietz3d82f562024-03-16 10:19:03 +010091 - end_section install_perl_packages
92
93 script:
94 - export PATH=$PERL_LOCAL_LIB_ROOT/bin:$PATH
Marc Kupietz6d534882024-03-17 16:25:26 +010095 - start_section building_index "Building index"
Marc Kupietz420260d2024-03-17 19:14:10 +010096 - touch target/*.zip # ignore timestamps in make
97 - sleep 1
Marc Kupietz48c6a682024-03-24 15:27:08 +010098 - touch target/*.*.zip
Marc Kupietz13e28582024-04-19 11:26:01 +020099 - MAX_THREADS=2 make -j $(nproc) target/dnb.index.tar.xz
Marc Kupietz3d82f562024-03-16 10:19:03 +0100100 - end_section building_krill
101 artifacts:
102 paths:
Marc Kupietzb169c272024-03-16 12:07:54 +0100103 - target/*.zip
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200104 - target/dnb18.index.tar.xz
Marc Kupietz3d82f562024-03-16 10:19:03 +0100105
106deploy:
107 stage: deploy
108 dependencies:
Marc Kupietz420260d2024-03-17 19:14:10 +0100109 - "build-index"
Marc Kupietz3d82f562024-03-16 10:19:03 +0100110 when: manual
111 image: rocker/verse
112 before_script:
113 - source `find .. -name section_helper.sh`
114 - start_section setup_ssh "Setting up SSH"
115 - apt-get update
116 - apt-get install -y rsync openssh-client
117 - mkdir -p ~/.ssh
118 - chmod 700 ~/.ssh
119 - eval $(ssh-agent -s)
120 - chmod 400 $SSH_PRIVATE_KEY
121 - ssh-add $SSH_PRIVATE_KEY
122 - end_section setup_ssh
123 script:
Marc Kupietzb7696992024-03-18 17:41:15 +0100124 - start_section korapxmlu "Uploading index to KorAP4DNB instance"
Marc Kupietz94bbe6b2024-04-10 20:35:48 +0200125 - touch target/dnb18.index.tar.xz
Marc Kupietzb7696992024-03-18 17:41:15 +0100126 - make deploy
Marc Kupietz3d82f562024-03-16 10:19:03 +0100127 - end_section deploy