ci: add test_api job #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test API | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
COMPOSE_FILE: compose.yml:compose.dev.yml | |
FORCE_COLOR: 1 | |
jobs: | |
test_api: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: docker --version | |
- name: Start the docker-compose stack | |
run: docker compose up --detach --wait api fuseki metrics | |
- name: Test if /info returns a response | |
run: curl --verbose http://localhost:8080/exist/restxq/v1/info | |
- name: Add test corpus | |
run: | | |
curl \ | |
--request POST \ | |
--url http://localhost:8080/exist/restxq/v1/corpora \ | |
--user admin: \ | |
--header 'Content-Type: application/json' \ | |
--data '{"name": "test", "title": "Test Drama Corpus", "repository": "https://github.com/dracor-org/testdracor"}' | |
- name: Load data for test corpus | |
run: | | |
curl \ | |
--request POST \ | |
--url http://localhost:8080/exist/restxq/v1/corpora/test \ | |
--user admin: \ | |
--header 'Content-Type: application/json' \ | |
--data '{"load": true}' | |
- name: Test if corpus returns a response | |
run: curl --verbose http://localhost:8080/exist/restxq/v1/corpora/test | |
# TODO: run schemathesis | |
- name: Stop the docker-compose stack | |
run: docker compose down | |
if: always() |