Skip to content

Commit

Permalink
Add smoke test to detect issues with Docker images (#515)
Browse files Browse the repository at this point in the history
* Add docker smoke test + workflow

* Update docker-image.yml

* Update docker-image.yml
  • Loading branch information
Sophietje authored Aug 20, 2024
1 parent bc04b97 commit 631910b
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Docker Image CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
MAVEN_OPTS: -Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true
MAVEN_CLI_OPTS: --batch-mode --errors --fail-at-end --show-version

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Run the Maven verify phase
run: mvn $MAVEN_CLI_OPTS verify
- name: Build Docker image for Knowledge Directory
uses: docker/build-push-action@v6
with:
context: ./knowledge-directory
platforms: linux/amd64
tags: knowledge-directory
load: true
- name: Build Docker image for Smart Connector
uses: docker/build-push-action@v6
with:
context: ./smart-connector-rest-dist
platforms: linux/amd64
tags: smart-connector
load: true
- name: Build and start smoke test
run: docker compose -f ".github/workflows/docker-smoke-test" up -d --build
- name: Check smoke test status
run: sleep 60s && test $(docker info --format '{{json .ContainersRunning}}') == 5
shell: bash
46 changes: 46 additions & 0 deletions .github/workflows/docker-smoke-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
services:
knowledge-directory:
image: knowledge-directory

runtime-1:
image: smart-connector
environment:
KE_RUNTIME_PORT: 8081
KE_RUNTIME_EXPOSED_URL: http://runtime-1:8081
KD_URL: http://knowledge-directory:8282
runtime-2:
image: smart-connector
environment:
KE_RUNTIME_PORT: 8081
KE_RUNTIME_EXPOSED_URL: http://runtime-2:8081
KD_URL: http://knowledge-directory:8282

kb1:
build: ../../examples/common/asking_kb
environment:
KE_URL: http://runtime-1:8280/rest
KB_ID: http://example.org/kb1
PREFIXES: |
{
"ex": "http://example.org/"
}
GRAPH_PATTERN: |
?a ex:relatedTo ?b .
kb2:
build: ../../examples/common/answering_kb
environment:
KE_URL: http://runtime-2:8280/rest
KB_ID: http://example.org/kb2
PREFIXES: |
{
"ex": "http://example.org/"
}
GRAPH_PATTERN: |
?a ex:relatedTo ?b .
KB_DATA: |
[
{
"a": "<http://example.org/Math>",
"b": "<http://example.org/Science>"
}
]

0 comments on commit 631910b

Please sign in to comment.