From 20a6d30452eb9cad08e31b8e936cc30dd3de470c Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Mon, 4 Dec 2023 11:00:12 +0100 Subject: [PATCH] test: scaffold test setup for running as command --- .github/workflows/docker.test.command.yml | 41 +++++++++++++++++++ ...ocker.test.yml => docker.test.service.yml} | 4 +- ...se.ci.yml => docker-compose.ci.service.yml | 0 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docker.test.command.yml rename .github/workflows/{docker.test.yml => docker.test.service.yml} (94%) rename docker-compose.ci.yml => docker-compose.ci.service.yml (100%) diff --git a/.github/workflows/docker.test.command.yml b/.github/workflows/docker.test.command.yml new file mode 100644 index 0000000..3bb6f7c --- /dev/null +++ b/.github/workflows/docker.test.command.yml @@ -0,0 +1,41 @@ +name: Docker test run as command + +on: + push: + branches: + - 'main' + tags: + - '*' + pull_request: + +jobs: + docker-test: + env: + COMPOSE_ARGS: -f docker-compose.yml -f docker-compose.ci.command.yml + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: docker-compose up + run: docker-compose ${{ env.COMPOSE_ARGS }} up -d + + - name: Make a sparql request + run: | + NUM_BINDINGS=$(curl 'http://localhost:9999/bigdata/namespace/wdq/sparql' -H 'Accept: application/sparql-results+json' --data-raw 'query=SELECT+*+WHERE%7B+%3Fs+%3Fp+%3Fo+%7D' | jq '.results.bindings | length') + # should be plenty more than 100 + if [[ "$NUM_BINDINGS" -lt 100 ]]; then + exit 1 + fi + - name: docker-compose logs > output.log + if: always() + run: docker-compose ${{ env.COMPOSE_ARGS }} logs --no-color > "output.log" + + - name: Archive output.log + uses: actions/upload-artifact@v2 + if: always() + with: + name: DockerTestLog + if-no-files-found: error + path: output.log + diff --git a/.github/workflows/docker.test.yml b/.github/workflows/docker.test.service.yml similarity index 94% rename from .github/workflows/docker.test.yml rename to .github/workflows/docker.test.service.yml index 9ac01a5..9fff6ed 100644 --- a/.github/workflows/docker.test.yml +++ b/.github/workflows/docker.test.service.yml @@ -1,4 +1,4 @@ -name: Docker test +name: Docker test run as service on: push: @@ -11,7 +11,7 @@ on: jobs: docker-test: env: - COMPOSE_ARGS: -f docker-compose.yml -f docker-compose.ci.yml + COMPOSE_ARGS: -f docker-compose.yml -f docker-compose.ci.service.yml runs-on: ubuntu-latest steps: - name: Checkout diff --git a/docker-compose.ci.yml b/docker-compose.ci.service.yml similarity index 100% rename from docker-compose.ci.yml rename to docker-compose.ci.service.yml