Add example index test to CI workflow

Change-Id: If4b692a336b7ec17378d279ecf1149461672826b
diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml
index 3ed9441..4065798 100644
--- a/.github/workflows/ci_test.yml
+++ b/.github/workflows/ci_test.yml
@@ -16,7 +16,7 @@
       - name: Build index
         run: |
           mkdir index
-          docker run -u root --rm -v ${PWD}:/data:z korap/kustvakt Krill-Indexer.jar -c /kustvakt/kustvakt-lite.conf -i /data/json -o /data/index/
+          INDEX=./index docker run -u root --rm -v ${PWD}:/data:z korap/kustvakt Krill-Indexer.jar -c /kustvakt/kustvakt-lite.conf -i /data/json -o /data/index/
       - name: Start KorAP - lite
         run: INDEX=./index docker-compose -p korap --profile=lite up -d
       - name: Wait until KorAP is up and running
@@ -71,3 +71,21 @@
 
       - name: Stop KorAP
         run: docker-compose -p korap --profile=full stop
+
+      - name: Start KorAP with example index
+        run: INDEX='example-index' docker-compose -p korap-example-index --profile=example --profile=lite up -d
+      - name: Wait until KorAP with example index is up and running
+        run: count=0; while test $count -lt 25 && ! docker-compose -p korap-example-index logs | grep -E "Listening at.*:64543"; do count=$((count+1)); echo "waiting ${count}s"; sleep 1; done; sleep 10
+      - name: Test that API delivers some search hits on example index
+        run: test $(curl --silent 'http://localhost:64543/api/v1.0/search?q=%5Btt%2Fl%3Dgut+%26+tt%2Fp%3DADJD%5D&ql=poliqarp' | jq '.matches | length') -gt 10
+      - name: Test that UI delivers some search hits on example index
+        run: test $(curl --silent 'http://localhost:64543?q=%5Btt%2Fl%3Dgut+%26+tt%2Fp%3DADJD%5D&ql=poliqarp' | grep -c snippet) -gt 10
+      - name: Run end-to-end tests on example index
+        working-directory: ./KorAP-E2E-Tests
+        env:
+          KORAP_LOGIN: ""
+          KORAP_QUERIES: "[corenlp/p=VAFIN][]{2}[marmot/m=number:sg][opennlp/p=PPER][tt/l=er][tt/p=ADV]"
+        run: xvfb-run --auto-servernum npm test
+
+      - name: Stop KorAP
+        run: docker-compose -p korap-example-index --profile=lite --profile=example stop