Add CI workflow
Change-Id: Ib6f724e47d01f905147e85e768a2392d5025373a
diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml
new file mode 100644
index 0000000..1aed7de
--- /dev/null
+++ b/.github/workflows/ci_test.yml
@@ -0,0 +1,30 @@
+name: CI Test
+
+on: [push, pull_request]
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Convert TEI input to KorAP-XML
+ run: docker run --rm -v ${PWD}/example:/data korap/kalamar:latest-conv tei2korapxml --inline-tokens '!cmc#morpho' --input /data/dck-part1.i5.xml > dck.zip
+ - name: Convert KorAP-XML to Krill
+ run: |
+ mkdir json
+ docker run --rm -u root -v ${PWD}:/kalamar/data:z korap/kalamar:latest-conv korapxml2krill archive -z -i /kalamar/data/dck.zip --jobs -1 --token 'cmc#morpho' --base-paragraphs 'DeReKo#Structure' --base-sentences 'DeReKo#Structure' -o ./data/json/
+ - name: Build index
+ run: |
+ mkdir index
+ docker run -u root --rm -v ${PWD}:/data:z korap/kustvakt Krill-Indexer.jar -c kustvakt-lite.conf -i /data/json -o /data/index/
+ - name: Start KorAP
+ run: INDEX=./index docker-compose up -d
+ - name: Wait until KorAP is up and running
+ run: count=0; while test $count -lt 25 && ! docker-compose logs | grep "Initiating Jersey"; do count=$((count+1)); echo "waiting ${count}s"; sleep 1; done; sleep 10
+ - name: Test that API delivers some search hits
+ run: test $(curl --silent 'http://localhost:64543/api/v1.0/search?q=geht&ql=poliqarp&cq=corpusSigle=DCK' | jq '.matches | length') -gt 10
+ - name: Test that UI delivers some search hits
+ run: test $(curl --silent 'http://localhost:64543?q=geht&ql=poliqarp&cq=corpusSigle=DCK' | grep -c snippet) -gt 10
+ - name: Stop KorAP
+ run: docker-compose stop
+